Skip to content

Instantly share code, notes, and snippets.

@gnanet
Created August 28, 2018 23:50
Show Gist options
  • Select an option

  • Save gnanet/c3ecb9bf46c224af9ede59bb91f166ad to your computer and use it in GitHub Desktop.

Select an option

Save gnanet/c3ecb9bf46c224af9ede59bb91f166ad to your computer and use it in GitHub Desktop.
One-Liner for split authorized_keys, generate a fingerprint for each public key with ssh-keygen
cat authorized_keys | while read keyline; do if [ "$keyline" != "" ]; then keyname=$(echo $keyline | cut -d' ' -f 3); keytype=$(echo $keyline | cut -d' ' -f 1); echo $keyline > ${keytype}_${keyname}.pub; ssh-keygen -l -f ${keytype}_${keyname}.pub && rm ${keytype}_${keyname}.pub; fi; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment