[patch] ssh-copy-id: improve error reporting with -i and documentation
Ben Pfaff
blp at cs.stanford.edu
Fri Aug 28 02:00:38 EST 2009
The "ssh-copy-id" program requires that the argument to -i end in
.pub, by appending that extension itself if it is missing. But
if the file with .pub appended does not exist, ssh-copy-id
reports the misleading message "ERROR: No identities found".
This patch improves the error message by mentioning the name of
the actual file that does not exist.
Also, document that the argument of -i must end in .pub or that
.pub will be appended automatically.
Index: contrib/ssh-copy-id
===================================================================
RCS file: /cvs/openssh/contrib/ssh-copy-id,v
retrieving revision 1.7
diff -u -p -r1.7 ssh-copy-id
--- contrib/ssh-copy-id 21 Jan 2009 09:29:21 -0000 1.7
+++ contrib/ssh-copy-id 27 Aug 2009 15:57:49 -0000
@@ -18,6 +18,10 @@ if [ "-i" = "$1" ]; then
fi
shift # and this should leave $1 as the target name
fi
+ if [ ! -e "$ID_FILE" ]; then
+ echo "$0: ERROR: $ID_FILE does not exist" >&2
+ exit 1
+ fi
else
if [ x$SSH_AUTH_SOCK != x ] ; then
GET_ID="$GET_ID ssh-add -L"
Index: contrib/ssh-copy-id.1
===================================================================
RCS file: /cvs/openssh/contrib/ssh-copy-id.1,v
retrieving revision 1.3
diff -u -p -r1.3 ssh-copy-id.1
--- contrib/ssh-copy-id.1 21 Jan 2009 09:29:21 -0000 1.3
+++ contrib/ssh-copy-id.1 27 Aug 2009 15:57:49 -0000
@@ -45,6 +45,10 @@ option is given then the identity file (
.BR ~/.ssh/id_rsa.pub )
is used, regardless of whether there are any keys in your
.BR ssh-agent .
+The extension
+.B .pub
+is automatically appended to the identity file's name if it does not
+already end with that extension.
Otherwise, if this:
.PP
.B " ssh-add -L"
--
Ben Pfaff
http://benpfaff.org
More information about the openssh-unix-dev
mailing list