iDatam

IN AFRICA

ALBANIA

ARGENTINA

AUSTRALIA

AUSTRIA

AZERBAIJAN

B AND H

BANGLADESH

BELGIUM

BRAZIL

BULGARIA

CANADA

CHILE

CHINA

COLOMBIA

COSTA RICA

CROATIA

CYPRUS

CZECH

DENMARK

ECUADOR

EGYPT

EL SALVADOR

ESTONIA

FINLAND

FOR BACKUP AND STORAGE

FOR DATABASE

FOR EMAIL

FOR MEDIA STREAMING

FRANCE

GEORGIA

GERMANY

GREECE

GUATEMALA

HUNGARY

ICELAND

IN ASIA

IN AUSTRALIA

IN EUROPE

IN NORTH AMERICA

IN SOUTH AMERICA

INDIA

INDONESIA

IRELAND

ISRAEL

ITALY

JAPAN

KAZAKHSTAN

KENYA

KOSOVO

LATVIA

LIBYA

LITHUANIA

LUXEMBOURG

MALAYSIA

MALTA

MEXICO

MOLDOVA

MONTENEGRO

MOROCCO

NETHERLANDS

NEW ZEALAND

NIGERIA

NORWAY

PAKISTAN

PANAMA

PARAGUAY

PERU

PHILIPPINES

POLAND

PORTUGAL

QATAR

ROMANIA

RUSSIA

SAUDI ARABIA

SERBIA

SINGAPORE

SLOVAKIA

SLOVENIA

SOUTH AFRICA

SOUTH KOREA

SPAIN

SWEDEN

SWITZERLAND

TAIWAN

THAILAND

TUNISIA

TURKEY

UK

UKRAINE

UNITED ARAB EMIRATES

URUGUAY

USA

UZBEKISTAN

VIETNAM

How to Fix the 'SSH: Connection Refused' Error

Secure Shell (SSH) is the industry standard for managing remote servers. However, encountering the message “ssh: connect to host [IP] port 22: Connection refused” can bring your workflow to a halt. Learn to diagnose and fix it here.

SSH Connection Error Fix

This error indicates that while the network path to the server exists, the server itself rejected the connection request. This guide provides a comprehensive approach to diagnosing and fixing this issue on your iDatam server, whether you are using a VPS, Dedicated Server, or a GPU-accelerated instance.

What You'll Learn

Common Causes of SSH Rejection

Why Connections Fail

Before running commands, it's important to understand why the server might be saying "No":

  • The SSH Service is Down: The background daemon (sshd) responsible for connections is not running.

  • Wrong Port: You are targeting Port 22, but the server has been configured to listen on a custom port.

  • Firewall Interference: UFW, iptables, or the iDatam Cloud Firewall is blocking the specific port.

  • Resource Exhaustion: The server is out of RAM or CPU, preventing it from spawning a new SSH process.

1. Check if the SSH Service is Active

If you cannot SSH in, use the iDatam Web Console in your dashboard to access the command line directly.

Check status:

Firewall Configuration

bash

# Check status
sudo systemctl status ssh

# Note: Use 'sshd' for CentOS/RHEL
sudo systemctl status sshd
                                    

2. Verify Port and IP Configuration

A "Connection Refused" error often happens because you're knocking on the wrong door.

  • Confirm IP: Ensure you aren't accidentally trying to connect to a different instance.

Check Listening Ports:

bash

sudo netstat -tulpn | grep ssh
                                

If your server uses a custom port (e.g., 2222), connect using the -p flag:

bash

ssh -p 2222 user@your-server-ip
                                

3. Ensure SSH Server is Installed

Check if the binary exists:

bash

which sshd
                                

If missing, install the server package:

  • Ubuntu/Debian: sudo apt update && sudo apt install openssh-server

  • CentOS/RHEL: sudo yum install openssh-server

4. Configure Your Firewalls

On the Server (UFW):

bash

sudo ufw allow ssh
# OR if using a custom port
sudo ufw allow 2222/tcp
sudo ufw reload
                                

iDatam Cloud Firewall: Check your iDatam control panel under "Security Groups". Ensure inbound TCP traffic is allowed on your SSH port for your specific IP or 0.0.0.0/0.

5. Audit the SSH Configuration File

Open the configuration:

bash

sudo nano /etc/ssh/sshd_config
                                

Verify these lines:

  • Port 22 (Matches your connection attempt)

  • ListenAddress 0.0.0.0 (Listens on all interfaces)

  • PermitRootLogin (Set to yes/prohibit-password depending on your needs)

Test and Restart:

bash

sudo sshd -t && sudo systemctl restart ssh
                                

6. Test Network Reachability

Diagnostic Commands:

bash

# Check if server is online
ping your-server-ip

# Check if the port is "listening" externally
telnet your-server-ip 22
                                

🛠 iDatam Support Pro-Tips

  • Use the VNC Console: If locked out by a firewall, use the web-based VNC console in the iDatam portal for emergency access.

  • IP Whitelisting: For GPU or Dedicated environments, whitelist only your specific Home/Office IP for enhanced security.

  • Check Logs: Run tail -f /var/log/auth.log (Ubuntu) to see real-time rejection reasons.

Conclusion

The "SSH: Connection Refused" error is usually a simple configuration or service issue. By verifying the service status, checking port settings, and auditing your firewalls, you can quickly regain control of your server. If problems persist, iDatam's support experts are available 24/7 to assist.

Infrastructure Quick Comparison

Feature Dedicated Servers GPU Cloud
Best For Heavy Databases, ERP AI/ML, Rendering
SSH Access Full Root Access Full Root Access
Scalability High Instant

Discover iDatam Dedicated Server Locations

iDatam servers are available around the world, providing diverse options for hosting websites. Each region offers unique advantages, making it easier to choose a location that best suits your specific hosting needs.

Up