0

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?

1 Answer 1

3

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

4
  • 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, 2012 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, 2012 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, 2012 at 16:26
  • @gg.kaspersky I never knew of ssh-copy-id. Learn something new every day, I guess...
    – hd1
    Dec 14, 2012 at 18:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .