summaryrefslogtreecommitdiff
path: root/mksshauth
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2002-02-28 14:09:04 +0000
committerJonas Smedegaard <dr@jones.dk>2002-02-28 14:09:04 +0000
commitcafcd5d4368e57f162a641ed3f4835ecb5a6d391 (patch)
tree56166fbf16289d8b388cf0f1f9b51e28c3c4bdf9 /mksshauth
Initial revision
Diffstat (limited to 'mksshauth')
-rwxr-xr-xmksshauth23
1 files changed, 23 insertions, 0 deletions
diff --git a/mksshauth b/mksshauth
new file mode 100755
index 0000000..f6b688e
--- /dev/null
+++ b/mksshauth
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+ssh_version=$1
+host=$2
+
+case "$ssh_version" in
+ 1)
+ [ -f ~/.ssh/identity.pub ] || ssh-keygen
+ ssh $host "mkdir -p ~/.ssh && echo `cat ~/.ssh/identity.pub` >> ~/.ssh/authorized_keys"
+ ;;
+ 2|dsa)
+ [ -f ~/.ssh/id_dsa.pub ] || ssh-keygen -t dsa
+ ssh $host "mkdir -p ~/.ssh && echo `cat ~/.ssh/id_dsa.pub` >> ~/.ssh/authorized_keys2"
+ ;;
+ rsa)
+ [ -f ~/.ssh/id_rsa.pub ] || ssh-keygen -t rsa
+ ssh $host "mkdir -p ~/.ssh && echo `cat ~/.ssh/id_rsa.pub` >> ~/.ssh/authorized_keys2"
+ ;;
+ *)
+ echo "Usage: $(basename $0) 1|2|dsa|rsa [user@]host"
+ exit 1
+ ;;
+esac