summaryrefslogtreecommitdiff
path: root/mksshauth
blob: f6b688eb9fe83e7aa5f1e607822ba1fc8ce64199 (plain)
  1. #!/bin/bash
  2. ssh_version=$1
  3. host=$2
  4. case "$ssh_version" in
  5. 1)
  6. [ -f ~/.ssh/identity.pub ] || ssh-keygen
  7. ssh $host "mkdir -p ~/.ssh && echo `cat ~/.ssh/identity.pub` >> ~/.ssh/authorized_keys"
  8. ;;
  9. 2|dsa)
  10. [ -f ~/.ssh/id_dsa.pub ] || ssh-keygen -t dsa
  11. ssh $host "mkdir -p ~/.ssh && echo `cat ~/.ssh/id_dsa.pub` >> ~/.ssh/authorized_keys2"
  12. ;;
  13. rsa)
  14. [ -f ~/.ssh/id_rsa.pub ] || ssh-keygen -t rsa
  15. ssh $host "mkdir -p ~/.ssh && echo `cat ~/.ssh/id_rsa.pub` >> ~/.ssh/authorized_keys2"
  16. ;;
  17. *)
  18. echo "Usage: $(basename $0) 1|2|dsa|rsa [user@]host"
  19. exit 1
  20. ;;
  21. esac