Linux SCP Copy Directory to Remote Server using non-standard ssh Port
I have to use scp a lot from 1 server to another and sometimes a server is using a non-standard (22) ssh port, here is an example on how to scp in the instance with a directory or a file.
Example 1: scp a directory to a remote server using non-standard ssh port 222
scp -r -P 222 directory_test/ root@192.168.1.100:/usr/
Example 2: scp a file to a remote server using non-standard ssh port 222
scp -r -P 222 test_file.txt root@192.168.1.3:/usr/
2 Comments
→
but what if you want to scp a file from one remote server to another and BOTH use non-standard ports?
Indeed, I would like to do the same. In my case I have to copy file from remote to remote server via two port forwarding tunnels as both remote servers are only accessible via the “tunnel” server.
local scp_src scp_dst
any ideas?