When managing a Linux-based virtual server (VDS), getting a "Connection refused" error when trying to connect via PuTTY or terminal can be quite annoying. This error basically indicates that the server is actively rejecting your connection request or that there is no service listening on that port.
1. The SSH Service May Not Be Running
The most common reason for this error is that the SSH background service (sshd) has crashed or has never been started. Log in to the server using the access in your VDS control panel (VNC / Console) and check the status of the service:
systemctl status sshd
If the service is not running, to start it use the command: systemctl start sshd and to make it permanent type systemctl enable sshd.
2. Blocked by Firewall
The firewall on your server (UFW, iptables, firewalld) may be blocking connections coming to SSH port 22. For example, if you are using Ubuntu, you must allow the ssh port via UFW:
ufw allow ssh (or ufw allow 22/tcp)
ufw reload
In systems like CentOS/AlmaLinux, the port must be opened using Firewalld.
3. Using the Wrong Port Number
The default SSH port 22 may have been changed for security purposes. If the SSH port is set to 2222, for example, you must specifically state this when trying to connect: ssh user@ipaddress -p 2222. You can confirm the port number by reading the /etc/ssh/sshd_config file from your VDS console.
4. IP Address Banning (Possibility of Fail2Ban)
If there is brute-force protection like Fail2Ban on your server and you entered the wrong password consecutively, your IP address may be rejected by the server. To resolve it, you can try connecting from a different network (e.g., mobile internet) or clear the iptables ban list from the console.
If you are constantly experiencing such access problems, you can switch to highly available İyibirNet Turkey VDS services protected by hardware network firewalls!