aboutsummaryrefslogtreecommitdiff
path: root/keyCheck.sh
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2015-12-28 13:52:48 -0500
committerMitch Riedstra <mitch@riedstra.us>2015-12-28 13:52:48 -0500
commitd32ab30dc3611481cb55ce7b18bb1a80352f9146 (patch)
tree0b3ee3c8fefbfc8dfa98349bb22fc9ca1358137a /keyCheck.sh
downloaddotfiles-d32ab30dc3611481cb55ce7b18bb1a80352f9146.tar.gz
dotfiles-d32ab30dc3611481cb55ce7b18bb1a80352f9146.tar.xz
Initial
Diffstat (limited to 'keyCheck.sh')
-rw-r--r--keyCheck.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/keyCheck.sh b/keyCheck.sh
new file mode 100644
index 0000000..2293b3c
--- /dev/null
+++ b/keyCheck.sh
@@ -0,0 +1,24 @@
+#!/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
+
+# Really useful for people running MacOS
+
+# One line version to paste in a chat or so
+# if [ -e ~/.ssh/id_rsa.pub ] ; then echo $'\033[1;31m' ; cat ~/.ssh/id_rsa.pub ; echo $'\033[0m' ; else ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -t rsa -P ""; echo $'\033[1;31m' ; cat ~/.ssh/id_rsa.pub ; echo $'\033[0m'; fi
+
+if [ -e ~/.ssh/id_rsa.pub ] ; then
+ echo $'\033[1;31m'
+ cat ~/.ssh/id_rsa.pub
+ echo $'\033[0m'
+else
+ ssh-keygen \
+ -t rsa \
+ -b 4096 \
+ -f ~/.ssh/id_rsa \
+ -P ""
+ echo $'\033[1;31m'
+ cat ~/.ssh/id_rsa.pub
+ echo $'\033[0m'
+fi