Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Mar 2014 03:17:47 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r262645 - head/usr.bin/ssh-copy-id
Message-ID:  <201403010317.s213Hl1w034937@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Sat Mar  1 03:17:46 2014
New Revision: 262645
URL: http://svnweb.freebsd.org/changeset/base/262645

Log:
  ssh-copy-id: avoid sending private keys; add -v option
  
  To help avoid confusion: when attempting to send a key file check to see if a
  file of the same name exists with a '.pub' suffix and send that instead.  This
  mimics the behavior of other ssh-copy-id scripts.
  
  Add -v passthrough.
  
  Reported by:	dweimer <dweimer@dweimer.net>
  Reported by:	feld
  MFC After:	1 week

Modified:
  head/usr.bin/ssh-copy-id/ssh-copy-id.1
  head/usr.bin/ssh-copy-id/ssh-copy-id.sh

Modified: head/usr.bin/ssh-copy-id/ssh-copy-id.1
==============================================================================
--- head/usr.bin/ssh-copy-id/ssh-copy-id.1	Sat Mar  1 03:11:26 2014	(r262644)
+++ head/usr.bin/ssh-copy-id/ssh-copy-id.1	Sat Mar  1 03:17:46 2014	(r262645)
@@ -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, i
 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 ti
 .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,

Modified: head/usr.bin/ssh-copy-id/ssh-copy-id.sh
==============================================================================
--- head/usr.bin/ssh-copy-id/ssh-copy-id.sh	Sat Mar  1 03:11:26 2014	(r262644)
+++ head/usr.bin/ssh-copy-id/ssh-copy-id.sh	Sat Mar  1 03:17:46 2014	(r262645)
@@ -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,13 @@ 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
+			keys="$(cat -- "${OPTARG}.pub")$nl$keys"
+		elif [ -r "$OPTARG" ]; then
 			keys="$(cat -- "$OPTARG")$nl$keys"
 		else
 			echo "File $OPTARG not found" >&2
@@ -85,6 +87,9 @@ while getopts 'i:lo:p:' arg; do
 	o)	
 		options=$options$nl-o$nl$OPTARG
 		;;
+	v)
+		options="$options$nl-v"
+		;;
 	*)	
 		usage
 		;;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403010317.s213Hl1w034937>