原链接:
With the brilliantTermuxterminal emulator app you can run an SSH server on your Android.
Perviously I usedSSHDroidto achieve this, but with Termux is much nicer because you have access to a working package manager.
Run the service
You neet to install the OpenSSH package
apt install openssh
and use following command to start the ssh server.
sshd
And there you go. Your ssh service is now running on port 8022.
ssh localhost -p 8022
Adding your Public key
You can do password authentication in Termux, therefore you need to put your OpenSSH public key into the ~/.ssh/authorized_keys file.
This file will need to be created and permissions set to 600.
touch ~/.ssh/authorized_keys
# Set Permissions to the file
chmod 600 ~/.ssh/authorized_keys
# Make sure the folder .ssh folder has the correct perm