ssh-copy-id enhancement 2013-01-01

Ángel González keisial at
Mon Jan 7 08:52:30 EST 2013

On 01/01/13 16:39, Aaron Burgemeister wrote:
> I and others have enjoyed using the ssh-copy-id script for most systems,
> but when port numbers on target systems are changed it goes from being
> trivial to use to requiring a decent knowledge of how to set target ports
> on the client side in other ways (for example, ~/.ssh/config or something
> like that).  Since these cases are the exception it'd be nice if
> ssh-copy-id could handle alternate ports from the calling command like
> 'ssh' and 'scp' (and others) do.  To this end I am attaching a unified-diff
> file with changes that implement this.  I've done basic testing on systems
> both with and without alternate ports and believe it works fairly well.
> For the forum thread that started all of this (finally convinced me to fix
> it for myself too) see the following from openSUSE, if interested:
> I built this against the ssh-copy-id file in ./openssh/contrib from cvs,
> though the script exactly matches (compared via checksum) the one that
> openSUSE 12.2 ships as well.  I also attached the modified script just in
> case I somehow unified-diff'd incorrectly (I'm not a programmer by trade;
> it's possible/likely I fouled something up).
> Happy New Year,
> Aaron Burgemeister
Happy New Year, Aaron.

The mailing list stripped your attachment (not sent with a text/plain
mimetype ?), but it's
probably the one at

I recommend you to send it as a unified diff. It looks good, but I would
have added the new option it *before* the host name.

Interestingly, you can make ssh-copy-id work with a non-standard port by
abusing the hostname field:
>  $ ssh-copy-id "-p 54545 apogee at apogee.suse.lst"

More information about the openssh-unix-dev mailing list