aboutsummaryrefslogtreecommitdiff
path: root/ssh-agent-loadkey
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-12-10 10:59:25 -0200
committerSilvio Rhatto <rhatto@riseup.net>2018-12-10 10:59:25 -0200
commitd6cc496425b2e7386a2702a35bd2a5a84d1fd24b (patch)
treeed08d8e3177dae0a2d0762ca655631f8da46e012 /ssh-agent-loadkey
parent90e689a65f2d6029979753b98b3da3eff4510c26 (diff)
downloadutils-ssh-d6cc496425b2e7386a2702a35bd2a5a84d1fd24b.tar.gz
utils-ssh-d6cc496425b2e7386a2702a35bd2a5a84d1fd24b.tar.bz2
Adds ssh-agent-loadkey
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