ssh-copy-id is a dedicated tool to set up public key authentication via ssh between two linux machines. You will get a problem, if the ssh daemon is listening on a different port (for example: 2222). The standard ssh-copy-id command in Ubuntu Linux doesn’t support a custom SSH port. According to the man page there are only a few parameters available:
Hint: ssh-copy-id and different ssh port
Reply