Skip to content

Instantly share code, notes, and snippets.

@larrybotha
Last active April 14, 2018 14:15
Show Gist options
  • Save larrybotha/7786195 to your computer and use it in GitHub Desktop.
Save larrybotha/7786195 to your computer and use it in GitHub Desktop.
Add your public SSH key to your server in one command

Add Your Public SSH Key To Your Server In One Command

You will need to create .ssh/authorized_keys if it is not yet on your server.

cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'

Generating Your Own Public Key

Github has an excellent guide on generating SSH keys

@benediktkr
Copy link

There is a standard tool for this called ssh-copy-id thats distributed with openssh.

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