SSH connection timed out: how to fix it from Android
An SSH "connection timed out" error means your phone sent a request to the server and nothing answered before the client gave up. The cause is almost always on the path between you and the server (wrong address, a firewall, a closed port or a network you cannot reach), not your password or key.
This page walks through the checks in the order that finds the problem quickest, with the exact commands to run on the server side.
Timed out, refused, or name not found?
Different errors point at different problems, so read the message first:
- Timed out: packets went out and nothing came back. Think firewall, wrong IP, server off, or a private network you are not on.
- Connection refused: the machine answered, but nothing is listening on that port. The SSH service is stopped or uses another port.
- Could not resolve host / DNS error: the name you typed (for example
myserver.localor a domain) could not be turned into an IP address. - Authentication failed: you reached SSH and it rejected the user name, password or key. The network is fine.
If you see a timeout, keep reading.
Step 1: Check the address and the network you are on
- Confirm the IP address on the server itself:
hostname -I
- Compare it with what you typed on the phone. Home routers often hand out a new address after a reboot.
- Look at where your phone is. An address such as
192.168.1.20or10.0.0.5is private. It only works when the phone is on the same Wi-Fi as the server, or connected through a VPN into that network. On mobile data it will time out every time.
Step 2: Make sure the SSH service is running
On the server (or with a keyboard and screen attached to it):
sudo systemctl status ssh
On some distributions the service is called sshd:
sudo systemctl status sshd
If it is inactive, start it and enable it at boot:
sudo systemctl enable --now ssh
Then check which port it listens on:
sudo ss -tlnp | grep ssh
You should see 0.0.0.0:22 or [::]:22. If the port is different, use that number in your connection.
Step 3: Open the port in the server firewall
On Ubuntu and Debian with UFW:
sudo ufw status
sudo ufw allow 22/tcp
On Fedora, Rocky or AlmaLinux with firewalld:
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --reload
A firewall that drops packets produces a timeout, not a refusal, which is why this step matters so much.
Step 4: Check the cloud firewall (VPS and cloud servers)
Cloud servers have a second firewall outside the machine. On AWS it is the security group, on Google Cloud it is a VPC firewall rule, and most VPS dashboards have a Firewall or Networking tab. Add an inbound rule that allows TCP port 22 from your address, or from anywhere if you rely on keys and have password login turned off.
Step 5: Test the port from the phone
Before trying SSH again, test whether the port answers at all:
- Ping the server. A reply proves the address is reachable, though some servers block ping on purpose, so no reply is not final.
- Check the port. A port checker tells you whether TCP port 22 accepts a connection.
If ping works and the port check fails, the problem is a firewall or the SSH service. If both fail, the problem is the address or the network.
Step 6: Reaching a home server from outside
If the server is at home and you are on mobile data, a timeout is expected unless you have set up a way in. The two common options:
- A mesh VPN such as Tailscale or WireGuard. The phone joins the same private network as the server, and you connect to the VPN address. Nothing on the router needs to change.
- Router port forwarding of an outside port to the server's port 22. This exposes SSH to the internet, so use key login only. Some internet providers place homes behind carrier-grade NAT, and then port forwarding cannot work at all; a mesh VPN still does.
Doing these checks with ShellPilot
ShellPilot is an SSH client, SFTP file manager and server manager for Android that needs no account. It puts the checks above on the same screen as your connections:
- Open Network tools and ping the server address.
- Use the port checker with port 22 (or your custom port). If it reports closed, go back to steps 2 to 4.
- When the port answers, open your saved connection and log in with your password or SSH key.
- Once connected, the server health view shows CPU, load, memory, disk and Docker containers over SSH, with nothing to install on the server.
Quick checklist
| Check | Command or place |
|---|---|
| Right IP | hostname -I on the server |
| SSH running | sudo systemctl status ssh |
| Listening port | sudo ss -tlnp |
| Server firewall | sudo ufw allow 22/tcp |
| Cloud firewall | security group or firewall tab, TCP 22 inbound |
| Same network | Wi-Fi with the server, or a VPN |
FAQ
Why does SSH work on my laptop but time out on my phone?
The laptop is usually on the home or office network, while the phone may be on mobile data. A private address like 192.168.x.x cannot be reached from mobile data. Join the same Wi-Fi or use a VPN.
Does changing the SSH port stop timeouts? Only if your network blocks port 22. Some public and work Wi-Fi networks do. If you move SSH to another port, open that port in every firewall and use it in your connection.
The connection times out after a few minutes of idle time. Is that the same problem?
No. That is an idle connection being dropped by a router or the server. Add ClientAliveInterval 60 to /etc/ssh/sshd_config on the server and restart SSH with sudo systemctl restart ssh.