X-Git-Url: http://andersk.mit.edu/gitweb/gssapi-openssh.git/blobdiff_plain/9cb1827beb97ef775b73d81402cc084ec8c316a3..f97edba64d1fb2b28ac269fe588396643d271b7b:/openssh/contrib/ssh-copy-id diff --git a/openssh/contrib/ssh-copy-id b/openssh/contrib/ssh-copy-id index a1ad34a..df74d25 100644 --- a/openssh/contrib/ssh-copy-id +++ b/openssh/contrib/ssh-copy-id @@ -1,17 +1,17 @@ #!/bin/sh -# Shell script to install your identity.pub on a remote machine +# Shell script to install your public key on a remote machine # Takes the remote machine name as an argument. # Obviously, the remote machine must accept password authentication, # or one of the other keys in your ssh-agent, for this to work. -ID_FILE="${HOME}/.ssh/identity.pub" +ID_FILE="${HOME}/.ssh/id_rsa.pub" if [ "-i" = "$1" ]; then shift # check if we have 2 parameters left, if so the first is the new ID file if [ -n "$2" ]; then - if expr "$1" : ".*\.pub" ; then + if expr "$1" : ".*\.pub" > /dev/null ; then ID_FILE="$1" else ID_FILE="$1.pub" @@ -24,7 +24,7 @@ else fi fi -if [ -z "`eval $GET_ID`" -a -r "${ID_FILE}" ] ; then +if [ -z "`eval $GET_ID`" ] && [ -r "${ID_FILE}" ] ; then GET_ID="cat ${ID_FILE}" fi @@ -38,7 +38,7 @@ if [ "$#" -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then exit 1 fi -{ eval "$GET_ID" ; } | ssh $1 "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys" +{ eval "$GET_ID" ; } | ssh $1 "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys" || exit 1 cat <