vote up 0 vote down star
1

I am trying to a SCP on my local server that copies a file from one remote server to another remote server (Both remote servers use a custom port (xxxx)

I am trying:

scp -r -P xxxx root@xxx.xxx.xxx.111:/home/myimages/images.tar.gz root@xxx.xxx.xxx.222:/home/myimages/images.tar.gz

But i get the following error:

ssh: connect to host xxx.xxx.xxx.222 port 22: Connection timed out

Any suggestions?

Thanks in advance.

flag
I presume that you can ssh to xxx.xxx.xxx.222 normally? – Benj Nov 5 at 10:10
Yeah, I can ssh to all servers from all servers – Lizard Nov 5 at 10:14
Cross posted here: serverfault.com/questions/81650/… – Dennis Williamson Nov 5 at 11:55

migrated from stackoverflow.com

2 Answers

vote up 5 vote down check

Hi,
did you check that direct authentication works from first remote host to the second one?

scp user@host:/file user@otherhost:/otherfile is shorthand for

ssh user@host scp /file user@otherhost:/otherfile

which leeds me to think:

ssh -p XXX user@host scp -P XXX /file user@otherhost:/otherfile might work.

link|flag
Yeah, i have ssh'd to both all servers from each server :( – Lizard Nov 5 at 10:10
Good point, just because you can see xxx.222 doesn't mean that xxx.111 can. – Benj Nov 5 at 10:11
It is a good point, but I have already checked that, any other suggestions? – Lizard Nov 5 at 10:13
The ssh then the scp does what i need it to. – Lizard Nov 5 at 10:18
vote up 2 vote down

It seems like scp doesn't realize that the special port should also be used on the second server. You could try to explicitly call ssh to start the remote scp transfer:

ssh -P xxxx user@host scp -P xxxx /file user@otherhost:/otherfile
link|flag

Your Answer

Get an OpenID
or
never shown

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