How can I make ssh-copy-id use a port other than 22?

Solution 1:

I use this command, note the quotes:

ssh-copy-id -i ~/.ssh/id_dsa.pub "user@host -p 6842"

Solution 2:

Set the port to use in ~/.ssh/config like the following:

Host secret-host.example.com
Port 2222

Solution 3:

Try this:

ssh-copy-id "user@host -p 8888"