Centos – nfs mount passwordless login

centoscentos5nfsssh

Setup:

OS : CentOS5

node 1 : 172.16.1.1 sandbox1.local
node 2 : 172.16.1.2 sandbox2.local

The nodes have the hostnames in the hots file. Pinging to each other works fine.

Problem:

My home is mounted from sandbox1.local:/home/%u/ to sandbox2.local:/home/%u/.
I want to establish passwordless login with this shared home directory. The usernames are the same e.g. sandbox on both of the nodes. When the home folder is unmounted on sandbox2.local all works fine. When it is mounted via nfs from sandbox1.local:/home/%u/ to sandbox2.local:/home/%u/ the passwordless login fails and asks for a password.

Does anyone have an idea how to acieve this with a shared home via NFS?

The debug output seems different:

debug2: key: /home/zandbak/.ssh/identity ((nil))
debug2: key: /home/zandbak/.ssh/id_rsa (0x9f4ce60)
debug2: key: /home/zandbak/.ssh/id_dsa ((nil))
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/zandbak/.ssh/identity
debug3: no such identity: /home/zandbak/.ssh/identity
debug1: Offering public key: /home/zandbak/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/zandbak/.ssh/id_dsa
debug3: no such identity: /home/zandbak/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password

Best Answer

I think this will work, given your comments above:

sandbox1$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

Then ensure the NFS mount is active from 1 to 2. You should then be able to login from 1 to 2 and vice-versa without passwords. You may have to use id_rsa.pub or authorized_keys2 depending on your specific setup.