Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
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. –  bytesum Sep 29 '10 at 19:50

3 Answers 3

up vote 1 down vote accepted

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.

share|improve this answer
    
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? –  Infestor Sep 29 '10 at 20:37
    
no need to create new users, each user can hold any number of public keys. –  Javier Sep 29 '10 at 21:17

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.

share|improve this answer

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.

share|improve this answer
    
ssh-copy-id copies the public key, Infestor wants to copy the private key. –  Juliano Sep 29 '10 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 '10 at 20:35
    
yes, SuperJames is correct, apparently i shall not try to copy a private key, instead make a new pair. –  Infestor Sep 29 '10 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 '10 at 21:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.