Skip to content

Instantly share code, notes, and snippets.

@thinkjrs
Created March 4, 2023 20:20
Show Gist options
  • Save thinkjrs/cc6adf0a1782554a2c1f778763c32f23 to your computer and use it in GitHub Desktop.
Save thinkjrs/cc6adf0a1782554a2c1f778763c32f23 to your computer and use it in GitHub Desktop.
Copy an SSH key to a server

Copy an SSH key to a server

Use the built-in ssh-copy-id command to copy keys to servers.

Note: make sure you have enabled password authentication on the server ssh server configuration, first!

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

Edit server config for safety

Now on your server edit the sshd_config typically at /etc/ssh/sshd_config as root to remove PermitPasswords.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment