Connection issues
This page covers the most common SSH connection failures and how to fix them. The headings and quotes are what ZestSSH shows.
What you see when a connection fails
Section titled “What you see when a connection fails”ZestSSH says what went wrong in its own words, with a tip on what to try:
- On a computer, a dialog shows a title (such as Connection refused), what happened, a tip, and Technical details. The buttons are Retry and Close.
- On a phone, the session’s screen shows the same, with Retry, Edit (opens the host’s editor) and Go back.
Technical details shows a report of the failure: the error as the SSH library or the system gave it, the connection’s log, and the app’s last log lines. Copy details copies it. Names of hosts, people and folders, addresses, keys and passwords are taken out before it is copied, so it is safe to paste into a support request. See Reading connection logs for how to read it.
To try a host without opening a session, use Test reachability or Test full connection in the host’s editor. The full test says what a failed session would say, with Copy details. From 4.3 the tests go the way a session goes: through the host’s Connect via jump host (or a network’s route, with Test as this network), with a key held by an SSH agent, and as the Default username of Settings where no key is chosen. Before, a host reached only through a jump host failed its test.
First, try Compatibility mode
Section titled “First, try Compatibility mode”If the server answers but the connection still fails before you are signed in, and above all if another SSH client gets through to the same host, turn on Compatibility mode for that host first and try again: on a computer, the host editor’s Auth tab; on a phone, under Advanced options.
Some old servers, and some firewalls that inspect SSH, answer only a client that also offers older algorithms. Another client may offer them because its settings add them (an OpenSSH config file can), which is why it gets through where ZestSSH does not. With Compatibility mode on, ZestSSH offers them too, after its modern ones, so a server that takes the modern ones still gets them. The older algorithms are weaker, so keep it on only for the hosts that need it.
It does not help when the server cannot be reached at all (Connection refused, Host not found, Connection timed out) or refuses your password; the sections below cover those.
Connection refused
Section titled “Connection refused”ZestSSH says: “Connection refused”: “web-01 is not accepting connections on port 22.”
Cause: the server received the connection attempt and turned it away. The server is reachable, but nothing is listening on that port.
In the connection log, the failure comes right after Resolving <host>..., before tcp_connect: Connected.
Solutions:
-
Check that the SSH server is running on the server:
Terminal window sudo systemctl status sshd# orsudo systemctl status sshIf it is not running, start it:
sudo systemctl start sshd -
Check the port. If the server runs SSH on another port (for example 2222), make sure the port box beside the host’s Address says so.
-
Check the server’s firewall. Its own firewall (iptables, ufw, firewalld) may be blocking the port.
Terminal window sudo ufw status # Ubuntu/Debiansudo firewall-cmd --list-all # RHEL/CentOS -
Docker or container port clashes: if the server runs Docker, a container may have taken the port.
Host unreachable, not found, or timed out
Section titled “Host unreachable, not found, or timed out”ZestSSH says one of:
- “Connection timed out”: “Could not reach web-01 within the timeout period.”
- “Host not found”: “Could not resolve “web-01.example.com”. DNS lookup failed.”
- “Network error”: “A network error occurred while trying to reach web-01.”
Cause: there is no network path between your device and the server, or the name does not resolve.
In the connection log, these never reach tcp_connect: Connected. If you do see tcp_connect: Connected, the network is fine and the problem is later.
Solutions:
- Check your internet connection. Switch between Wi-Fi and cellular to rule out the local network.
- Check the address. DNS may have failed or returned an old address. Try the IP address directly.
- Check that the server is up, from another device or a web-based ping service.
- Router or NAT port forwarding. If the server is behind a NAT router, check that its port forwarding rule still points to the right internal address.
- Networks that block port 22. Some networks (corporate, hotel, airport) block outgoing port 22. Running SSH on port 443 as well often helps, since that port is rarely blocked.
- VPN. A VPN may not route traffic to the server’s network. Try with the VPN on, then off.
- Wait longer. On a computer, Connection timeout in Settings > Terminal and SSH sets how long ZestSSH waits for the server, from 5 to 120 seconds (15 seconds unless you change it).
If the server is powered off and set up for Wake-on-LAN, wake it first: see Wake-on-LAN.
Key authentication failed
Section titled “Key authentication failed”ZestSSH says: “Key authentication failed”: “The server rejected your SSH key.” When the server takes other ways of signing in too, it adds them, for example “The server also takes: a password.”
In the connection log, this shows ssh_auth: Authenticating as <user> (publickey), then debug: SSHClient._authWithPublicKey and debug: SSHClient._handleUserauthFailure, ending in error: Auth failed - SSHAuthFailError(All authentication methods failed).
Cause: the server did not accept the key you offered for that user.
Solutions:
- Check the key. In the host’s editor, check that Key has the right SSH key and user name.
- Check
authorized_keyson the server. The public key must be in~/.ssh/authorized_keysfor the user you sign in as:Compare it with the public key in ZestSSH: on a computer, open Keys, choose the key, and use Export public key; on a phone, open Manage, then Keys, long-press the key, tap Key actions, then Share public key. ZestSSH can also put the key on the server for you: see Install a key on hosts.Terminal window cat ~/.ssh/authorized_keys - File permissions. OpenSSH is strict about them:
The home folder must not be writable by others.
Terminal window chmod 700 ~/.sshchmod 600 ~/.ssh/authorized_keys - Wrong user name. The user name of the host’s key must match the account on the server.
rootandadminare different users. - Server settings. The server may have
PubkeyAuthentication noinsshd_config, or limit who can sign in withAllowUsersorAllowGroups.
If the key is an RSA key and the server is old, ZestSSH may say the server takes an RSA key only with SHA-1 signatures. Turn on Compatibility mode for that host as the message says, or use an Ed25519 key.
Incorrect password, or no way to sign in
Section titled “Incorrect password, or no way to sign in”ZestSSH says one of:
- “Incorrect password”: “The password was rejected by web-01.”
- “Authentication failed”: “The server takes only this for a sign-in: a key. This sign-in has none of it, so nothing was sent to the server.”
A saved password goes only to a server that takes passwords. When the server takes only keys, ZestSSH sends nothing and says so.
Solutions:
- Password sign-in may be turned off on the server (
PasswordAuthentication noinsshd_config). Use a key instead. - The account may be locked after too many failed sign-ins, by PAM or fail2ban.
- Wrong password. Passwords are case-sensitive. Check for spaces at the start or end.
- Servers that ask questions. Some servers ask for the password as a question of their own (keyboard-interactive), and may ask for more, such as a one-time code. ZestSSH answers a real password prompt with the saved password once, and shows you any other question to answer.
Sign-in timed out
Section titled “Sign-in timed out”ZestSSH says: “Sign-in timed out”: “web-01 did not finish the sign-in in time.” The tip: “The connection was accepted, and then nothing more came. Check that the port is the one the SSH server listens on. A very busy server can also take this long.”
ZestSSH gives a server 15 seconds to answer during sign-in, and 120 seconds once the server has started asking questions (it may be waiting for a push approval). The clock stops while you answer a question or read a host key.
When the server’s login message gives you an https:// link to open (Tailscale SSH in check mode does this), ZestSSH shows it in a Finish signing in dialog and gives the server up to 5 minutes to let you in. The clock keeps running while that dialog is open. If you do not finish on the web page in time, the dialog closes and you get “Sign-in timed out”. Connect again to start a new sign-in. See Sign-in links.
The extra time is for a session (an SFTP only host too), Run on hosts, Install on hosts…, the first connection of Replace on all n hosts… (the one with the old login), or a workflow you start yourself. A server that waits on such a link times out when it is:
- a jump host on the way to the server (its message is not shown, and the error names that jump host)
- tested with Test full connection in the host editor (“Auth timed out after 8s”)
- a serial console server you open as a serial session
- reached by Server Monitor, or by an automation that runs by itself (a scheduled task, a run started by another app)
- reached by the connection that proves a new key in Replace on all n hosts…
The host stopped answering during the key exchange
Section titled “The host stopped answering during the key exchange”ZestSSH says: “The host sent its SSH version and then stopped answering: its part of the key exchange never came, so no connection was made and nothing of a sign-in was sent.” (On Windows, macOS and Linux from 3.2.6; phones show “Sign-in timed out” until their next update.)
Cause: the server, or something in front of it, answered with an SSH version and then sent nothing of the key exchange for 10 seconds. A firewall that inspects SSH does this when it does not take what ZestSSH offers: a SonicWall with DPI-SSH turned on, for example, which answers as SSH-2.0-libssh_0.9.0. In the connection log, the server’s version is the last thing that came.
What to do:
- Turn on Compatibility mode for that host, if it is off: on a computer, the host editor’s Auth tab; on a phone, under Advanced options. It adds older algorithms after the ones ZestSSH offers now, and with it such a firewall may let the connection through. The algorithms that are agreed on are still the first ones both sides have.
- Otherwise, ask whoever runs the firewall to let SSH to this host through without inspection (on a SonicWall, an exclusion from DPI-SSH for the host).
Host key changed
Section titled “Host key changed”ZestSSH shows: Host key changed: “The key presented by web-01 is different from the one you trusted before.” It shows the key it expected and the one it received, a command to check the key on the server, Trust new key and Cancel and disconnect.
In the connection log, the line after ssh_hostkey: Verifying host key is ssh_hostkey: Host key REJECTED when you do not trust the new key.
Cause: the server’s host key is different from the one ZestSSH saved. This happens when:
- The server was reinstalled or its SSH host keys were made anew.
- Another machine now answers at that address (for example, after a cloud provider reused an IP address).
- Someone is intercepting your connection.
What to do:
- If you know the server was reinstalled or changed, check the fingerprint with the command shown, then choose Trust new key. The old key is replaced.
- If you are not sure, choose Cancel and disconnect. Check the server’s host key fingerprint another way (the server’s console, your hosting provider’s dashboard, a colleague who can reach the machine).
- To remove a saved key, open the list of trusted keys:
- On a computer: Settings > Security and privacy, under Host keys, Trusted host keys, then Manage. Clear all trusted keys removes every one.
- On a phone: Settings > Security and privacy > Trusted host keys, then Remove host key beside the entry.
For a host in a team vault whose key the team pinned, a different key shows Not the key your team pinned, and only someone who may edit the vault can replace the team’s key. See Host key verification.
Algorithm mismatch
Section titled “Algorithm mismatch”ZestSSH says: “Algorithm mismatch”: “Could not agree on a key exchange algorithm with web-01.” The word in the middle is key exchange, cipher, MAC or host key, for the part where the two sides found nothing in common.
Cause: the server and ZestSSH have no algorithm of that kind in common. This usually means an old or unusually locked-down server.
In the connection log, this reaches ssh_kex: Offering KEX: ... but the handshake stops there.
What to do:
- If Compatibility mode would help, the tip says to turn it on and where: on a computer, the host editor’s Auth tab; on a phone, under Advanced options. It then also offers CBC ciphers, hmac-md5, and key exchanges and RSA signatures with SHA-1. Modern algorithms stay first, so a modern server is not affected. The old algorithms are weaker, so use it only for servers you cannot update.
- If it would not, ZestSSH says “The server offers only …, and ZestSSH has none of them.” and that no setting changes this. The server has to offer something newer: update its SSH server or add a modern algorithm to its settings. Check what it offers with
ssh -Q kex(andssh -Q cipher,ssh -Q mac) on the server. - See Supported key exchange algorithms and Supported ciphers for what ZestSSH has.
The host ends the connection
Section titled “The host ends the connection”When a server ends a connection and says why, ZestSSH shows its words: “The host ended the connection. Its reason: Too many authentication failures”. After such an answer, ZestSSH does not reconnect by itself, so it does not add more failed tries to the server’s log.
“Too many authentication failures” means the server’s MaxAuthTries limit (6 unless set otherwise) was reached. ZestSSH asks the server whether it takes a key before signing with it, and uses the SSH key the host is set to sign in with. If you still hit the limit:
- Check the server’s
MaxAuthTriesinsshd_config, and its log (/var/log/auth.logorjournalctl -u sshd) for what was refused. - Wait for fail2ban or a similar tool to lift a ban, if one was set.
Signed in, but no terminal
Section titled “Signed in, but no terminal”ZestSSH says so when the server signs you in and then opens no shell, for example: “The host signed you in, but gave no terminal. The account or the key may be limited to running commands or to forwarding (a key marked no-pty, for example).” Check the account’s shell and any command=, restrict or no-pty options on your key in authorized_keys.
A server that gives files only ends the session the moment it opens: OpenSSH says “This service allows sftp connections only.” ZestSSH then shows This host gives files only, with Open its files and Make this host SFTP only; the same is offered when a terminal closes the moment it opened, before anything was typed. See SFTP only.
Firewall and NAT issues
Section titled “Firewall and NAT issues”Symptoms: connections time out, or drop now and then.
- Corporate firewalls often block port 22. Run SSH on port 443 as well (rarely blocked), or use your server’s web console to change the SSH port.
- NAT timeouts: NAT gateways may close a connection that is idle for a while. ZestSSH sends keep-alives every 30 seconds unless you change it:
- App-wide: on a computer, SSH keepalive interval in Settings > Terminal and SSH; on a phone, Keepalive interval in Settings > Terminal and SSH.
- For one host: Keepalive interval in the host’s editor (on a computer, the Network tab): 15 seconds to 5 minutes, a custom interval, or Use global default.
- Double NAT: if both your device and the server are behind NAT, you may need a jump host with a public address. See Setting up jump hosts.
Connection drops during use
Section titled “Connection drops during use”Symptoms: the connection works at first but drops after minutes or hours.
When a session drops, it stays in its tab and says why, for example “web-01 stopped answering, and the connection was given up.” That one means three keep-alives in a row got no answer and nothing else came from the server: the network on the way dropped, or the server froze or lost power. With Auto reconnect on (it is unless you turn it off; on a computer it is in Settings > Terminal and SSH), ZestSSH then reconnects by itself (“Reconnecting…”, with the attempt number); otherwise, or when that fails, choose Reconnect.
A session the server ends itself (a time limit, someone ending it there) stays on screen with “Session ended” and what the server printed last. It does not reconnect by itself.
Solutions:
- Keep keep-alives on (see above). A shorter interval helps on networks that drop idle connections quickly.
- Use tmux or screen on the server, so your programs keep running across drops. See the tmux Workflow guide.
- On phones, check battery and background settings. See Android background connections and iOS sessions disconnecting.
- Through a jump host, a drop of the jump host’s connection ends the session behind it, and ZestSSH says which jump host it was.
Still stuck
Section titled “Still stuck”If the server answers and you have not tried it yet, turn on Compatibility mode for the host and try again (see First, try Compatibility mode). Otherwise, copy the failure’s details with Copy details and send them with a bug report (Report a bug in Get help), or read them yourself with Reading connection logs. See also Common errors.