10

How can I specify a port for the destination ip? When I do scp -p 0000 it still tries to connect on port 22, not the one I'm specifying.

scp svn_backup.tgz [email protected]:/path/to/new/svn/
2
  • 1
    You can find great information reading manual pages. man scp, for example.
    – motobói
    Mar 20, 2012 at 11:47
  • 1
    If in doubt, --help or man will probably give you the answer. Jun 22, 2012 at 8:03

2 Answers 2

21

Capital "P".

$ scp -P 12345 svn_backup.tgz [email protected]:/path/to/new/svn/

See $ man scp for more details.

2
  • Hooray for consistency! Jun 11, 2010 at 16:58
  • 2
    @David: scp was designed to imitate rcp, and rcp used -p to "preserve file times and modes". See man scp. Jun 11, 2010 at 19:08
4

It's also noteworthy that the port specification must come before the file name, i.e.:

scp svn_backup.tgz -P 12345 [email protected]:/path/to/new/svn/

*won't work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .