1

I am trying to set up public key access to a couple of machines that I have a user account on.

What I did:

  • I used ssh-keygen to generate a key pair (without a passphrase) on my personal computer that I use to access the two machines in question.
  • I appended the id_rsa.pub file thus created to the ~/.ssh/authorized_keys on both machines.

This setup works fine and lets me SSH onto one machine. For the other machine, though, it still prompts me for my password. I tried using ssh -vvv and here are the relevant lines of output:

debug1: Offering public key: /xxxx/xxxxx/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /xxxx/xxxx/.ssh/id_dsa
debug3: no such identity: /xxxx/xxxx/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password

I'm then prompted for my password and I can use it to log in normally.

It's the same account on both machines, exported via an NIS map. The machine where authentication succeeds is the NIS server and the other one is the client. My home directories on both machines are not the same (no NFS mount or the like). These are the only differences I can think of that set the two machines apart.

What can be going wrong here?

  • 1
    You don't mention that you put the private key on both systems, only that you added the public key to authorized_keys on both systems. Also check permissions of your home directory, directories leading to your home directory, your .ssh directory and finally the private key file and authorized_keys. Nothing should be writeable by non-root outside your home dir. As you have a system that's working you can compare the permissions / ownership with the non-working one. – wurtel May 4 '15 at 7:40
  • @wurtel It was a permissions issue. I had to set the .ssh directory to 0700 permissions (like the other machine where the key was working) and it fixed everything. If you make this into an answer, I will accept it. – Joseph R. May 5 '15 at 23:43
1

Make sure you put the private key on both systems (you don't mention that explicitly).

Check permissions of your home directory, directories leading to your home directory, your .ssh directory and finally the private key file and authorized_keys. Nothing should be writeable by non-root outside your home dir. This is a check done by the ssh daemon, as too open permissions could mean that a third party places his own public key in your authorized_keys file, and using that can gain your privileges.

As you have a system that's working you can compare the permissions / ownership with the non-working one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.