Copy SSH public key to another server instructions

copy ssh public key

Prerequisities

You need to have a public key. If you haven’t generated keys before use:

ssh-keygen -t rsa

copy ssh public key is very simple. there are some ways to achieve this:

Using ssh-copy-id (recommended)

ssh-copy-id user@host

with this very simple command you can copy your public key to any user@host combination

Using scp

scp .ssh/id_rsa.pub user@host2:.ssh/authorized_keys

cd ~/ before.

The different is that scp will create a new file called authorized_keys while ssh-copy-id will add to id.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.