From 5b25c5155312f626813e0d36b7933f5eba801dd2 Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Fri, 29 Oct 2021 21:53:53 -0400 Subject: Major dotfile cleanup --- scripts/key-check.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 scripts/key-check.sh (limited to 'scripts/key-check.sh') 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")"; -- cgit v1.2.3