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.

link|improve this question

67% accept rate
Cross posted here: stackoverflow.com/questions/1679534/… – Dennis Williamson Nov 5 '09 at 11:54
feedback

2 Answers

up vote 7 down vote accepted

I ended up doing the following:

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

An SSH followed by an SCP.

link|improve this answer
4  
I agree, +1 for the solution as it avoids data transferring down from server 1 and up to server 2 (2 transfers instead of 1 as suggested) – AlberT Nov 5 '09 at 10:22
what I was going to write, then forgot about the page :) – warren Nov 5 '09 at 11:38
feedback
ssh root@xxx.xxx.xxx.111 'tar cf - /home/myimages/images.tar.gz' | ssh root@xxx.xxx.xxx.222 'tar xf -'

Ssh-pipes are extremely useful. Learn and love them!

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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