FreeKB - Linux Commands ssh-copy-id
Linux Commands - ssh-copy-id

The ssh-copy-id command can be used to append your public certificate, such as id_rsa.pub on server "a" to the authorized_keys file on server "b".

In this example, John Doe's id_rsa.pub public certificate on server1.example.com will be appended to /home/john.doe/.ssh/authorized_keys on server2.example.com.

john.doe@server1.example.com ~]# ssh-copy-id /home/john.doe/.ssh/id_rsa.pub john.doe@server2.example.com

 

If the public certificate is successfully appended to the authorized_keys file on the target system, the following should be displayed.

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'john.doe@server2.example.com'"
and check to make sure that only the key(s) you wanted were added.

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 4c5d2 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |