Skip to content

termux-sshd

You can run OpenSSH Server in Termux to make it remotely controllable.

To install it:

Bash
pkg install openssh

If you want to set up password authentication:

Bash
passwd

Note: the password will be stored (hashed) into ~/.termux_authinfo. The passwd command will NOT ask you for the old one, so you can always reset it in case you forget it.

If you want to set up public key authentication:

Bash
echo 'ssh-ed25519 AAAAC3Nza...' >> ~/.ssh/authorized_keys

To be able to connect, you also need to know what is your username in Termux, and the IP address of your device:

Bash
whoami
ip a

Now you can start the SSH server:

Bash
sshd -De

You can now connect to it by running the following from another host (the default port of the SSH server in Termux is 8022):

Bash
ssh u0_a123@192.168.0.123 -p8022