= Copy ssh key to a remote server =

The ssh-copy-id command installs ssh key on a server as an authorized key. It allows for access provisioning without requiring a password for each subsequent login.

How to use it

Once the key has been generated, you can use the ssh-copy-id command to install it on a server. Use the following command to authorize the key named mykey:

1
ssh-copy-id ~/.ssh/mykey user@host

Only the public key is being copied. The private key should never be touched.

Once the key has been copied, it is the best to test it:

1
ssh -i ~/.ssh/mykey user@host

The login should now be completed without asking for a password.

MacOS

You will need to install this tool separately using for example Homebrew.

1
brew install ssh-copy-id

Alternatively you can install the tool using the following command:

1
curl -L https://raw.githubusercontent.com/beautifulcode/ssh-copy-id-for-OSX/master/install.sh | sh 

= References =