SSH Connection Timed Out? 7 Ways to Fix It

You try to connect to your Linux VPS, but instead of getting a login prompt, you see this error:

ssh: connect to host 203.0.113.10 port 22: Connection timed out

An SSH connection timed out error usually means your client could not establish a network connection to the server before the connection deadline. A blocked port, incorrect IP address, firewall rule, or unavailable server may be responsible.

Before changing your SSH keys or reinstalling anything, work through these seven checks.

What Does an SSH Connection Timeout Mean?

Different SSH errors point to different stages of a connection.

ErrorLikely meaning
Connection timed outThe connection attempt received no timely response.
Connection refusedThe destination rejected the connection, often because no service is listening on that port.
Permission denied (publickey)The SSH server was reached, but authentication failed.
Could not resolve hostnameThe client could not resolve the hostname.

If you receive an authentication error instead, follow this guide to fix SSH permission denied (publickey).

Throughout this tutorial, replace 203.0.113.10 with your actual server IP address and ubuntu with your SSH username. Commands that inspect the remote server require an existing administrator session or access through your hosting provider’s console.

1. Verify the Server IP Address and SSH Port

Open your hosting dashboard and confirm that the VPS is running. Compare its current public IP address with the address saved in your SSH client.

Try connecting directly to the IP address:

ssh -o ConnectTimeout=10 ubuntu@203.0.113.10

If you normally connect using a domain name, check its DNS records:

nslookup server.example.com

An outdated DNS record may point to a previous server. A stale IPv6 record can also cause problems; testing with ssh -4 can help isolate an IPv4 versus IPv6 connectivity issue.

Port 22 is the default for SSH, but some administrators configure a different port. For example:

ssh -p 2222 ubuntu@203.0.113.10

Use the port configured on your server rather than guessing.

SSH connection settings in Server Explorer
Configure your SSH host, port, and authentication details in Server Explorer

2. Test the SSH Port from Your Computer

On macOS or Linux, use Netcat to test whether the TCP port is reachable:

nc -vz -w 5 203.0.113.10 22

On Windows, open PowerShell and run:

Test-NetConnection -ComputerName 203.0.113.10 -Port 22

A successful TCP test confirms that the port is reachable at that moment, although SSH authentication may still fail. An unsuccessful test suggests a networking, firewall, or listening-service issue.

You can also inspect the SSH client’s debug output:

ssh -vvv -o ConnectTimeout=10 ubuntu@203.0.113.10

If the connection stalls before the TCP connection is established, investigate network access first. If it connects but stalls during the SSH handshake, inspect the SSH service and server load.

Ping alone is not a reliable SSH test because servers can block ICMP while allowing SSH traffic.

3. Check Your Hosting Provider’s Firewall

Cloud providers often apply network firewall rules independently of the operating system. Even if Linux allows incoming SSH connections, an upstream rule can block them.

In your hosting dashboard, verify that:

If your internet connection uses a dynamic public IP, an existing allowlist may no longer match your address.

Prefer allowing SSH from trusted IP addresses rather than opening it to every source just to troubleshoot a timeout.

4. Inspect the Linux Firewall

If the provider’s firewall is configured correctly, open the server through its web console or another authorized access method.

On Ubuntu systems using UFW, inspect the active rules:

sudo ufw status verbose

If UFW is active and SSH is blocked, add an appropriately restricted rule. Replace 198.51.100.25 with your own trusted public IP address:

sudo ufw allow from 198.51.100.25 to any port 22 proto tcp

For distributions using firewalld, inspect the active zones and their rules:

sudo firewall-cmd --get-active-zones
sudo firewall-cmd --list-all

The relevant zone may differ from the default zone. Systems using nftables directly can be inspected with sudo nft list ruleset.

Avoid disabling the entire firewall or flushing its rules.

Inspect your Linux server’s firewall rules after restoring SSH connectivity

5. Make Sure the SSH Server Is Running

A running VPS does not necessarily mean its SSH service is available.

On Ubuntu or Debian, check:

sudo systemctl status ssh

On many Fedora or RHEL-based systems, the service is named sshd:

sudo systemctl status sshd

Check which TCP ports are actually listening:

sudo ss -lntp

Look for the configured SSH port and confirm that it is listening on an address reachable through your intended network interface. On systems using systemd socket activation, also check the relevant SSH socket unit.

If the service has failed, inspect its logs:

sudo journalctl -u ssh -u sshd -n 50 --no-pager

Before restarting OpenSSH after a configuration change, validate its configuration:

sudo sshd -t

Correct any reported errors, then start or restart the appropriate service or socket as needed. Keep your provider console open and verify connectivity again.

Server Explorer

Bring your servers into focus.

A desktop app for macOS and Windows. Connect over SSH.

Download

6. Check Whether Fail2Ban Has Blocked Your IP

Fail2Ban can temporarily block an IP address after repeated failed login attempts. Depending on the firewall action used, subsequent SSH connections may time out.

If Fail2Ban is installed, check its active jails:

sudo fail2ban-client status

For a jail named sshd, inspect its status:

sudo fail2ban-client status sshd

If you confirm that your own trusted IP was incorrectly blocked, remove that specific ban:

sudo fail2ban-client set sshd unbanip 198.51.100.25

Use your actual IP address and the correct jail name. Investigate why authentication failed before attempting to reconnect. Disabling Fail2Ban entirely is unnecessary.

Fail2Ban banned IP addresses in Server Explorer
Review banned IP addresses and identify potential SSH access restrictions

7. Rule Out Local Network Problems and Server Overload

Corporate networks, VPNs, and public Wi-Fi connections sometimes restrict outbound SSH traffic. Test from another authorized network, such as a mobile hotspot, to determine whether the problem is specific to your current connection.

If the VPS console responds slowly or the SSH handshake stalls, check its resource usage:

uptime
free -h
df -h

Severe resource exhaustion can prevent the SSH service from responding normally. Inspect your provider’s network and resource metrics as well, especially if you cannot access the operating system console.

Increasing the SSH connection timeout may help with a genuinely slow network, but it will not fix a blocked port or an unreachable server.

Server Explorer

Bring your servers into focus.

A desktop app for macOS and Windows. Connect over SSH.

Download

Reconnect and Manage Your Server with Server Explorer

Once SSH connectivity is restored, Server Explorer provides a desktop workspace for managing remote Linux servers on macOS and Windows.

Save the correct hostname, SSH port, username, and authentication details in your connection settings. After connecting, use the integrated terminal to inspect SSH logs, review running services, and check system resources. The security tools can also help you review banned IP addresses when Fail2Ban is available.

Keeping connection settings organized is especially useful when maintaining several VPS instances with different SSH ports and credentials.

Server Explorer cannot bypass a blocked SSH connection. If the server is unreachable, you still need to restore network access through your hosting provider or another authorized management channel.

Final Thoughts

When an SSH connection times out, start by confirming the destination address and testing the TCP port. Next, inspect provider firewall rules, the Linux firewall, and the SSH service. Check IP bans and local network restrictions if the problem persists.

Restore connectivity without weakening your server’s security. Once access is working again, save the verified connection settings and use a consistent server management workflow to make future troubleshooting easier.

Server Explorer

Bring your servers into focus.

A desktop app for macOS and Windows. Connect over SSH.

Download

Leave a Reply

Your email address will not be published. Required fields are marked *