Fix PuTTY "Connection Refused" Error

Complete troubleshooting guide for resolving connection refused and network errors in PuTTY

Common Error Messages

  • • "Network error: Connection refused"
  • • "Network error: Connection timed out"
  • • "Unable to connect to [hostname]"
  • • "Fatal error: Network error: Connection refused"

Understanding the Error

A "Connection Refused" error occurs when PuTTY successfully reaches the server's IP address but cannot establish an SSH connection. This is different from a timeout error, which means the server is unreachable.

The error indicates that:

  • The server is online and reachable
  • Network connectivity exists
  • But the SSH service isn't accepting connections on the specified port

Common Causes

1. SSH Service Not Running

The most common cause - the SSH daemon (sshd) isn't running on the server.

2. Wrong Port Number

You're trying to connect to port 22, but SSH is configured to use a different port.

3. Firewall Blocking Connection

A firewall on the server or network is blocking SSH connections.

4. SSH Disabled or Restricted

SSH is configured to only accept connections from specific IPs or networks.

Step-by-Step Solutions

Step 1: Verify the Hostname and Port

Double-check your connection settings in PuTTY:

  • Hostname or IP address is correct
  • Port number is correct (usually 22)
  • Connection type is set to "SSH"

Step 2: Check if SSH Service is Running

If you have console access to the server, check SSH status:

# Ubuntu/Debian:

sudo systemctl status ssh

# CentOS/RHEL:

sudo systemctl status sshd

If it's not running, start it:

sudo systemctl start ssh

Step 3: Check the SSH Port

Verify which port SSH is listening on:

sudo netstat -tulpn | grep sshd

Or check the SSH config file:

grep "Port" /etc/ssh/sshd_config

Step 4: Check Firewall Rules

Verify firewall isn't blocking SSH:

# UFW (Ubuntu):

sudo ufw status

# Firewalld (CentOS):

sudo firewall-cmd --list-all

If SSH is blocked, allow it:

sudo ufw allow 22/tcp

Step 5: Check Cloud/Network Firewall

If using cloud servers (AWS, Azure, Google Cloud):

  • Check security groups (AWS)
  • Verify network security groups (Azure)
  • Check firewall rules (Google Cloud)
  • Ensure SSH port (22) is allowed from your IP

Advanced Troubleshooting

Test Connection with Telnet

From your local machine, test if the port is accessible:

telnet [server-ip] 22

If it connects, you'll see SSH version info. If not, the port is blocked.

Check SSH Logs

View SSH daemon logs for clues:

sudo tail -f /var/log/auth.log

Frequently Asked Questions

Why does PuTTY say 'Connection Refused'?

This error means PuTTY successfully reached the server but the SSH service isn't running or is not accepting connections on the specified port.

How do I check if SSH is running on the server?

If you have console access to the server, run: sudo systemctl status ssh (Ubuntu/Debian) or sudo systemctl status sshd (CentOS/RHEL).

What port does SSH use?

SSH typically uses port 22 by default. Some servers may be configured to use a different port for security reasons.

Still Having Issues?

If you've tried all these steps and still can't connect, check our other troubleshooting guides.

;