Password-less RSA Authentication not working

Hello Friends,

I know this issue has been raised many times and hence I tried every resolution provided in the forum before I posted this issue again.

My Password-less RSA authentication was working fine for quite some time. Whenever the remote server password used to change I used to re-do the steps and things would have been fine. But today I tried the same steps but my authentication is not working and it is asking me the password again:

(1) Generated my local RSA Key:
cd $HOME
ssh-keygen -t rsa (No passphrase provided)
(2) Copied the id_rsa.pub file in the remote server home directory
scp .ssh/id_rsa.pub username@remoteserver:~
password: <Provided the password>
(3) Logged in to the remote server to add the content of the id_rsa.pub file to the authorized keys file
ssh username@remoteserver
password: <Provided the password>
cat id_rsa.pub >> .ssh/authorized_keys
chmod 700 .ssh
chmod 644 authorized_keys
exit
(4) In Local Server
cd $HOME
chmod 700 *
(5) Previously after Step 4 when I used to login to the remote server I was not asked for any password, but :frowning:
ssh username@remoteserver
Password: <Enter Password>

Please help me in this regard

Continuation....

I have attached the debug messages generated using the following commands:
File "Debug_Message_1_Verbose.txt" -- ssh -v username@remoteserver
File "Debug_Message_2_Verbose.txt" -- ssh -vv username@remoteserver

Friends,
Any idea on the above issue. Please do let me know if I should provide any more required information.

please check if the keys entry are available at both communicating servers

1 Like

I think you need to add the user to /etc/sudoers

as below

# Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL 
user                ALL=(ALL)       NOPASSWD: ALL 
1 Like

The problem just got resolved, I just found out that the following permission setting needs to be maintained:
remote server:
home directory - should have permission 755
.ssh directory - should have permission 700
files inside .ssh directory - should have permission 600
It seems if the directory/files are writtable by other users, SSHD simply disregards the rsa/dsa keys.
Thanks nchourasiya,kalyankalyan for your suggestions.