Created
April 7, 2020 02:40
-
-
Save droberson/7438583d4b25c55736e9a2d6f45b9eeb to your computer and use it in GitHub Desktop.
Generate lots of ssh keypairs. This is useful for creating ssh keys to deploy and assign to your teams for CTFs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This will generate a keypair for each command line argument: | |
# | |
# Create keys named "daniel", "jacob", and "whitley" | |
# % generate-lots-of-ssh-keypairs.sh daniel jacob whitley | |
# | |
# Create 100 numbered keys | |
# % generate-logs-of-ssh-keypairs.sh $(seq 100) | |
for name in $@; do | |
echo | ssh-keygen -f $name -C ${name}@autogenerated >/dev/null -f ~/.ssh/${name} 2>/dev/null | |
if [ $? != 0 ]; then | |
echo "[-] Key exists: $name" | |
else | |
echo "[+] Created $name" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment