Linux Tricks and Techniques

For Linux Experts

Use the website for easy leaning of Linux

Friday, 3 June 2016

SSH Login Failure in Linux


SSH Login Failed




Some time we may get an ssh login issue in the Linux server which becomes very critical sometimes if it is for main production server of the organisation. If we are able to ping the server from command line that means its not a network issue we need to do it from OS level. If a root user is not able to login to server from putty then we need to login to console to access the server. if still not able to take the console then reboot the server and take it in to single user mode and follow the below steps:




1.SSH login failed 

Issue details: 1.Not able to login from putty
                      2. But able to ping the server.


Solution:

1. Take the server in to single user mode by editing kernal line press e

2.Write s in the end of line just after the rhgb quiet and press enter key that will bring in grub bootloader screen

3.Press b will take you to single user mode.

4. Reset the root password and try login and if not able to login then go to

# vi /etc/pam.d/system-auth and comment the pam_tally2.so lines.

# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
#skip-authentication
#auth        required      pam_tally2.so    deny=3   onerr=fail  unlock_time=1800
auth        required      pam_env.so
auth        sufficient    pam_unix.so nullok try_first_pass
auth        requisite     pam_succeed_if.so uid >= 500 quiet
auth        required      pam_deny.so

#account     required      pam_tally2.so
account     required      pam_unix.so
account     sufficient    pam_succeed_if.so uid < 500 quiet
account     required      pam_permit.so

password    requisite     pam_cracklib.so try_first_pass retry=3
password    sufficient    pam_unix.so md5 shadow nullok try_first_pass use_authtok
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so



5. Check for the ssh service

Also check the /var/empty/sshd permission or compare with other server as it should be 711.

#restart  the ssh service


#reboot the server

No comments:
Write comments