Ticket #38122: ssh-copy-id.diff

File ssh-copy-id.diff, 1.1 KB (added by cooljeanius (Eric Gallager), 12 years ago)

diff between the two ssh-copy-id scripts

  • bin/ssh-copy-id

    old new  
    1 #!/bin/sh
     1#!/bin/bash
    22
    33# Shell script to install your public key on a remote machine
    44# Takes the remote machine name as an argument.
     
    2525fi
    2626
    2727if [ -z "`eval $GET_ID`" ] && [ -r "${ID_FILE}" ] ; then
    28   GET_ID="cat \"${ID_FILE}\""
     28  GET_ID="cat ${ID_FILE}"
    2929fi
    3030
    3131if [ -z "`eval $GET_ID`" ]; then
     
    3838  exit 1
    3939fi
    4040
    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
    4542
    4643cat <<EOF
    47 Now try logging into the machine, with "ssh '$host'", and check in:
     44Now try logging into the machine, with "ssh '${1%:}'", and check in:
    4845
    49   ~/.ssh/authorized_keys
     46  .ssh/authorized_keys
    5047
    5148to make sure we haven't added extra keys that you weren't expecting.
    5249
    5350EOF
    54