blob: f6b688eb9fe83e7aa5f1e607822ba1fc8ce64199 (
plain)
- #!/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
|