aboutsummaryrefslogtreecommitdiff
path: root/ssh-agent-loadkey
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-agent-loadkey')
-rwxr-xr-xssh-agent-loadkey21
1 files changed, 21 insertions, 0 deletions
diff --git a/ssh-agent-loadkey b/ssh-agent-loadkey
new file mode 100755
index 0000000..610f10b
--- /dev/null
+++ b/ssh-agent-loadkey
@@ -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