Bugzilla – Attachment 2345 Details for
Bug 2110
ssh-copy-id fails on nonexisting private key
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
add a '-l' option for a legacy mode
0001-bz-2110-add-l-option-for-a-legacy-mode.patch (text/plain), 3.32 KB, created by
Petr Lautrbach
on 2013-10-07 20:21:48 AEDT
(
hide
)
Description:
add a '-l' option for a legacy mode
Filename:
MIME Type:
Creator:
Petr Lautrbach
Created:
2013-10-07 20:21:48 AEDT
Size:
3.32 KB
patch
obsolete
>From ae1e76f5f70e8d9ba76042430961561841f37461 Mon Sep 17 00:00:00 2001 >From: Petr Lautrbach <plautrba@redhat.com> >Date: Mon, 7 Oct 2013 11:14:22 +0200 >Subject: [PATCH] bz#2110 add: '-l' option for a legacy mode > >--- > contrib/ssh-copy-id | 20 ++++++++++++++++---- > contrib/ssh-copy-id.1 | 5 +++++ > 2 files changed, 21 insertions(+), 4 deletions(-) > >diff --git a/contrib/ssh-copy-id b/contrib/ssh-copy-id >index ae88e99..b7feecc 100644 >--- a/contrib/ssh-copy-id >+++ b/contrib/ssh-copy-id >@@ -59,7 +59,7 @@ fi > DEFAULT_PUB_ID_FILE=$(ls -t ${HOME}/.ssh/id*.pub 2>/dev/null | grep -v -- '-cert.pub$' | head -n 1) > > usage () { >- printf 'Usage: %s [-h|-?|-n] [-i [identity_file]] [-p port] [[-o <ssh -o options>] ...] [user@]hostname\n' "$0" >&2 >+ printf 'Usage: %s [-h|-?|-l|-n] [-i [identity_file]] [-p port] [[-o <ssh -o options>] ...] [user@]hostname\n' "$0" >&2 > exit 1 > } > >@@ -77,7 +77,7 @@ use_id_file() { > PUB_ID_FILE="$L_ID_FILE.pub" > fi > >- PRIV_ID_FILE=$(dirname "$PUB_ID_FILE")/$(basename "$PUB_ID_FILE" .pub) >+ [ "$LEGACY" ] || PRIV_ID_FILE=$(dirname "$PUB_ID_FILE")/$(basename "$PUB_ID_FILE" .pub) > > # check that the files are readable > for f in $PUB_ID_FILE $PRIV_ID_FILE ; do >@@ -121,6 +121,11 @@ do > } > shift > ;; >+ -l) >+ OPT="$1" >+ OPTARG= >+ shift >+ ;; > -n|-h|-\?) > OPT="$1" > OPTARG= >@@ -154,6 +159,9 @@ do > -o|-p) > SSH_OPTS="${SSH_OPTS:+$SSH_OPTS }$OPT '$(quote "$OPTARG")'" > ;; >+ -l) >+ LEGACY=1 >+ ;; > -n) > DRY_RUN=1 > ;; >@@ -243,7 +251,7 @@ populate_new_ids() { > printf '%s: INFO: %d key(s) remain to be installed -- if you are prompted now it is to install the new keys\n' "$0" "$(printf '%s\n' "$NEW_IDS" | wc -l)" >&2 > } > >-REMOTE_VERSION=$(ssh -v -o PreferredAuthentications=',' "$@" 2>&1 | >+[ "$LEGACY" ] || REMOTE_VERSION=$(ssh -v -o PreferredAuthentications=',' "$@" 2>&1 | > sed -ne 's/.*remote software version //p') > > case "$REMOTE_VERSION" in >@@ -268,7 +276,11 @@ case "$REMOTE_VERSION" in > ;; > *) > # Assuming that the remote host treats ~/.ssh/authorized_keys as one might expect >- populate_new_ids 0 >+ if [ "$LEGACY" ]; then >+ NEW_IDS=`eval "$GET_ID"` >+ else >+ populate_new_ids 0 >+ fi > [ "$DRY_RUN" ] || printf '%s\n' "$NEW_IDS" | ssh "$@" " > umask 077 ; > mkdir -p .ssh && cat >> .ssh/authorized_keys || exit 1 ; >diff --git a/contrib/ssh-copy-id.1 b/contrib/ssh-copy-id.1 >index 67a59e4..37c5b0a 100644 >--- a/contrib/ssh-copy-id.1 >+++ b/contrib/ssh-copy-id.1 >@@ -29,6 +29,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > .Nd use locally available keys to authorise logins on a remote machine > .Sh SYNOPSIS > .Nm >+.Op Fl l > .Op Fl n > .Op Fl i Op Ar identity_file > .Op Fl p Ar port >@@ -76,6 +77,10 @@ is used. > Note that this can be used to ensure that the keys copied have the > comment one prefers and/or extra options applied, by ensuring that the > key file has these set as preferred before the copy is attempted. >+.It Fl l >+run in a legacy mode. In this mode, the ssh-copy-id doesn't check an >+existence of a private key and doesn't do remote checks of the remote >+server versions or if public keys are already installed. > .It Fl n > do a dry-run. Instead of installing keys on the remote system simply > prints the key(s) that would have been installed. >-- >1.8.3.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2110
: 2345