发新话题
打印

手机秒变服务器-神器termux

手机秒变服务器-神器termux

# 配置termux软件

## 1、下载termux
可以在termux官网或者其他比较安全的网站下载app
## 2、切换pkg软件源
输入命令,可以进入切换软件源界面
```
termux-change-repo
```
选择USTC软件源
## 3、安装open-ssh
a、输入命令
```
pkg install openssh
```
报错处理
```
CANNOT LINK EXECUTABLE "ssh-keygen": library "libcrypto.so.3" not found: needed by main executable
CANNOT LINK EXECUTABLE "ssh-keygen": library "libcrypto.so.3" not found: needed by main executable
CANNOT LINK EXECUTABLE "ssh-keygen": library "libcrypto.so.3" not found: needed by main executable
CANNOT LINK EXECUTABLE "ssh-keygen": library "libcrypto.so.3" not found: needed by main executable
```
需要更新ssl
```
pkg install openssl
```
然后安装openssh成功
b、添加秘钥
```
ssh-keygen -A
```
c、启动ssh
```
sshd
```
d、查看用户名
```
whoami
```
e、查看ip
```
ifconfig
```
f、设置密码,否则ssh访问被拒
```
passwd
```
## 4、远程登录ssh
使用ssh协议登录
```
ssh -p8022 [email protected]
```
登录报错
```
C:\Users\jiangcheng>ssh -p8022 [email protected]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ED25519 key sent by the remote host is
SHA256:9eRAhza7fTCjqc4VD/iswDbCrMS0lomlICnwwY/Pxwk.
Please contact your system administrator.
Add correct host key in C:\\Users\\jiangcheng/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in C:\\Users\\jiangcheng/.ssh/known_hosts:15
Host key for [172.20.52.246]:8022 has changed and you have requested strict checking.
Host key verification failed.
```
清理用户文件夹下.ssh/known_hosts,继续登录
```
C:\Users\jiangcheng>ssh -p8022 [email protected]
The authenticity of host '[172.20.52.246]:8022 ([172.20.52.246]:8022)' can't be established.
ED25519 key fingerprint is SHA256:9eRAhza7fTCjqc4VD/iswDbCrMS0lomlICnwwY/Pxwk.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[172.20.52.246]:8022' (ED25519) to the list of known hosts.
[email protected]'s password:

Welcome to Termux!

原文:
https://zhuanlan.zhihu.com/p/637234364

debug:
sshd -E ./1.txt
cat 1.txt

sshd配置文件:
/data/data/com.termux/files/usr/etc/ssh/sshd_config

# listen on LAN nic
ListenAddress 192.168.1.x
KexAlgorithms [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
PermitRootLogin yes  
PasswordAuthentication yes

修改后使配置生效
pkill -1 sshd

passwd生成的配置文件:.termux_authinfo
/data/data/com.termux/files/home/.termux_authinfo


ps ax: 查看进程

[ 本帖最后由 linda 于 2023-9-26 16:04 编辑 ]

TOP

发新话题