diff options
Diffstat (limited to 'scripts/key-check.sh')
| -rwxr-xr-x | scripts/key-check.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/key-check.sh b/scripts/key-check.sh new file mode 100755 index 0000000..1672bc4 --- /dev/null +++ b/scripts/key-check.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Check for a public key, and create one for the user if it +# does not exist. Spit the key in red to stdout. Not so much for me, +# but as a convienient script to give to others who aren't so familiar +# with how SSH key authorization works. + +keyf="$HOME/.ssh/id_ed25519"; +! [ -e "$keyf" ] && ssh-keygen -t ed25519 -f "$keyf" -P ""; +printf '\033[1;31m%s\033[0m\n' "$(cat "$keyf.pub")"; + +# One line version for pasting into chat: +# keyf="$HOME/.ssh/id_ed25519"; ! [ -e "$keyf" ] && ssh-keygen -t ed25519 -f "$keyf" -P ""; printf '\033[1;31m%s\033[0m\n' "$(cat "$keyf.pub")"; |
