I have a server with SSH running on a non-standard port. Instead of 22, it runs on 8129. To log in, I use:
ssh -p 8129 hostname
Now, whenever I need to set up a key for password-less login, I have to copy the public key and add it to authorized_keys manually. I discovered that the command ssh-copy-id
could be used to simplify this process, but it seems like it does not have an option to specify the port of the ssh server.
Is there some way to tell ssh-copy-id
to use port 8129, or should I just forget about this command and copy/paste manually as before?
ssh
has syntaxssh -p 1234 user@host
,ssh-copy-id "-p 1234 user@host"
and finallyscp -P 1234 user@host
. It would be so nice to have the same syntax. – Tombart Feb 04 '15 at 12:58rsync -e "ssh -p 1234" user@host
. I swear it's more hassle than it's worth using a custom port. – garetmckinley Sep 25 '15 at 04:10ssh-copy-id "root@192.168.0.100 -p 12345" -i ~/.ssh/id_rsa.pub 192.168.0.100
– degenerate Dec 02 '17 at 02:40ssh-copy-id -p 8129 user@host
works. – Arjun Mehta May 21 '18 at 15:57ssh-copy-id -i ~/.ssh/id_rsa -p 22222 user@192.168.0.1
– noname Jul 17 '21 at 19:02-i
paramter if you just have 1 ssh id :ssh-copy-id -p {PORT} {USER}@{HOST}
, – Luke Jan 16 '23 at 03:52ssh-copy-id "-p 1234" user@host
– Nassim Bentarka Dec 03 '23 at 23:04