Skip to content

Instantly share code, notes, and snippets.

@bbrks
Last active December 23, 2015 20:49
Show Gist options
  • Save bbrks/6692143 to your computer and use it in GitHub Desktop.
Save bbrks/6692143 to your computer and use it in GitHub Desktop.
Easily regenerate SSH keys... just in case
#!/bin/sh
# nukekeys.sh
# Easily regenerate SSH keys... just in case
# https://gist.github.com/bbrks/6692143
read -p "WARNING: This will regenerate ALL *_rsa keys!! Are you sure? " -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
cd ~/.ssh
BITS=8192;
keys=(*_rsa)
rm -f *_rsa
rm -f *_rsa.pub
for i in "${keys[@]}"
do :
echo "\nEnter passphrase for ${i}"
ssh-keygen -b $BITS -t rsa -q -f $i
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment