aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/ssh-copy-id
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2014-04-28 07:50:45 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2014-04-28 07:50:45 +0000
commit3b8f08459569bf0faa21473e5cec2491e95c9349 (patch)
tree80f45dd81ca716bcd7ca9674581e1fc40b93cd34 /usr.bin/ssh-copy-id
parent9d2ab4a62d6733c45958627ac113bdbd818d1e2a (diff)
parentb2ba55951383498f252746f618d513139da06e8e (diff)
downloadsrc-3b8f08459569bf0faa21473e5cec2491e95c9349.tar.gz
src-3b8f08459569bf0faa21473e5cec2491e95c9349.zip
Merge head
Notes
Notes: svn path=/projects/bmake/; revision=265044
Diffstat (limited to 'usr.bin/ssh-copy-id')
-rw-r--r--usr.bin/ssh-copy-id/ssh-copy-id.111
-rwxr-xr-xusr.bin/ssh-copy-id/ssh-copy-id.sh14
2 files changed, 19 insertions, 6 deletions
diff --git a/usr.bin/ssh-copy-id/ssh-copy-id.1 b/usr.bin/ssh-copy-id/ssh-copy-id.1
index 2c95d5a69ec3..b22c323d9e11 100644
--- a/usr.bin/ssh-copy-id/ssh-copy-id.1
+++ b/usr.bin/ssh-copy-id/ssh-copy-id.1
@@ -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,
diff --git a/usr.bin/ssh-copy-id/ssh-copy-id.sh b/usr.bin/ssh-copy-id/ssh-copy-id.sh
index 94429de1bad1..e16cfaa8456a 100755
--- a/usr.bin/ssh-copy-id/ssh-copy-id.sh
+++ b/usr.bin/ssh-copy-id/ssh-copy-id.sh
@@ -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
}
@@ -46,6 +46,9 @@ sendkey() {
printf "$alg $key $comment\n" >> "$keyfile" ; \
fi ; \
done \
+ if [ -x /sbin/restorecon ]; then \
+ /sbin/restorecon -F "$HOME/.ssh/" "$keyfile" >/dev/null 2>&1 || true ; \
+ fi
'\'
}
@@ -64,11 +67,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 +90,9 @@ while getopts 'i:lo:p:' arg; do
o)
options=$options$nl-o$nl$OPTARG
;;
+ v)
+ options="$options$nl-v"
+ ;;
*)
usage
;;