]> andersk Git - openssh.git/blobdiff - contrib/ssh-copy-id
- djm@cvs.openbsd.org 2003/11/21 11:57:03
[openssh.git] / contrib / ssh-copy-id
index 0ab37cae484433813c86f1df53c770f194f5523c..a1ad34a8d421a817175e7588003ef2cd51399ff3 100644 (file)
@@ -29,11 +29,16 @@ if [ -z "`eval $GET_ID`" -a -r "${ID_FILE}" ] ; then
 fi
 
 if [ -z "`eval $GET_ID`" ]; then
-  echo "$0: ERROR: No identities found"
+  echo "$0: ERROR: No identities found" >&2
   exit 1
 fi
 
-{ eval "$GET_ID" ; } | ssh $1 "test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys ; chmod g-w . .ssh .ssh/authorized_keys"
+if [ "$#" -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
+  echo "Usage: $0 [-i [identity_file]] [user@]machine" >&2
+  exit 1
+fi
+
+{ eval "$GET_ID" ; } | ssh $1 "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys"
 
 cat <<EOF
 Now try logging into the machine, with "ssh '$1'", and check in:
This page took 0.033299 seconds and 4 git commands to generate.