SSH is an essential tool for remote server management. However, the “Connection refused” error can prevent access. Let UPNET help you understand the causes and how to fix this issue effectively.
What Is SSH “Connection Refused”?
When attempting to SSH into your server (VPS or Dedicated Server) and you receive a message like:
ssh: connect to host [IP] port 22: Connection refused
It means your request has been denied. This error can come from either the server side or your local device.
Suggested image: Screenshot of a terminal showing the “Connection refused” error.
Common Causes of SSH Connection Refused
Reason Description SSH service is not running The sshd service is inactive on the server Port 22 is blocked by firewall Firewall is preventing the connection Incorrect SSH config or IP Wrong IP or misconfigured settings Server is offline or overloaded VPS is down or too busy to respond SSH access is restricted Only specific IPs are allowed
How to Fix SSH Connection Refused
1. Check if SSH Service Is Running
Log in to your server and ensure that the SSH service is active. If it’s inactive or has failed, start the SSH service.
Suggested image: Terminal showing
systemctl status ssh
andsystemctl start ssh
.
2. Open Port 22 on the Firewall
If your server uses UFW, allow port 22.
If you use firewalld, permanently add port 22 to the allowed list and reload the firewall.Suggested image: Screenshot showing port 22 open in the firewall interface.
3. Verify IP Address and SSH Configuration
Make sure you are using the correct and updated IP address.
Check the SSH configuration file and confirm that key directives like the following are set correctly:
Port 22
PermitRootLogin yes
4. Check Server Status
If the VPS is offline, restart it from UPNET’s management panel or request support via:
Website: https://upnet.com.vn
Email: support@upnet.vn
Hotline: +84827591668
How to Test Port 22 from Your Local Machine
Use tools like telnet or nc to test port 22:
If it shows “Connection refused” → the port is blocked
If it connects → SSH is working
How to Prevent SSH Connection Refused in the Future
Always enable SSH to start on boot
Keep the sshd_config file standard and secure
Regularly check SSH logs at
/var/log/auth.log
Use a static IP or DNS to avoid IP changes
Conclusion
SSH “Connection Refused” can interrupt server administration, but following the steps above allows you to fix it effectively. If you want a secure, stable VPS with professional support, contact UPNET today.
Check out our Cloud VPS services at:
https://upnet.com.vn/cloud-vps

NEWS
TIN TỨC
