LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   scp file with a specific port (https://www.linuxquestions.org/questions/linux-newbie-8/scp-file-with-a-specific-port-671525/)

ust 09-22-2008 04:24 AM

scp file with a specific port
 
I want to use scp to copy file from server A to server B , if I want the copying is via a specific port ( not use the default port ) , can advise what can i do ? thx

bathory 09-22-2008 04:32 AM

Use the -P switch followed by the port number you want to use.
Code:

man scp
for details

ust 09-22-2008 05:32 AM

Quote:

Originally Posted by bathory (Post 3288032)
Use the -P switch followed by the port number you want to use.
Code:

man scp
for details

thx reply ,

when use scp -p file.mine -P 22040 hostname:/destination

it pop

-P: No such file or directory
22040: No such file or directory

what is wrong ? thx

bathory 09-22-2008 05:41 AM

You must put first the scp options and then the files you want to copy, so either one of the following will do:
Code:

scp -p -P 22040 file.mine hostname:/destination
scp -P 22040 -p file.mine hostname:/destination


ust 09-22-2008 09:41 PM

Quote:

Originally Posted by bathory (Post 3288077)
You must put first the scp options and then the files you want to copy, so either one of the following will do:
Code:

scp -p -P 22040 file.mine hostname:/destination
scp -P 22040 -p file.mine hostname:/destination


thx ,

if I want to use rcp instead of scp , can advise what can i do ? thx

bathory 09-23-2008 03:05 AM

I'm not using rcp, but from the manpage I guess you need to use the -D option to specify a different port.
Code:

rcp -D 22040 file.mine hostname:/destination


All times are GMT -5. The time now is 05:17 PM.