Created
February 5, 2025 08:58
-
-
Save akme/c79b6c12ebcb057a3d16f89f075cb075 to your computer and use it in GitHub Desktop.
Find an Ed25519 SSH key with a desired suffix
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/bash | |
suffix="*test" # set your suffix | |
comment="set-your-comment" # could be your email | |
while true; do | |
rm -f newkey newkey.pub | |
ssh-keygen -t ed25519 -f ./newkey -C $comment -N '' >>/dev/null | |
shopt -s nocasematch | |
if [[ $(awk '{print $2}' newkey.pub) == $suffix ]]; then | |
echo "YAY! Found a key with suffix $suffix" | |
cat newkey.pub | |
break | |
fi | |
done | |
# set password for key | |
# ssh-keygen -p -f newkey |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment