RFC: ssh-copy-id tweaks

This is a discussion on RFC: ssh-copy-id tweaks within the OpenSSH Development forums, part of the Networking and Network Related category; I'd like to propose a couple of tweaks to ssh-copy-id: o Change the default ID_FILE from identity....


Go Back   Usenet Forums > Networking and Network Related > OpenSSH Development

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-31-2008
Nick Dokos
 
Posts: n/a
Default RFC: ssh-copy-id tweaks

I'd like to propose a couple of tweaks to ssh-copy-id:

o Change the default ID_FILE from identity.pub to id_dsa.pub or perhaps
{id_dsa,id_rsa,identity}.pub to cover all the bases, although the
patch below deals only with id_dsa.pub - it would need some more
tweaking to deal with more than one (possibly non-existent) file.

o If the destination authorized_keys file already contains the keys,
they should not be duplicated. I use ssh-copy-id in a regression harness
and I end up adding the same key tens or hundreds of times. I have not
seen any problem but it is somewhat distasteful.

The method proposed is frankly a hack, but it is simple and I think it
is foolproof and portable. At least initially, it will mess up the
order of the keys, but given that the file is mostly write-only by
humans, that should not make any difference.

Comments?

Thanks,
Nick

--- ssh-copy-id.orig 2008-01-31 12:01:03.000000000 -0500
+++ ssh-copy-id 2008-01-31 12:05:16.000000000 -0500
@@ -1,11 +1,11 @@
#!/bin/sh

-# Shell script to install your identity.pub on a remote machine
+# Shell script to install your id_dsa.pub on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.

-ID_FILE="${HOME}/.ssh/identity.pub"
+ID_FILE="${HOME}/.ssh/id_dsa.pub"

if [ "-i" = "$1" ]; then
shift
@@ -38,7 +38,7 @@
exit 1
fi

-{ eval "$GET_ID" ; } | ssh $1 "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys" || exit 1
+{ eval "$GET_ID" ; } | ssh $1 "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys && sort -u -o .ssh/authorized_keys .ssh/authorized_keys" || exit 1

cat <<EOF
Now try logging into the machine, with "ssh '$1'", and check in:



_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/li...enssh-unix-dev
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:39 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0