SSH Basics
Learn how to run an SSH server on your Android device with Andronix, either from Termux (recommended) or from inside your Linux distro.
Docs for Andronix app 8.x (Classic)
SSH lets you access your device's shell remotely. This page covers two ways to run an SSH server: from Termux and from inside your Linux distro.
We recommend running the SSH server from Termux rather than from the Linux environment. An SSH server running in Termux gives you control of both your device and your Linux OS. Both methods are described below.
SSH via Termux
Follow this guide to learn how to run an SSH server from Termux. The tutorial is officially provided by one of the Termux developers.
SSH via Linux
Since Linux runs through PRoot, it cannot override Android's default connectivity configuration, so the SSH port number needs to be changed. Follow the steps below to run SSH from Linux:
Install OpenSSH
Install OpenSSH inside Linux. Pick the command for your distro from the list below:
Ubuntu 20
apt install openssh-server nano -yUbuntu 18
apt install openssh-server nano -yKali Linux
apt install openssh-server nano -yDebian
apt install openssh-server nano -yManjaro
pacman -S openssh nano --noconfirmArch
pacman -S openssh nano --noconfirmFedora
dnf install -y openssh-server nanoAlpine
apk add openssh-server nanoVoid
xbps-install openssh nanoModifications
Once the OpenSSH server is installed, you need to change a few settings so it's reachable over the network despite Android's limitations. Open the SSH config file:
nano /etc/ssh/sshd_config- Find the line
#Port 22and change it toPort 2222. - Find the line
#PermitRootLogin prohibit-passwordor#PermitRootLogin yesand change it toPermitRootLogin yes. If it already saysPermitRootLogin yes, you don't need to change anything. - When you're done, press
CTRL+X, typeYand pressEnterto save.
Connect
Run the following command:
ip aand copy the IP address listed under wlan. To connect to the SSH server, run:
ssh root@localhost -p 2222and log in with the password you set earlier.
Next steps
Want a graphical desktop instead? See VNC Basics.
"Cannot Link Executable" Error
Fix the "CANNOT LINK EXECUTABLE" libssl.so.3 error for wget, curl and other Termux utilities by switching mirrors, upgrading packages or reinstalling OpenSSL.
Termux Security
How Andronix mirrors Termux releases from F-Droid, and how to verify the APK yourself using MD5 checksums and VirusTotal reports.