Requirements for a successful password-less ssh setup
OK this password-less ssh issue has bothered me for quite a long time and I am officially making the requirements a post so I (and hopefully you) can benefit from it.
The list is quite simple:
1) chmod go-w ~/
2) chmod 700 ~/.ssh
3) chmod 600 ~/.ssh/authorized_keys
for ssh version 2 you might need to add “2” to the end of authorized_keys, that is, step 3) would become
chmod 600 ~/.ssh/authorized_keys2
Item 1) is easy to overlook, what the command does is to remove write permission for group (g) and others (o) from the home directory.
A good place to trouble-shoot the key-based login problem is /var/log/secure, if you see something like the following
Authentication refused: bad ownership or modes for directory /path/to/the/user_ssh_folder
You know you need to check and fix the ownership of directories/file mentioned in the list.