SSH public key authentication error

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?

kaspersky

Posted 2012-12-12T22:24:55.523

Reputation: 121

Answers

2

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

Jeff

Posted 2012-12-12T22:24:55.523

Reputation:

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). – None – 2012-12-12T22:36:26.503

You need to specify a path to copy your key to, else you'll end up overwriting any ssh public key on remote. – hd1 – 2012-12-13T00:58:27.387

@hd1, I think not, because as far as I know, ssh-copy-id basically makes a cat to authorized_keys. – None – 2012-12-14T16:26:44.677

@gg.kaspersky I never knew of ssh-copy-id. Learn something new every day, I guess... – hd1 – 2012-12-14T18:19:49.967