How to reuse and share an SSH private key between Mac OS X and Linux?

Asked

Viewed 1,118 times

1

I realized that the Mackup is able to back up the private key in Dropbox. I tried to copy my old private key from a Time Machine backup (I did a clean install of Mavericks), which was without password, to my home.

When I try to use the key on OS X he asks me for a password like my key has one, and he won’t let me use it. I haven’t tested what happens on Linux yet.

Usage OS X 10.9.1 and Elementary OS Luna.

  • My solution was to create a new key following Emerson’s recommendation. I tested it on a virtual machine running OS X 10.9 and it accepted the key normally. Maybe the problem is related to key creation

2 answers

1


Just like J Bruni said, it’s a matter of copying the key to the other computer that wants to use it.

For the problem you mentioned about copying the key to another Mac and asking for password, I recommend that you create a private key manually, as described in https://help.github.com/articles/generating-ssh-keys and do not manually add a password at the time it asks for password. If it doesn’t work, create the private key on a Linux or Windows with Cywin and copy the generated key to all computers.

My only fear when using Dropbox to stay with private key sharing is that it might be compromised. Remember that private key is something serious. It can be used to login without a password, which means that if it is exposed, it can cause a lot of damage. Since it’s not something that changes frequently, it’s better to have it in every location.

  • 1

    I’ll try to do that. To stay safe I use two-step Dropbox login + login password on both systems.

0

Copy the private key in Dropbox makes it easy to copy it to any other system where you want to use it.

On Linux, create the directory ~/.ssh, if it does not exist, and copy the private key file to the same with the name of id_rsa. Restrict access to it with a chmod 600 ~/.ssh/id_rsa

  • Whenever I use a key generated by another Mac (for example, the one present in my backup) I get this message: http://cl.ly/image/0G2X1z1d1z1w Since, as I said, the key had not been created with password.

  • According to an answer in the Askdifferent, Mac always asks for password when it does not find the corresponding public key (id_rsa.pub or id_dsa.pub).

  • It didn’t work for me, maybe it’s the method I used to generate it that’s the cause of the problem.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.