Common SSH Errors
Connection Refused
# Check if SSH is running
sudo systemctl status sshd
# Check listening port
ss -tlnp | grep ssh
# Check firewall
sudo ufw status
sudo iptables -L -n | grep 22Connection Timeout
- Verify the server IP is correct
- Check if the server is reachable:
ping server-ip - Ensure no firewall is blocking the port between you and the server
- Try from a different network to rule out local ISP issues
Permission Denied
# Verbose output to see what's happening
ssh -vvv user@server-ip
# Check key permissions (must be strict)
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
chmod 644 ~/.ssh/id_ed25519.pub
# On the server, check authorized_keys
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.sshHost Key Verification Failed
# This means the server key changed (reinstall or MITM)
# Remove old key
ssh-keygen -R server-ip
# Then reconnect and verify the new fingerprintBroken Pipe / Connection Reset
Add to your local ~/.ssh/config:
Host *
ServerAliveInterval 60
ServerAliveCountMax 3