3

i am logging onto ssh server from my laptop and i have my private key there but i would like to logon also from my desktop at home, so how can i copy the key?

OS: ubuntu

1
  • Which OS? I am tempted to suggest that you print it on paper and put it in a sealed envelope but encrypting the keyfile and storing it in on a flashdrive would be my choice. On Linux the keyfile is at ~/.ssh/ and its called something like id_rsa or id_dsa.
    – user8602
    Sep 29, 2010 at 19:50

3 Answers 3

1

as SuperJames said, the best answer is ssh-copy-id; but note that it doesn't do what you're asking, it does what you should do: use a different key pair and install both on the server.

that way, if your laptop gets compromised, you just have to delete that public key from the server(s).

ssh private keys should never be shared, not even with yourself.

2
  • our server restricts access to users who are not a group member. i have administrative privileges. let's say i create a user called infestorHome and add it to the privileged group. will the server accept public key upload from infestorHome?
    – şaloma
    Sep 29, 2010 at 20:37
  • no need to create new users, each user can hold any number of public keys.
    – Javier
    Sep 29, 2010 at 21:17
3

You should generate and use a separate key on each client.

Although it's written in regards to using the ssh keys for scp in batch mode, this article is the one I always refer back to to refresh my memory about ssh keys. It's very clear and very short.

0

If you already have a public/private key pair generated, then use the "ssh-copy-id" command. I believe that it comes with OpenSSH.

ssh-copy-id - install your public key in a remote machine's autho‐ rized_keys

see "man ssh-copy-id" for more information.

4
  • 1
    ssh-copy-id copies the public key, Infestor wants to copy the private key.
    – Juliano
    Sep 29, 2010 at 20:25
  • 1
    @Juliano - I think that I misunderstood at first, but he really should not be copying the private key. Best to generate a new pair for each machine and distribute the public key.
    – SuperJames
    Sep 29, 2010 at 20:35
  • yes, SuperJames is correct, apparently i shall not try to copy a private key, instead make a new pair.
    – şaloma
    Sep 29, 2010 at 20:44
  • I agree, the private key should never leave the client. It is just that the answer answers something that is not what was asked, and makes no note that what was asked is incorrect.
    – Juliano
    Sep 29, 2010 at 21:09

You must log in to answer this question.

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