How to Troubleshoot SSH Connection Issues
SSH client is a program for logging into a remote machine and for executing commands on a remote machine. It is intended to provide secure encrypted communications between two untrusted hosts over an insecure network.
Syntax: ssh [option] [user]@[server_address]
SSH into a Linux Server using a private key or password
Type the ssh command in your terminal (there are two ways to ssh – one using a password and the other one is using a private key )
ssh command using private key and Public DNS:
ssh -i private_key username@Public_DNS
ssh command using private key and Public IP address:
ssh -i private_key username@Public_IP
ssh command using password and public IP:
ssh username@password
Common error while SSH Errors occur while
Connection Timeout
This will occur when any user tries to establish a connection with the server but failed to get the response back within the time period.
Troubleshooting steps:
- Verify that the host IP address is correct
- Verify the firewall rules, check the inbound rules allowed by the security group.
- Verify the port number allowed for ssh
Connection Refused
This will occur when the server which is supposed to listen to the request, stops listening.
Troubleshooting steps:
- Verify that the host IP address is correct
- Verify the firewall rules, check the inbound rules allowed by the security group.
- Verify the port number allowed for ssh
- Verify that the service is running properly
Host-name Resolution
It happens when the reference to the SSH host can’t be mapped to a network address.
Troubleshooting steps:
- Verify that the host name is correct
- If not working properly then use IP instead of host-name
Access Denied
It happens when the ssh failed to connect due to wrong credentials.
Troubleshooting steps:
- Verify that the username or password is correct
Permission denied
It happens when the user is not authorized to logging into the server. It is mainly due to the sshd_config file that contains SSH server configuration.
Troubleshooting steps:
- Navigate to /etc/ssh/sshd_config
- Make sure PasswordAuthentication and PubkeyAuthentication ends with yes
- Make sure ChallengeResponseAuthentication and PermitRootLogin ends with no.
- Restart sshd_config
Please Login to comment...