Linux – ssh without password does not work for some users

linuxpublic-keysolarisssh

I have a new RHEL4 Linux box that I am using to copy data to old Solaris 2.6 and RHEL3 Linux boxes with scp. I have found that with the same setup, it works for some users but not for others. For user jane, this works fine:

jane@host1$ ssh -v remhost

debug1: Next authentication method: publickey
debug1: Trying private key: /mnt/home/osborjo/.ssh/identity
debug1: Offering public key: /mnt/home/osborjo/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).

for user jack it does not:

jack@host1 ssh -v remhost

debug1: Next authentication method: publickey
debug1: Trying private key: /mnt/home/oper1/.ssh/identity
debug1: Offering public key: /mnt/home/oper1/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive

I have looked at the permissions for all the keys and files, they look the same. Since I am using home directories mounted by NFS, the keys for both the remote host and the local host are in the same directory. This is how things look for jane:

jane@host1$ ls -l $HOME/.ssh

-rw-rw-r--   1 jane    operator     394 Jan 27 16:28 authorized_keys
-rw-------   1 jane    operator    1675 Jan 27 16:27 id_rsa
-rw-r--r--   1 jane    operator     394 Jan 27 16:27 id_rsa.pub
-rw-rw-r--   1 jane    operator    1205 Jan 27 16:46 known_hosts

For user jack:

jack@host1$ ls -l $HOME/.ssh

-rw-rw-r--   1 jack    engineer    394  Jan 27 16:28 authorized_keys
-rw-------   1 jack    engineer    1675 Jan 27 16:27 id_rsa
-rw-r--r--   1 jack    engineer    394  Jan 27 16:27 id_rsa.pub
-rw-rw-r--   1 jack    engineer    1205 Jan 27 16:46 known_hosts

As a last ditch effort, I copied the authorized_keys, id_rsa, and id_rsa.pub from jill to jack, and changed the username in authorized_keys and id_rsa.pub with vi. It still did not work. It seems there is something different between the two users but I cannot figure out what it is.

Best Answer

I found the answer. It was in the permissions of the home directory of user jack. User jack had group write permissions on the home directory, while jane did not. The problem is that all of the tutorials on the web specify the permissions for the .ssh directory and the files, but fail to mention that the user directory itself needs to have write permission for group turned off.