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


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

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:

smyles 56 32

scp -rP 3838 /the/source/directory

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

Source: sMyles
hosting Linux logo transfer Software Tutorials