Termux <https://termux.com�>
android
先安装 Termux
$ pkg install openssh -y # 安装 ssh
$ sshd # 启动 ssh
macOS 等其它终端 ssh
访问 android
设备
$ ssh-keygen -t rsa # 生成公钥
$ adb devices # 查看连接 android
$ adb push ~/.ssh/id_rsa.pub /data/data/com.termun/file/home/.ssh/id_rsa.pub
...remote Permission denied # 设备没有 root
想其它方法,将 ~/.ssh/id_rsa.pub
上传到 android
我直接用搬瓦工,先将
$ scp -P 28743 ~/.ssh/id_rsa.pub user@BandwagonHost:/home/user
回到 android
,打开Termux
$ scp -P 28743 user@BandwagonHost:/home/user ~/.ssh/id_rsa.pub
$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$ whoami
u0_159
$ ifconfig
...
wlan0 inte addr: 10.0.0.169 ...
user: u0_159
android_ip: 10.0.0.169
回到 macOS
$ ssh user@android_ip -p 8022
Welcome to Termux!
终于成功了。
网友评论