Skip to content

Instantly share code, notes, and snippets.

@akme
Created February 5, 2025 08:58
Show Gist options
  • Save akme/c79b6c12ebcb057a3d16f89f075cb075 to your computer and use it in GitHub Desktop.
Save akme/c79b6c12ebcb057a3d16f89f075cb075 to your computer and use it in GitHub Desktop.
Find an Ed25519 SSH key with a desired suffix
#!/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