Skip to content

Instantly share code, notes, and snippets.

@mpalpha
Last active April 7, 2021 18:16
Show Gist options
  • Save mpalpha/aa2bdfc8b96d28f192c3 to your computer and use it in GitHub Desktop.
Save mpalpha/aa2bdfc8b96d28f192c3 to your computer and use it in GitHub Desktop.
ssh key generator for osx (passphrase is your current user name)
# make executable with 'chmod a+x sshmac.sh' if needed
if [ "$(uname)" == "Darwin" ]; then
# Generate ssh key for Mac OS X platform
cd ~/
mkdir .ssh
cd .ssh
ssh-keygen -t rsa -N "$(id -u -n)" -f id_rsa
ssh-add ~/.ssh/id_rsa
sleep 0.05m
pbcopy < ~/.ssh/id_rsa.pub
echo "ssh key was copied to your clipboard"
else
echo "ssh key generation failed: this is not a mac"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment