aboutsummaryrefslogtreecommitdiff
path: root/scripts/key-check.sh
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2021-10-29 21:53:53 -0400
committerMitchell Riedstra <mitch@riedstra.dev>2021-10-29 21:53:53 -0400
commit5b25c5155312f626813e0d36b7933f5eba801dd2 (patch)
tree6e264a92dbe13ed77821a5c5bd536b6701768442 /scripts/key-check.sh
parente9b933ea6ce85f5d4f4653b7e5e6a7c836fcc893 (diff)
downloaddotfiles-5b25c5155312f626813e0d36b7933f5eba801dd2.tar.gz
dotfiles-5b25c5155312f626813e0d36b7933f5eba801dd2.tar.xz
Major dotfile cleanup
Diffstat (limited to 'scripts/key-check.sh')
-rwxr-xr-xscripts/key-check.sh12
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")";