Skip to content

Instantly share code, notes, and snippets.

@nepsilon
Last active February 19, 2017 14:28
Show Gist options
  • Save nepsilon/9abeb62258889525f47b6096dd32fcf7 to your computer and use it in GitHub Desktop.
Save nepsilon/9abeb62258889525f47b6096dd32fcf7 to your computer and use it in GitHub Desktop.
How to copy SSH keys to another machine? — First published in fullweb.io issue #79

How to copy SSH keys to another machine?

Public key authentication is generally safer than password-based and is way more convenient.

SSH offers a command to set it up, ssh-copy-id (part of the openssh client package) will copy your public key to the remote machine. Use it like this:

ssh-copy-id -i ~/.ssh/my_key.pub remote-machine

You’ll be prompted your password, and your public key will be appended to the remote machine’s ~/.ssh/authorized_keys file.

Note: Remember to use ssh-keygen to first generate a pair of keys if you don't have any.

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