Linux Commands - ssh-copy-id

by
Jeremy Canfield |
Updated: May 13 2021
| Linux Commands articles
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 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.
Did you find this article helpful?
If so, consider buying me a coffee over at