copy SSH key to a remote server


If you are adding it to a server where you can login with a username/password, use ssh-copy-id:

ssh-copy-id -i ~/.ssh/my-key.pub [email protected]

But if you only login with an existing SSH key, you’ll need to do it manually:

cat ~/.ssh/my-new-key.pub | ssh -i ~/.ssh/my-old-key [email protected] 'cat >> .ssh/authorized_keys'

source

Date: 2020-04-23

Tags:  openssl

Share: