How To SCP Using Port Other Than 22
SSH is the secure shell protocol used to securely exchange data between to computers. SCP is the secure copy protocol used to securely copy files from one computer to another. SCP uses the SSH protocol to make this file transfer possible.
The default port for SSH (and SCP) is port 22, however some system administrators choose to change this port. This is done in part for security reasons. It is easy to connect to a non-default port using SSH and SCP.
For SSH use the -p flag to specify which port to connect to:
ssh user@host -p 1234
with 1234 being the SSH port above.
For SCP the flag is -P (note that this is a capital "p").
scp -P 1234 file [email protected]:/remote/location/
or from a remote host to the local host:
scp -P 1234 [email protected]:/remote/location/file ./
The above commands will allow you to securly transfer files through SCP using a non standard port.