SSH from an Android phone to a Linux server
To SSH from an Android phone to a Linux server, make sure the OpenSSH server is running on the Linux machine, then connect from an SSH app on the phone with the server's address, port 22 and your Linux user name. Use a password the first time and move to an SSH key once it works.
This guide covers Ubuntu, Debian and Fedora style servers, and the habits that make a phone terminal pleasant to use.
What you need
- A Linux machine you can log in to: a desktop, a home server, a Raspberry Pi or a VPS.
- Its IP address or domain name.
- A user account on it with a password, or an SSH key.
- An SSH client app on the phone.
Step 1: Install and start the SSH server on Linux
Most VPS images already run SSH. On a desktop install you may need to add it.
Ubuntu and Debian:
sudo apt update
sudo apt install openssh-server
sudo systemctl enable --now ssh
Fedora, Rocky and AlmaLinux:
sudo dnf install openssh-server
sudo systemctl enable --now sshd
Check that it is listening:
sudo ss -tlnp | grep ssh
Step 2: Find the address to connect to
On a machine in your home or office:
hostname -I
For a VPS, use the public IP shown in your provider's dashboard, or a domain name that points to it.
Remember that private addresses (192.168.x.x, 10.x.x.x, 172.16.x.x to 172.31.x.x) only work when the phone is on the same network or connected through a VPN.
Step 3: Allow SSH through the firewall
sudo ufw allow 22/tcp
On firewalld systems:
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --reload
A cloud server also needs port 22 open in its provider firewall or security group.
Step 4: Connect from the phone
In your SSH app create a connection with:
| Field | Example |
|---|---|
| Host | 192.168.1.30 or server.example.com |
| Port | 22 |
| User | deploy |
| Auth | password, or a private key |
The first time you connect, the app shows the server's host key fingerprint. To confirm it is really your server, run this on the server and compare the result:
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
Accept the key and you are in.
Step 5: Move to key login
Keys are safer than passwords and you will not type a password on a phone keyboard again.
- Generate an Ed25519 key in your SSH app.
- Copy the public key.
- On the server, add it to your user's authorized keys:
mkdir -p ~/.ssh && chmod 700 ~/.ssh
echo "PASTE-PUBLIC-KEY-HERE" >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
- Attach the key to the connection on the phone and reconnect.
When it works, consider turning off password login in /etc/ssh/sshd_config:
PasswordAuthentication no
Then restart SSH with sudo systemctl restart ssh (or sshd). Keep your current session open while you test a new one, so a mistake cannot lock you out.
Step 6: Make the phone terminal comfortable
A few habits help a lot on a small screen:
- Use
tmuxso a dropped mobile connection does not kill your work. Start it withtmux new -s mainand reattach later withtmux attach -t main. - Turn the phone sideways for wide output such as
htopor log files. - Use
lessfor long files instead of scrolling the terminal. - Save repeated commands as snippets so you tap instead of type.
Doing it with ShellPilot
ShellPilot is an SSH client, SFTP file manager and server manager for Android. It needs no account and no sign-up, and your connections and keys stay on your phone.
- Connect with a password or an Ed25519 or RSA SSH key, save connection profiles and swipe between open sessions.
- Enter, Esc, Tab, Ctrl and arrow keys sit right above the keyboard, so
Ctrl+C,tmuxshortcuts and editors likenanoandvimwork. - Command history, search and pinch-to-zoom in the terminal.
- Known-host verification warns you if a server's key ever changes.
- Encrypted on-device key storage and an optional biometric lock.
- Over 50 ready-made commands for Docker, Nginx, system monitoring and more, with variables you fill in.
When it does not connect
- Timed out: wrong address, firewall, or a private IP while you are on mobile data.
- Connection refused: SSH is not running, or it listens on another port.
- Authentication failed: wrong user name or password, or the key is not in
authorized_keys. Check permissions:~/.sshmust be700andauthorized_keysmust be600. - Host key changed: if you rebuilt the server this is expected. If you did not, stop and find out why before accepting.
FAQ
Is SSH from a phone secure? Yes, the connection is encrypted the same way as from a laptop. The weak points are the account password and the phone itself, so use key login and a screen lock.
Can I SSH into a Windows PC from Android? Yes. Windows 10 and 11 include an optional OpenSSH Server feature. Turn it on in Settings under Optional features, start the sshd service, then connect with your Windows user name.
Do I need root on the phone? No. An SSH client is an ordinary app and needs no root or special setup on Android.