Is it possible to run ssh-copy-id on port other than 22?
$ ssh-copy-id "-p 8129 user@host"
Source: http://it-ride.blogspot.com/2009/11/use-ssh-copy-id-on-different-port.html
NOTE: The port must be in front of the user@host or it will not resolve
Editor's note: as pointed out in comments and shown in other answers, ssh-copy-id
as shipped by more recent versions of OpenSSH supports the -p <port_number>
syntax (no quotes needed).
ssh-copy-id
doesn't take any arguments that it could pass down to the underlying ssh
command, but you can configure an alias in ~/.ssh/config
.
Host myhost
HostName hostname
Port 8129
Then run ssh-copy-id myhost
.
As of openssh-client_6.2 there is now a dedicated port flag for the command allowing for this syntax:
ssh-copy-id -p 8129 user@example
It also added support for adding other ssh options with the -o flag.
Here's is Ubuntu's man page for the appropriate version, introduced in 13.04: http://manpages.ubuntu.com/manpages/saucy/man1/ssh-copy-id.1.html