Using SCP to copy a file on a non standard ssh port

transfer

Frequently system administrators will change the SSH port from the standard port 22 for security reasons. If this is the case and you need to transfer something via SCP, below is the command to transfer a file from one server to another using a non standard SSH port.


Transfer a file with SCP on port 3838

scp -P 3838 /the/source/file username@destinationhost.com:/destination/file

As you can see above we are using port 3838 instead of 22.

Transfer entire directory with SCP on port 3838

If you want to move an entire folder you have to use the r attribute:

advertisement:
smyles 56 32
sMyl.es

scp -rP 3838 /the/source/directory username@destinationhost.com:/destination/folder

This will create a copy of “directory” under the “folder” directory from the example above.

 
Source: sMyles
hosting Linux logo transfer Software Tutorials