Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
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

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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