]> andersk Git - openssh.git/blobdiff - contrib/ssh-copy-id
- (tim) [configure.ac sshd.8] Enable locked account check (a "*LK*" string)
[openssh.git] / contrib / ssh-copy-id
index 2346761f7af0e6ed84922fe921d596a1b5f1aae5..1555b5d376c6bd115b3ef9c9e646e27144ac7084 100644 (file)
@@ -24,16 +24,21 @@ 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
 
 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 "umask 077; test -d .ssh || mkdir .ssh ; cat >> .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" || exit 1
 
 cat <<EOF
 Now try logging into the machine, with "ssh '$1'", and check in:
This page took 1.59986 seconds and 4 git commands to generate.