ssh-copy-id with nonstandard sshd port
- UPDATE: modern ssh-copy-id often support a -p parameter for the port. So this trick is unnecessary and won't probably work.
ssh-copy-id is a cool script which is usually distributed along openssh client nowadays;
it performs an automatic install of your local public SSH key to a remote server. Its syntax is simply:
ssh-copy-id [-i [identity_file]] [user@]machine
You may have spotted there's no builtin way of telling it what's the port of the remote server; a workaround exists which leverages
the way arguments are passed to the script (it's a simple bash file, take a look at it. You can find various versions around the internet).
Just do this:
ssh-copy-id '-p [port_number] [-i [identity_file]] [user@]machine'
And enjoy your newly-added SSH key!