Skip to content

Instantly share code, notes, and snippets.

@mfurquimdev
Last active March 12, 2019 18:41
Show Gist options
  • Select an option

  • Save mfurquimdev/5a329138741a3bea5e1ad7a56a52cedc to your computer and use it in GitHub Desktop.

Select an option

Save mfurquimdev/5a329138741a3bea5e1ad7a56a52cedc to your computer and use it in GitHub Desktop.
Generate ssh key with nice comment, no password and default place.
# Linux
ssh-keygen -t rsa -b 4096 -C "$USER@$(uname -n).$(cut -f 1 -d ' ' /etc/issue | head -n 1 | sed -e 's/\(.*\)/\L\1/')" -N '' -f /home/$USER/.ssh/id_rsa
# Mac OS
ssh-keygen -t rsa -b 4096 -C "$USER@$(uname -n).$(sw_vers | head -1 | cut -c 14-19)" -N '' -f /Users/$USER/.ssh/id_rsa
last=$(echo `history |tail -n2 |head -n1` | sed 's/[0-9]* //')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment