I'm using an old login with ssh-rsa public/private key and all was good.
I noticed that a couple of days ago the authorizazion was avoid with message "server refused our keys". After diggin' I figured out that the couple of keys stop working after exactly 5 years of their creation.
So I make a new pair of keys, take the public one, paste inside a file in ~/.ssh of the username that I'm using, converted it with ssh-keygen -if and paste the new file into authorized_keys but the I still get "server refused our key".

It's ok to copy and paste the real key without transfer it?

What I'm missing? This isn't my first time using a pair of keys and I follow the same procedure as described. I'm in doubt if I'm changing the correct authorized_keys file but I've take a look in /etc/passwd and see where is the home of the login which I'm using.

  • 1
    Did you remove the offending key on both sides? It's possible it never asks for the second after rejecting the first. – Shadur Jun 27 '12 at 8:16
  • Yes I did, on the authorized_keys file. – Kreker Jun 27 '12 at 9:29

To my knowledge, its not nessessary to do the ssh-keygen -if on the remote machine. Just copy the public part of your keypair (e.g. id_rsa.pub) to the remote machine and append it to the ~/.ssh/authorized_keys file.

There is also a neat utility that does it all for you: ssh-copy-id.

ssh-copy-id [-i [identity_file]] [user@]machine

Also make sure the key is loaded with ssh-add -l.

  • I never understand this. the id_rsa.pub or whatelse is still necessary after append the key to authorized_keys? – Kreker Jun 27 '12 at 9:29
  • 1
    If you have appended the id_rsa.pub to authorized_keys on the remote machine, you can delete it on the remote machine. ssh-copy-id does this all for you. – Isaac Jun 27 '12 at 9:40
  • Did you mean ssh-add -l? – Thor Jun 27 '12 at 9:53
  • I got it! Thanks, for some reaseon I was edited a wrong file. Btw the key aren't expired, was only a coincidence that they was created 5 years ago! – Kreker Jun 28 '12 at 7:59

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.