Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just put a new hard drive in my computer and restored my id_rsa key from a backup I had. However, when I try to connect to SSH, OSX is asking for a password. I didn't set a password when I created the key. Using a password or not, I'm unable to connect via public key. I've checked several things:


enter image description here

SSH Verbose Log

OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to [] port 22.
debug1: Connection established.
debug1: identity file /Users/jessebunch/.ssh/id_rsa type 1
debug1: identity file /Users/jessebunch/.ssh/id_rsa-cert type -1
debug1: identity file /Users/jessebunch/.ssh/id_dsa type -1
debug1: identity file /Users/jessebunch/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH_4*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '[]:22' is known and matches the RSA host key.
debug1: Found key in /Users/jessebunch/.ssh/known_hosts:1
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_ACCEPT received    
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/jessebunch/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
debug1: Trying private key: /Users/jessebunch/.ssh/id_dsa
debug1: Next authentication method: password

Any ideas?

share|improve this question
Not sure, but it seems that you private key was encrypted, and you need the password to get at it. – soandos Jul 24 '11 at 1:58
Is it possible that I generated this public key from a private key that I didn't backup? – Jesse Bunch Jul 24 '11 at 2:00
Mathematically, that does not make much sense to me, so no, but am not sure. – soandos Jul 24 '11 at 2:01
and not entering a password here didnt work? – soandos Jul 24 '11 at 2:10
np. Sorry I could not have been of more help. – soandos Jul 24 '11 at 2:15
up vote 1 down vote accepted

After a quick tutorial on how RSA key authentication works, I found my answer:

Right. It seems that I didn't understand how a public/private key works. I didn't backup the private key, just the public key. I'm trying to restore the public key to my id_rsa file when I should be restoring the private key. Therefore, I'm screwed.

Lessons learned? Backup both the id_rsa and keys. NOT just the key.

share|improve this answer

As long as I know, the server side does not have to have your private key. This is the main point of a RSA authentication or more generally an asymmetric key authentication. It is a good practice to back up both keys but mind that once the private key is compromised the whole asymmetric authentication gets compromised.

share|improve this answer

You must log in to answer this question.

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