Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Feb 2014 18:08:10 -0500
From:      Eitan Adler <eadler@freebsd.org>
To:        Mark Felder <feld@freebsd.org>
Cc:        freebsd-stable <freebsd-stable@freebsd.org>
Subject:   Re: ssh-copy-id
Message-ID:  <CAF6rxg=SBno64BpmxcvddQFpnAePFHKZ%2B1kp1a%2BAY5F6-xQsMA@mail.gmail.com>
In-Reply-To: <1393625741.9928.89141917.3B723B0F@webmail.messagingengine.com>
References:  <2cba8fd9cc51dedc1bd5e127046f4ab7@dweimer.net> <1393618827.9046.89104957.4A974C56@webmail.messagingengine.com> <ea6804d070e9b2e4393eaca2fa45d938@dweimer.net> <1393625741.9928.89141917.3B723B0F@webmail.messagingengine.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 28 February 2014 17:15, Mark Felder <feld@freebsd.org> wrote:
....

> In my opinion, if I'm using an ssh utility and I specify "-i" flag it
> should be the private key.

Hey all,

Sorry about the confusion ssh-copy-id has caused you.

Does the following patch help ?


Index: ssh-copy-id.1
===================================================================
--- ssh-copy-id.1	(revision 262539)
+++ ssh-copy-id.1	(working copy)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 11, 2012
+.Dd Feburary 28, 2014
 .Dt SSH-COPY-ID 1
 .Os
 .Sh NAME
@@ -33,7 +33,7 @@
 .Nd copy public keys to a remote host
 .Sh SYNOPSIS
 .Nm
-.Op Fl l
+.Op Fl lv
 .Op Fl i Ar keyfile
 .Op Fl o Ar option
 .Op Fl p Ar port
@@ -48,12 +48,14 @@ file (creating the file and directory, if required
 The following options are available:
 .Bl -tag -width indent
 .It Fl i Ar file
-Copy the key contained in
+Copy the public key contained in
 .Ar file .
 This option can be specified multiple times and can be combined with
 the
 .Fl l
 option.
+If a private key is specified and a public key is found then the public key
+will be used.
 .It Fl l
 Copy the keys currently held by
 .Xr ssh-agent 1 .
@@ -67,6 +69,9 @@ This option can be specified multiple times.
 .It Fl p Ar port
 Connect to the specified port on the remote host instead of the
 default.
+.It Fl v
+Pass -v to
+.Xr ssh 1 .
 .El
 .Pp
 The remaining arguments are a list of remote hosts to connect to,
Index: ssh-copy-id.sh
===================================================================
--- ssh-copy-id.sh	(revision 262539)
+++ ssh-copy-id.sh	(working copy)
@@ -28,7 +28,7 @@
 # $FreeBSD$

 usage() {
-	echo "usage: ssh-copy-id [-l] [-i keyfile] [-o option] [-p port]
[user@]hostname" >&2
+	echo "usage: ssh-copy-id [-lv] [-i keyfile] [-o option] [-p port]
[user@]hostname" >&2
 	exit 1
 }

@@ -64,11 +64,14 @@ options=""

 IFS=$nl

-while getopts 'i:lo:p:' arg; do
+while getopts 'i:lo:p:v' arg; do
 	case $arg in
 	i)	
 		hasarg="x"
-		if [ -r "$OPTARG" ]; then
+		if [ -r "${OPTARG}.pub" ]; then
+			echo helo
+			keys="$(cat -- "${OPTARG}.pub")$nl$keys"
+		elif [ -r "$OPTARG" ]; then
 			keys="$(cat -- "$OPTARG")$nl$keys"
 		else
 			echo "File $OPTARG not found" >&2
@@ -85,6 +88,9 @@ IFS=$nl
 	o)	
 		options=$options$nl-o$nl$OPTARG
 		;;
+	v)
+		options="$options$nl-v"
+		;;
 	*)	
 		usage
 		;;


-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAF6rxg=SBno64BpmxcvddQFpnAePFHKZ%2B1kp1a%2BAY5F6-xQsMA>