ssh-copy-id different port

5,403
$ ssh-copy-id
Usage: /usr/bin/ssh-copy-id [-h|-?|-n] [-i [identity_file]] [-p port] [[-o <ssh -o options>] ...] [user@]hostname

So in your case simply use:

$ ssh-copy-id -i ~/.ssh/id_rsa.pub -p 22001 [email protected]

Because of your usage of quotes, the -p 22001 part became part of the hostname which explains the error you got.

Share:
5,403

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    i am trying execute ssh-copy-id in one port different than 22 (default). I researched and found the command below

    $ssh-copy-id -i ~/.ssh/id_rsa.pub "[email protected] -p 22001"

    but, when execute the command, i got this error:

    /usr/bin/ssh-copy-id: ERROR: ssh: connect to host 192.168.0.1 -p 22001 port 22: Connection refuse

    It seems that command dont understand the port.

    • Арсений Черенков
      Арсений Черенков about 9 years
      quote (") are not needed. what you write is : I need to copy key to a host name "[email protected] p 22001" with same user ans standard port.