Skip to content

Instantly share code, notes, and snippets.

@tonejito
Last active October 19, 2017 15:06
Show Gist options
  • Save tonejito/9ae6fc6265a94c41d8bfa1e6e89b3e98 to your computer and use it in GitHub Desktop.
Save tonejito/9ae6fc6265a94c41d8bfa1e6e89b3e98 to your computer and use it in GitHub Desktop.
Generate and print SSH key
#!/usr/bin/env bash
# = ^ . ^ =
# https://gist.github.com/tonejito/9ae6fc6265a94c41d8bfa1e6e89b3e98
KEY=id_rsa
MAIL=${USER}@$(hostname -f)
umask 0077
mkdir -vp ~/.ssh/keys/
ssh-keygen -N "" -t rsa -b 8192 -f ~/.ssh/keys/${KEY} -C ${MAIL}
ssh-keygen -l -f ~/.ssh/keys/${KEY}
ssh-keygen -l -f ~/.ssh/keys/${KEY}.pub
cat ~/.ssh/keys/${KEY}.pub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment