diff options
author | jonas <jonas@8f53b18a-e215-0410-8885-9f593d34873e> | 2006-06-10 18:18:37 +0000 |
---|---|---|
committer | jonas <jonas@8f53b18a-e215-0410-8885-9f593d34873e> | 2006-06-10 18:18:37 +0000 |
commit | b6d85b04286d30498a11aaac36e75032b1e72801 (patch) | |
tree | 2fc597a2ae2cf69a5cc6b3e7162f02f89613b08d /addons/x11infoscreen/usr/local/bin/mksshauth | |
parent | 369cb1e5a343ec9e7c6f05de64f0eb102488d77f (diff) |
Added all work so far...
git-svn-id: svn+ssh://xayide/home/jonas/private_svn/fleshybrid/trunk@2 8f53b18a-e215-0410-8885-9f593d34873e
Diffstat (limited to 'addons/x11infoscreen/usr/local/bin/mksshauth')
-rwxr-xr-x | addons/x11infoscreen/usr/local/bin/mksshauth | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/addons/x11infoscreen/usr/local/bin/mksshauth b/addons/x11infoscreen/usr/local/bin/mksshauth new file mode 100755 index 0000000..9d7c44c --- /dev/null +++ b/addons/x11infoscreen/usr/local/bin/mksshauth @@ -0,0 +1,68 @@ +#!/bin/sh +# +# /usr/local/bin/mksshauth +# Copyright 2000-2001 Juri Jensen <juri@xenux.dk> +# Copyright 2002 Juri Jensen <juri@xenux.dk> & Jonas Smedegaard <dr@jones.dk> +# +# $Id: mksshauth,v 1.5 2003/03/24 12:08:47 jonas Exp $ +# +# Setup local and remote SSH for non-interactive authorization +# + +set -e + +prg=`basename $0` + +if [ $# \< 1 ]; then + echo "ERROR: Wrong arguments! (Use '$prg --help' for help)" + exit 1 +fi +keytype=$1 +shift + +case "$keytype" in + --help|-h) + echo "$prg: Setup local and remote SSH for non-interactive authorization." + echo + echo "Usage: $prg keytype [user@]host [options]" + echo + echo "Options:" + echo " keytype: SSH key type, either rsa1, rsa, dsa, 1 or 2." + echo " rsa1 is for SSHv1, rsa and dsa is for SSHv2. 1 and 2 are" + echo " aliases for rsa1 and dsa. dsa (or 2) is recommended." + echo " user: User id on remote host. Default is same as local user." + echo " host: Hostname of remote host." + echo " options: Options to prepend the authorization key (read 'man sshd')." + exit 0 + ;; + 1|rsa1) + keytype=rsa1 + id_file=identity.pub + auth_file=authorized_keys + ;; + 2|dsa) + keytype=dsa + id_file=id_dsa.pub + auth_file=authorized_keys2 + ;; + rsa) + keytype=rsa + id_file=id_rsa.pub + auth_file=authorized_keys2 + ;; + *) + echo "ERROR: Wrong keytype! (Use '$prg --help' for help)" + exit 1 + ;; +esac + +host=$1 +shift +options=$@ + +if [ -n "$options" ]; then + options="$options " +fi + +[ -f ~/.ssh/$id_file ] || ssh-keygen -t $keytype +ssh $host "mkdir -p ~/.ssh && echo '$options'`cat ~/.ssh/$id_file` >> ~/.ssh/$auth_file" |