SSH public Private key authentication not working

For debuging the SSH key based authentication , we need to start a new SSHD process on target machine or destination machine:
/usr/sbin/sshd -p 2222 -d
Root permissions are required to execute the above command.
 
Once the SSHD Process was running, execute the ssh connection command with verbose mode from source machine as :
ssh -vvv dest-user@dest-machine.domain.com 
 
Check the destination machine terminal where the SSHD process was started, we can see lots of debug message.
Im my case I was able to get the below log message :
debug1: PAM: setting PAM_TTY to "ssh"
debug1: userauth-request for user appuat service ssh-connection method publickey
debug1: attempt 1 failures 0
debug1: test whether pkalg/pkblob are acceptable
debug1: temporarily_use_uid: 501/501 (e=0/0)
debug1: trying public key file /home/dest_user/.ssh/authorized_keys
debug1: fd 4 clearing O_NONBLOCK
Authentication refused: bad ownership or modes for file /home/dest_user/.ssh/authorized_keys

From the above debug message, It was very clear that ssh is still complaining about the file permissions.

Solution: 

Changed the permissions for below file and dirs on destination machine :
chmod g-w /home/dest-user
chmod 700 /home/dest-user/.ssh
chmod 600 /home/dest-user/.ssh/authorized_keys
 
[wordpress_social_login]
Please follow and like us:

Please add your comments here