why password less ssh not working? why password less ssh not working? hadoop hadoop

why password less ssh not working?


More information would be required to get the "real" cause. However here it goes two of the most common problems I have found and not related to the key configuration itself (taking into account that you use Linux :)):

  1. SSHD in the remote machine is configured in restricted mode for "root" and you are trying to ssh as root. SOLUTION: Copy /etc/ssh/sshd.conf from one of the working machines to the faulty and restart ssh server.

  2. Home folder of the user used for remote login has invalid permissions. Many default configurations for SSH Daemons contain restrictions about the permissions of the user home folder for security purposes. SOLUTION: Compare with working nodes and fix. (Sometimes you would see a warning/error log in /var/log/messages.

If you follow the process to integrate the keys from the scratch and review the permissions for all the files involved you should face no issues.

Please answer back with sshd.conf file as well as the logs from a remote login with -v (ssh -v IPADDR) for a better analysis.


I had a very similar problem today with CentOS servers. The problem turned out that the /root folder had wrong permissions. In fact, the /var/log/secure log file showed this error:

Sep  3 09:10:40 nec05 sshd[21858]: Authentication refused: bad ownership or modes for directory /root

This is what it wrongly was:

[root@nec05 ~]# ls -ld /rootdrwxrwxrwx. 32 root root 4096 Sep  3 09:54 /root

Using chmod fixed it:

[root@nec05 ~]# chmod 550 /root[root@nec05 ~]# ls -ld /rootdr-xr-x---. 32 root root 4096 Sep  3 09:54 /root

After that, passwordless login worked on this particular server.


I went through the same errors recently. All my file permissions are set up correctly but still ssh asks for password. Finally I figured out it is due to one missing at /etc/ssh/sshd_config: you shoud add "AuthorizedKeysFile %h/.ssh/authorized_keys", so that sshd will look for the publickey file at your home dir.

After doing this the problem is gone.