Skip to content

Linux SCP Copy Directory to Remote Server using non-standard ssh Port

by Jon on December 10th, 2009

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/

From → Linux

2 Comments
  1. anonymous coward permalink

    but what if you want to scp a file from one remote server to another and BOTH use non-standard ports?

    • Kadu permalink

      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?

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS

%d bloggers like this: