Connection Failed
Troubleshooting guide for SSH connection failures.
Common Errors
Connection Timeout
Symptoms: Connection times out without response
Possible Causes:
- Wrong server address or port
- Network unreachable
- Firewall blocking
- SSH service not running
Solutions:
- Verify server address and port
- Check network connectivity
- Test with ping or telnet
- Check firewall rules
- Verify SSH service status
Connection Refused
Symptoms: Connection immediately refused
Possible Causes:
- SSH service not running
- Wrong port number
- Service crashed
Solutions:
- Check SSH service status
- Verify port configuration
- Restart SSH service
- Check service logs
Host Key Verification Failed
Symptoms: Host key mismatch warning
Possible Causes:
- Server reinstalled
- IP address changed
- Security attack
Solutions:
- Confirm server change is legitimate
- Delete old host key
- Re-accept new fingerprint
Authentication Errors
Permission Denied
Symptoms: Authentication failed
Possible Causes:
- Wrong username
- Wrong password
- Wrong key file
- Server configuration
Solutions:
- Verify username
- Check password
- Check key file path
- Verify server allows this user
Key Authentication Failed
Symptoms: Key authentication rejected
Possible Causes:
- Wrong key file
- Wrong key format
- Missing passphrase
- Key not authorized
Solutions:
- Verify key file path
- Check key format
- Enter correct passphrase
- Add key to authorized_keys
Network Issues
Firewall Blocking
Symptoms: Cannot reach server
Solutions:
- Check local firewall
- Check server firewall
- Check network firewall
- Open SSH port (22)
Network Unreachable
Symptoms: Network error
Solutions:
- Check network connection
- Verify routing
- Check DNS resolution
- Use correct IP address
Diagnostic Steps
Step 1: Basic Connectivity
Test basic connectivity:
bash
ping server_address
telnet server_address 22Step 2: SSH Service
Check SSH service:
bash
# On server
systemctl status sshd
netstat -tlnp | grep 22Step 3: Logs
Check logs:
bash
# On client
cat ~/.ssh/known_hosts
# On server
tail -f /var/log/auth.logAdvanced Troubleshooting
Debug Mode
Run SSH in debug mode:
bash
ssh -vvv user@serverNetwork Tools
Use network tools:
bash
traceroute server_address
nmap -p 22 server_addressPrevention
- Keep connection info updated
- Use stable network
- Configure keep-alive
- Monitor connection status
Related Documentation
- SSH Connection - SSH features
- Connection Issues - FAQ