Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to ssh to a remote machine using a private key file: id_rsa, however, I'm getting the error:

$ ssh -v -i id_rsa user@remote
[...]
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: id_rsa
debug1: Authentications that can continue: publickey,password
debug1: No more authentication methods to try.
Permission denied (publickey,password).

Why am I getting permission denied?

share|improve this question

migrated from stackoverflow.com Dec 21 '12 at 16:37

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 1 down vote accepted

Have you copied over your public key? Depending on the OS you are using, you can probably use:

ssh-copy-id -i .ssh/id_rsa.pub user@remote

Of course, you will need password auth available on the remote system to do this so that you can copy your public key there.

Jeff

share|improve this answer
    
Yeah, this was the problem. Actually, I lost my public key, and the new generated when wasn't exactly the same as the old one (stored in authorized_keys). –  gg.kaspersky Dec 12 '12 at 22:36
    
You need to specify a path to copy your key to, else you'll end up overwriting any ssh public key on remote. –  hd1 Dec 13 '12 at 0:58
    
@hd1, I think not, because as far as I know, ssh-copy-id basically makes a cat to authorized_keys. –  gg.kaspersky Dec 14 '12 at 16:26
    
@gg.kaspersky I never knew of ssh-copy-id. Learn something new every day, I guess... –  hd1 Dec 14 '12 at 18:19

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.