blob: cbbcb50ae6d78cf90cc6a5287dadfddaec53dff0 (
plain)
- #!/bin/bash
- #
- # /usr/local/bin/mksshauth
- # Copyright 2001-2002 Juri Jensen <juri@xenux.dk> & Jonas Smedegaard <dr@jones.dk>
- #
- # $Id: mksshauth,v 1.2 2002-12-03 16:33:01 jonas Exp $
- #
- # Setup local and remote SSH for non-interactive authorization
- #
- set -e
- prg=`basename $0`
- keytype=$1
- host=$2
- case "$keytype" in
- 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 "Usage: $prg 1|2|dsa|rsa [user@]host"
- exit 1
- ;;
- esac
- [ -f ~/.ssh/$id_file ] || ssh-keygen -t $keytype
- ssh $host "mkdir -p ~/.ssh && echo `cat ~/.ssh/$id_file` >> ~/.ssh/$auth_file"
|