Sharing Knowledge | System Admin Articles

Copy Public Keys using ssh-copy-id to remote servers

ssh-copy-id is a utility which comes with the OpenSSH package.

ssh-copy-id copies your public identity keys to the remote server, in the correct format, makes sure file permissions and ownership are correct, and ensures a private key is not accidentally copied.

To Generate the keys (If you have not done already) :

# ssh-keygen -t rsa

This is will create your public and private keys and will place them by default in .ssh folder in your home directory.

To setup password less login (key based login), you need to append your public key to the authorized_keys file on the remote server which you want to setup the key based authentication.

You can do conventional copy/paste, etc.. But it takes much time and its repetitive job for multiple hosts. 

To avoid this, you can copy using the following command, which makes your job much easier

# ssh-copy-id -i  ~/.ssh/  [email protected]

Using key-based authentication instead of passwords, makes it easier to manage multiple remote systems.

Labels: Linux, SSH, Tips

My Profile PhotoAbout the Author

I'm Parthiban, An UNIX System Admin by Profession. I'm Experienced in Linux/Unix System Administration and Scripting. I have done lot of work on the infrastructure Mgmt side in Linux, UNIX and Windows system administration, Hardware, Storage and Data center. I'm blogging since 2008.
Follow Me On Twitter or On Facebook

0 Comments for "Copy Public Keys using ssh-copy-id to remote servers"

What do you think about this Article? Add your Opinion..!

Back To Top