Use ssh to connect to termux

Apply for read and write permissions

termux-setup-storage

Install openssh

apt update
apt upgrade
apt install openssh

Start ssh

sshd

So far, the mobile terminal has been settled

Configure the login key.
First, install the ssh tool on the computer, and then enter cmd

ssh-keygen

After the key is generated, enter the computer administrator directory and copy the .pubfile to the root directory of the phone, which is/storage/emulated/0

Copy mobile key

cd ~/.ssh
cp /sdcard/[文件名].pub ./
cat [文件名].pub >> authorized_keys

So far all tasks have been completed

Finally, let us get the username and password of termux to connect through the ssh tool

Get username

whoami

change Password

passwd

View ip address

ifconfig -a

ssh connection

The syntax format is as follows

ssh [username]@[host] -p [port] #termux ssh默认端口为8022

Quoted article: https://blog.csdn.net/zhangbangqian/article/details/82019175

Guess you like

Origin blog.csdn.net/qq_17802895/article/details/113788739