How to Connect SSH/SCP to a Server on a Non-Standard Port

SSH  Connection to Remote Server on a Non-Standard Port (Not 22):

Example: If the port is 20086, the user is user, and the IP is 192.168.0.111, the connection method is as follows:

ssh -p 20086 [email protected] 

If the server user is root, you can omit the username directly:

ssh -p 20086  192.168.0.111 
or
ssh  192.168.0.111 -p 20086 

For scp, you should use a capital -P: as shown in the command below, which copies the file tomee.zip from the home directory on the remote host 192.168.0.111 to the home directory on the current machine:

scp  -P  20086 192.168.0.111:/home/tomee.zip  /home

Leave a Comment

Your email address will not be published.