blob: 4859cac39ae769a5bffe403d480665480a1cde2c (
plain)
- #!/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.3 2002-12-03 16:35:45 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"
|