I’ve been struggling for the last couple of days to get password-less ssh to work between two linux machines running Ubuntu 8.04 on my local network.
I went through the correct procedures, i.e. ssh-keygen -t rsa, copied the public key to authorized_keys and used scp to copy it over to the .ssh directory of the user account for my other machine. Each time I did this I tried to ssh to my other machine (ssh -vvv billyfire3) and each time it asked for a password – which was not what I expected to happen. I deinstalled and reinstalled SSH to not avail. I even did a fresh install of Ubuntu on one of the machines – but still had the same problem.
I did a search for the problem and discovered that I was not alone in having difficulty getting passwordless SSH to work. I finally found a post (I can’t remember where, unfortunately) that suggested looking at /var/log/auth.log. I attempted a password-less login (which asked for a password) and then looked at the auth.log on the machine (billyfire3) that I was trying to connect to.
Sure enough, the log included:
Authentication refused: bad ownership or modes for directory /nutch-0.9/home/.ssh
I looked at the .ssh directory and found that the owner of .ssh was set to root and not the name of my user (nutch). I corrected this by removing the .ssh directory and recreating it when logged in as the nutch user. I tried again. This time I received this message:
Authentication refused: bad ownership or modes for directory /nutch-0.9/home
I checked the /nutch-0.9/home directory on billyfire3 and noticed that permissions were set to 777. I changed them to 0700 and tried again. Success!
The log said:
Accepted publickey for nutch from 192.168.0.102 ……………