SSH public key authentication error

authenticationssh

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?

Best Answer

  • 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

  • Related Question