From b6d85b04286d30498a11aaac36e75032b1e72801 Mon Sep 17 00:00:00 2001 From: jonas Date: Sat, 10 Jun 2006 18:18:37 +0000 Subject: Added all work so far... git-svn-id: svn+ssh://xayide/home/jonas/private_svn/fleshybrid/trunk@2 8f53b18a-e215-0410-8885-9f593d34873e --- addons/x11infoscreen/usr/local/bin/mksshauth | 68 ++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 addons/x11infoscreen/usr/local/bin/mksshauth (limited to 'addons/x11infoscreen/usr/local/bin/mksshauth') 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 +# Copyright 2002 Juri Jensen & Jonas Smedegaard +# +# $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" -- cgit v1.2.3