9

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 user@xxx.xxx.xx.xxx:/path/to/new/svn/
Ben
  • 3,800
  • 18
  • 65
  • 96

2 Answers2

20

Capital "P".

$ scp -P 12345 svn_backup.tgz user@xxx.xxx.xx.xxx:/path/to/new/svn/

See $ man scp for more details.

EEAA
  • 109,363
  • 18
  • 175
  • 245
4

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

scp svn_backup.tgz -P 12345 user@xxx.xxx.xx.xxx:/path/to/new/svn/

*won't work.

Pierre.Vriens
  • 1,159
  • 34
  • 15
  • 19
stafusa
  • 141
  • 3