Skip to content

Instantly share code, notes, and snippets.

@mjones129
Created May 6, 2024 15:01
Show Gist options
  • Save mjones129/d6383b4cbf8f45884d0e9f2fffb6618d to your computer and use it in GitHub Desktop.
Save mjones129/d6383b4cbf8f45884d0e9f2fffb6618d to your computer and use it in GitHub Desktop.
Add SSH public key to server
# Magically copy your public key to a remote server and add it to authorized_keys with this handy one-liner.
# -i flag accepts the path to the file that will be uploaded.
# final argument is the username@host-destination root directory.
ssh-copy-id -i ~/.ssh/some-key.pub user@host.com
# To confirm the copy was successful (supposing you can recognize your public key when you see it)
ssh user@host.com && cat /.ssh/authorized_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment