Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
share|improve this question
You can find great information reading manual pages. man scp, for example. – motobói Mar 20 '12 at 11:47
If in doubt, --help or man will probably give you the answer. – Ben Lessani - Sonassi Jun 22 '12 at 8:03
up vote 13 down vote accepted

Capital "P".

$ scp -P 12345 svn_backup.tgz

See $ man scp for more details.

share|improve this answer
Hooray for consistency! – David Mackintosh Jun 11 '10 at 16:58
@David: scp was designed to imitate rcp, and rcp used -p to "preserve file times and modes". See man scp. – grawity Jun 11 '10 at 19:08

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

scp svn_backup.tgz -P 12345

*won't work.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.