Ticket #38122: ssh-copy-id.diff
File ssh-copy-id.diff, 1.1 KB (added by cooljeanius (Eric Gallager), 12 years ago) |
---|
-
bin/ssh-copy-id
old new 1 #!/bin/ sh1 #!/bin/bash 2 2 3 3 # Shell script to install your public key on a remote machine 4 4 # Takes the remote machine name as an argument. … … 25 25 fi 26 26 27 27 if [ -z "`eval $GET_ID`" ] && [ -r "${ID_FILE}" ] ; then 28 GET_ID="cat \"${ID_FILE}\""28 GET_ID="cat ${ID_FILE}" 29 29 fi 30 30 31 31 if [ -z "`eval $GET_ID`" ]; then … … 38 38 exit 1 39 39 fi 40 40 41 # strip any trailing colon 42 host=`echo $1 | sed 's/:$//'` 43 44 { eval "$GET_ID" ; } | ssh $host "umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ~/.ssh/authorized_keys" || exit 1 41 { eval "$GET_ID" ; } | ssh ${1%:} "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys" || exit 1 45 42 46 43 cat <<EOF 47 Now try logging into the machine, with "ssh '$ host'", and check in:44 Now try logging into the machine, with "ssh '${1%:}'", and check in: 48 45 49 ~/.ssh/authorized_keys46 .ssh/authorized_keys 50 47 51 48 to make sure we haven't added extra keys that you weren't expecting. 52 49 53 50 EOF 54