]> gitweb.fluxo.info Git - utils-ssh.git/commitdiff
Adds ssh-agent-loadkey
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 10 Dec 2018 12:59:25 +0000 (10:59 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 10 Dec 2018 12:59:25 +0000 (10:59 -0200)
ssh-agent-loadkey [new file with mode: 0755]

diff --git a/ssh-agent-loadkey b/ssh-agent-loadkey
new file mode 100755 (executable)
index 0000000..610f10b
--- /dev/null
@@ -0,0 +1,21 @@
+#!/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>"
+  exit 1
+elif [ ! -e "$HOME/.ssh/keys/$TYPE/$HANDLE" ]; then
+  echo "$BASENAME: file not found: $HOME/.ssh/keys/$TYPE/$HANDLE"
+  exit 1
+fi
+
+# Dispatch
+ssh-add $HOME/.ssh/keys/$TYPE/$HANDLE