Copying SSH key to Remote Server

ssh-copy-id command is used to copy your SSH public key to remote server for password less authentication.

Once you have your SSH key generated with ssh-keygen command, you need to run

ssh-copy-id user@host

You will be asked to enter password. One you enter password, ssh-copy-id will transfer your public key to remote server and install it.

Next time, when you login to remote server with

ssh user@host

You won’t need to enter password as your ssh key is added to ~/.ssh/authorized_keys file.

You can do this manually by copying content of file ~/.ssh/id_rsa.pub (this is your SSH public key, it is safe to share it with others).

cat ~/.ssh/id_rsa.pub

To remote servers ~/.ssh/authorized_keys

See ssh


Posted in Linux