aboutsummaryrefslogtreecommitdiff
path: root/ssh-pubkey
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2019-03-09 15:39:08 -0300
committerSilvio Rhatto <rhatto@riseup.net>2019-03-09 15:39:08 -0300
commitb40a7d116a1dde72d48b1e9ea549f9918399f8b7 (patch)
treeeb61d771fe9fd0a98f9e2bb0eed525ac1fb7c012 /ssh-pubkey
parent1e9177b7913ea74502c0c6ff77428292c67210b4 (diff)
downloadutils-ssh-b40a7d116a1dde72d48b1e9ea549f9918399f8b7.tar.gz
utils-ssh-b40a7d116a1dde72d48b1e9ea549f9918399f8b7.tar.bz2
Adds ssh-pubkey
Diffstat (limited to 'ssh-pubkey')
-rwxr-xr-xssh-pubkey24
1 files changed, 24 insertions, 0 deletions
diff --git a/ssh-pubkey b/ssh-pubkey
new file mode 100755
index 0000000..dadb1c3
--- /dev/null
+++ b/ssh-pubkey
@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# Load a key into the ssh-agent
+#
+
+# Parameters
+BASENAME="`basename $0`"
+TYPE="$1"
+HANDLE="$2"
+
+# Check
+if [ -z "$HANDLE" ]; then
+ echo "usage: $BASENAME <keytype> <handle>"
+ echo "available keys:"
+ echo ""
+ ( cd $HOME/.ssh/keys && find -name '*.pub' ) | grep -v decomissioned | sed -e 's/^/\t/'
+ exit 1
+elif [ ! -e "$HOME/.ssh/keys/$TYPE/$HANDLE" ]; then
+ echo "$BASENAME: file not found: $HOME/.ssh/keys/$TYPE/$HANDLE"
+ exit 1
+fi
+
+# Dispatch
+cat $HOME/.ssh/keys/$TYPE/$HANDLE.pub