SSH is one of the most common ways to access a Linux server, but when something goes wrong, it can feel confusing at first. Most SSH issues come down to a few simple root causes. In this guide, we’ll walk through the most common errors and show you exactly how to fix them using clear, practical steps.
Everything here is written for beginners, but with the same workflow real system administrators use every day.
1. Check if the Server Is Reachable
Before troubleshooting SSH itself, make sure your computer can reach the server at all. Many connection problems start with basic networking issues.
Use the ping command:
ping -c 4 SERVER_IP
Example output:
64 bytes from 10.10.1.20: icmp_seq=1 ttl=64 time=0.45 ms
If you see replies, the server is online and reachable.
If you see timeouts, the issue is networking or DNS—SSH hasn’t even entered the picture yet.
This is always the first step IT teams take when someone reports an SSH problem.
2. Make Sure SSH Is Running on the Server
If the SSH service isn’t running, no connection will succeed.
On the server’s console, check the service:
sudo systemctl status ssh
You want to see:
Active: active (running)
If you see “inactive” or “failed,” start it:
sudo systemctl start ssh
This simple check often fixes servers after a reboot or package update.
3. Fix “Permission denied” Errors
This error usually comes from two things: the wrong username, or SSH key permissions that are too open.
Try connecting first:
ssh username@SERVER_IP
You may see:
Permission denied (publickey)
If your key permissions are the problem, fix them with:
chmod 600 ~/.ssh/id_rsachmod 700 ~/.ssh
SSH requires private keys to be locked down. These permission settings are the simplest safe fix and are extremely common for new Linux users.
4. Fix “Host key verification failed”
This happens when a server has been rebuilt, upgraded, or replaced. SSH sees that the server’s fingerprint changed and blocks the connection for safety.
Remove the old key:
ssh-keygen -R SERVER_IP
You should see:
Host SERVER_IP found. Removed.
On the next connection attempt, SSH will ask whether to trust the new fingerprint.
5. Fix Timeout or Hanging SSH Connections
If SSH hangs or never connects, the port may be blocked by a firewall. Instead of introducing advanced networking tools, beginners can use SSH’s built-in verbose mode:
ssh -v username@SERVER_IP
Verbose mode shows each connection step and reveals whether SSH reaches the server or is blocked somewhere along the path.
This provides helpful clues before escalating to deeper networking troubleshooting.
Common Beginner Mistakes
These issues show up often when someone is just getting started with Linux servers:
1. Using the wrong IP address
Always verify the server’s IP from your cloud dashboard or documentation.
2. Using the wrong username
Many cloud images require specific usernames like ubuntu, root, or debian.
3. Not fixing key permissions
SSH refuses to use keys readable by other users. Use the permissions from Step 3.
A Practical Troubleshooting Workflow
Imagine you’re trying to access a development VM and SSH fails. Here’s the exact sequence that solves most issues:
-
Ping the server.
-
Check that SSH is running.
-
Fix your username or key permissions.
-
Remove old host keys if the VM was rebuilt.
-
Use verbose output (
-v) to confirm whether port 22 is reachable.
This calm, methodical process prevents confusion and avoids unnecessary guesswork.
Optional Next Step
Whenever something feels unclear, use verbose mode:
ssh -v username@SERVER_IP
This gives you more insight without changing any system configuration.
Conclusion
SSH errors may seem intimidating at first, but they follow simple patterns. With a few direct checks—reachability, service status, key permissions, host keys, and verbose output—you can solve most problems quickly and confidently. These are the same skills Linux professionals use, and they will become second nature as you practice.