Skip to content

Instantly share code, notes, and snippets.

@hailiang-wang
Forked from hongkongkiwi/generate-ssh-key
Created September 28, 2022 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hailiang-wang/191711c96d54a8ff9272dad6a311dc38 to your computer and use it in GitHub Desktop.
Save hailiang-wang/191711c96d54a8ff9272dad6a311dc38 to your computer and use it in GitHub Desktop.
Simple one liner to generate an SSH key without a password in the default place with the comment as hostname then print out the public key for copy and paste.
HOSTNAME=`hostname` ssh-keygen -t rsa -C "$HOSTNAME" -f "$HOME/.ssh/id_rsa" -P "" && cat ~/.ssh/id_rsa.pub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment