Skip to main content

Setting up SSH on Termux

Entering commands with the Android touch screen can be a pain. You can either connect a keyboard or setup SSH to remotely connect from a computer instead. This also allows you transfer files to your device using a SFTP client.

To enabled SSH on your Android device:

  1. Open Termux and install SSHD: pkg install openssh
  2. Set a password: passwd
  3. Get your username: whoami
  4. Get your ip address: ifconfig
    On a RP3, it should be the inet value under wlan0
  5. Start sshd: sshd

On your computer use a ssh client to connect. Windows 11, Linux, and Mac computers should be able to use the ssh command in commandline: ssh username@ipaddress -p 8022. Windows 10 and below maybe need to install an SSH client such as PuTTY.

SSHD will remain running in Termux so long as the app remains running, even in the background. You'll see it in the Android notification area if it's running (with the >_ icon). If the app closes completely, you will need to re-run sshd to start it again.