All Distros

Logging in with public keys

Send your id_rsa.pub to file /root/.ssh/known_hosts on the server

You can copy the public key into the new machine’s authorized_keys file with the ssh-copy-id command (make sure to replace the example username and IP address below).

From your local machine issue:
ssh-copy-id user@123.45.56.78

Alternatively, you can paste in the keys using SSH:

cat ~/.ssh/id_rsa.pub | ssh user@123.45.56.78 "mkdir -p ~/.ssh && cat >>  ~/.ssh/authorized_keys"
Advertisements

One thought on “Logging in with public keys

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s