Rsync over SSH-tunnel A->B->C using daemon on C
Dear, I'm trying to put up a scripts to synchronize my computers (HOST_A and HOST_C). I can connect both via HOST_B to avoid the firewall. I am trying to work with the rsync daemon to avoid hanging. I tried to figure out the mailinglist + FAQ, how to do it, but it seems I misunderstand something, since all your previous help did not work for me. I get the following error when executing the rsync-step: Failed to connect to HOST_C: Connection timed out (116). The scipt I now use is: # On HOST_A the following commands are executed # Start rsync daemon on HOST_C and check rsyncd.conf file ssh HOST_B ssh HOST_C rsync --daemon ssh HOST_B ssh HOST_C cat /etc/rsycd.conf # Create SSH-tunnel ssh -fN -l myusername -L 8873:HOST_B:8873 HOST_C # Rsync folders rsync -auv rsync://HOST_C:8873/module_on_HOST_C/folder_on_HOST_C /folder_on_HOST_A # Close rsync daemon on HOST _C and SSH-tunnel ssh HOST_C killall rsync killall ssh Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Rsync hangs after a while when tunneling from A->B->C
Dear Rsyncians, I'm trying to Rsync my windowsXP-pc A and C. There is a firewall in between A and C, but we have a port open on a linux-machine B to access C from A (and vica versa) via B. When I now run my Rsync scripts in cygwin: # ___ #!/bin/bash # Command to synchronize (only update) two computers based on RSYNC FOLDER_SOURCE="/cygdrive/d/scripts" FOLDER_TARGET="/cygdrive/g/stefaanlh/scripts" PC_SOURCE="ip of pc-A" PC_TARGET="ip of pc-C" echo Synchronizing of SOURCE with TARGET rsync -auvvvz --timeout=999 -e "ssh [EMAIL PROTECTED] ssh" $FOLDER_SOURCE/ $PC_TARGET:$FOLDER_TARGET echo Synchronizing of TARGET with SOURCE rsync -auvvvz --timeout=999 -e "ssh [EMAIL PROTECTED] ssh" $PC_TARGET:$FOLDER_TARGET/ $FOLDER_SOURCE echo Done # ___ Rsync hangs unexplainable after a while (+-a minute). You can see the end of my log-file below my email. It looks like a time-out because, when I restart the program after it hangs it continues where it stopped before and afterwards hangs again after a minute. Is there anyone with advice on how to solve this? Thanks in advance and kind regards, Stef Log-file: set modtime of cpp/area_extract_sl_1x00/.area_extract.layout.d1AQ20 to (1074535293) Mon Jan 19 19:01:33 2004 renaming cpp/area_extract_sl_1x00/.area_extract.layout.d1AQ20 to cpp/area_extract_sl_1x00/area_extract.layout false_alarms=0 tag_hits=0 matches=0 sender finished /cygdrive/g/stefaanlh/scripts/cpp/area_extract_sl_1x00/area_extract.layout send_files(90, /cygdrive/g/stefaanlh/scripts/cpp/area_extract_sl_1x00/area_extract.o) send_files mapped /cygdrive/g/stefaanlh/scripts/cpp/area_extract_sl_1x00/area_extract.o of size 6253 recv_files(cpp/area_extract_sl_1x00/area_extract.o) cpp/area_extract_sl_1x00/area_extract.o calling match_sums /cygdrive/g/stefaanlh/scripts/cpp/area_extract_sl_1x00/area_extract.o sending file_sum got file_sum set modtime of cpp/area_extract_sl_1x00/.area_extract.o.RHXhoJ to (1070450786) Wed Dec 3 12:26:26 2003 renaming cpp/area_extract_sl_1x00/.area_extract.o.RHXhoJ to cpp/area_extract_sl_1x00/area_extract.o false_alarms=0 tag_hits=0 matches=0 sender finished /cygdrive/g/stefaanlh/scripts/cpp/area_extract_sl_1x00/area_extract.o send_files(91, /cygdrive/g/stefaanlh/scripts/cpp/edison_src.zip) send_files mapped /cygdrive/g/stefaanlh/scripts/cpp/edison_src.zip of size 1120295 recv_files(cpp/edison_src.zip) cpp/edison_src.zip calling match_sums /cygdrive/g/stefaanlh/scripts/cpp/edison_src.zip Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: RSync + SSH tunneling through firewall
Yessos, very cool. It works even with rsync -auv -e "ssh [EMAIL PROTECTED] ssh" src_folder host_C:sdt_dir Sometimes solutions can be very simple... Unfortunartely all open positions for email postmasters are just filled in. I did my best to convince my boss, you were better, but it didn't work.:) Thanx again! Stef Andrzej Filip wrote: It is nice to know it works [finally :) ]. As the last check try to eliminate ssh-b script and test rsync -auv -e "ssh host_B ssh" src_dir host_C:sdt_dir -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: RSync + SSH tunneling through firewall
Haai Andrzej, The problem is solved. When I double checked the ssh-b file I realized I had to change the linux commands to cygwin commands. >From that moment all commands (like date, hostname...) worked on the C-host So with the key authentification and the following ssh-b script: #!/bin/bash ssh [EMAIL PROTECTED] ssh "$@" the rsync command works: rsync -auv -e ~/ssh-b /cygdrive/driveletter/localfolder/ host_C:/cygdrive/driveletter/remotefolder and I don't get the pseudo terminal warning anymore. Whenever you are in Belgium, I owe you a beer or something else to drink. Thanx a lot for all the help. Kind regards, Stef Andrzej Filip wrote: Stefaan Lhermitte wrote: I did. I can now connect via SSH as wel from A -> B as from B -> C. I also resolved the problem of not being able to connect to C. I restarted the sshd and now it works. The problem now stays with the rsync. I used: rsync -auv -e ~/ssh-b /cygdrive/driveletter/localfolder/ computer-C:/cygdrive/driveletter/remotefolder/ I get no errors but only the following output: Pseudo-terminal will not be allocated because stdin is not a terminal. Unfortunately it does not rsynchronize, since no files are copied. 1) Do you get computer-C shell prompt when you execute "~/ssh-b computer-C" ? [ you may ignore "pseudo terminal warning in *this* test ] 2) What do you get when you execute "~/ssh-b computer-C date" ? [ Is date program executed on C ? ] -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: RSync + SSH tunneling through firewall
Indeed, I want to: * to start rsync session A->C * cannot establish ssh session A->C (firewall) * but can establish ssh session A->B and B->C I think I understand the ssh hop. If I'm correct. I make a script file ssh-b that I subsequently invoke in the rsync command (./ssh-b). Unfortunately I still have a question concerning the ssh-b script. I have put: #!/bin/sh exec ssh [EMAIL PROTECTED] ssh "$@" What stands the "$@" for? When I run the ssh-b script and enter my password for host-B I get the --help printout on my screen? I assume I have to write something like: #!/bin/sh exec ssh [EMAIL PROTECTED] ssh [EMAIL PROTECTED] But then I get the error: Pseudo terminal will not be allocated becausestdin is not a terminal. Permission denied. Thanx for your help so far. It already helped a lot. Regards, Stef Andrzej Filip wrote: Stefaan Lhermitte wrote: I tried to connect the tunnel with another port number. When I use port number 22 instead of 873 I can telnet to C from B. When I telnet I get "SSH-1.99-OpenSSH_3.9p1." Subsequently I ran: ssh -v -L 22:C-computer:22 [EMAIL PROTECTED] When I run now the rsync command: rsync -v /cygdrive/d/folder/ 127.0.0.1::cygdrive/folder I get the error: "failed to connect to 127.0.0.1. Connection refused." When I run: rsync -v --port=22 /cygdrive/d/folder/ 127.0.0.1::cygdrive/folder I get the error "server sent SSH-1.99-OpenSSH_3.9p1 rather than greeting" I assume it is a problem associated with the telnet command. Can anyone help? As I understand: * you want to start rsync session A->C * you can not establish ssh session A->C (firewall) * you can establish ssh session A->B and B->C Try to use "extra ssh hop" script: 1) Create ssh-b script on host A: #!/bin/sh exec ssh _host_B_ ssh "$@" 2) Use the above sctipt in rsync session rsync -e ./ssh-b -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: RSync + SSH tunneling through firewall
I tried to connect the tunnel with another port number. When I use port number 22 instead of 873 I can telnet to C from B. When I telnet I get "SSH-1.99-OpenSSH_3.9p1." Subsequently I ran: ssh -v -L 22:C-computer:22 [EMAIL PROTECTED] When I run now the rsync command: rsync -v /cygdrive/d/folder/ 127.0.0.1::cygdrive/folder I get the error: "failed to connect to 127.0.0.1. Connection refused." When I run: rsync -v --port=22 /cygdrive/d/folder/ 127.0.0.1::cygdrive/folder I get the error "server sent SSH-1.99-OpenSSH_3.9p1 rather than greeting" I assume it is a problem associated with the telnet command. Can anyone help? Kind regards; Stef Andrzej Filip wrote: Stefaan Lhermitte wrote: I'm trying to rsync my labtop pc (let's assume A-computer) with my desktop pc (let's assume C-computer) through our firewall. In between there is one computer (let's assume B-computer) that has an open port, so I theoretically could connect via a tunnel. I checked the SSH- website and internet and so on but did not find an answer that works. I tried the solution I found on the net: When I run ssh -v -L 873:C-computer:873 [EMAIL PROTECTED] and get connected to B-computer without any problems. When I subsequently run in a new window: rsync -v /cygdrive/d/folder/ 127.0.0.1:: cygdrive/folder I get the following error: Connection reset by peer. In the tunneling window teh following error appears: administrativetly prohibited: open failed Can you telnet port 873 on C from B ? [ Is rsync daemon listening on C ? ] I'm kind of new in the SSH-RSYNC world and don't know how to solve the problem. I assume it is an SSH problem since the problem persist when I run: ssh [EMAIL PROTECTED] -p 873. -- ________ Stefaan Lhermitte Research Associate Lab of Geomatics and Forest Engineering K.U. Leuven Vital Decosterstraat 102. B-3000 Leuven Belgium Tel:+32-(0)16-329750 Fax: +32-(0)16-329760 Cell: +32-(0)494-350842 [EMAIL PROTECTED] -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: RSync + SSH tunneling through firewall
Nope, I cannot telnet port 873. I tried "telnet C-computer" and "telnet C-computer 873" but command give the error: Connection refused. On the other hand, the SSH command from B-computer to C-computer works does give connection without any problems. Thanx in advance, Stef Andrzej Filip wrote: Stefaan Lhermitte wrote: I'm trying to rsync my labtop pc (let's assume A-computer) with my desktop pc (let's assume C-computer) through our firewall. In between there is one computer (let's assume B-computer) that has an open port, so I theoretically could connect via a tunnel. I checked the SSH- website and internet and so on but did not find an answer that works. I tried the solution I found on the net: When I run ssh -v -L 873:C-computer:873 [EMAIL PROTECTED] and get connected to B-computer without any problems. When I subsequently run in a new window: rsync -v /cygdrive/d/folder/ 127.0.0.1:: cygdrive/folder I get the following error: Connection reset by peer. In the tunneling window teh following error appears: administrativetly prohibited: open failed Can you telnet port 873 on C from B ? [ Is rsync daemon listening on C ? ] I'm kind of new in the SSH-RSYNC world and don't know how to solve the problem. I assume it is an SSH problem since the problem persist when I run: ssh [EMAIL PROTECTED] -p 873. -- ________ Stefaan Lhermitte Research Associate Lab of Geomatics and Forest Engineering K.U. Leuven Vital Decosterstraat 102. B-3000 Leuven Belgium Tel:+32-(0)16-329750 Fax: +32-(0)16-329760 Cell: +32-(0)494-350842 [EMAIL PROTECTED] -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
RSync + SSH tunneling through firewall
Dear RSYNCians, I'm trying to rsync my labtop pc (let's assume A-computer) with my desktop pc (let's assume C-computer) through our firewall. In between there is one computer (let's assume B-computer) that has an open port, so I theoretically could connect via a tunnel. I checked the SSH- website and internet and so on but did not find an answer that works. I tried the solution I found on the net: When I run ssh -v -L 873:C-computer:873 [EMAIL PROTECTED] and get connected to B-computer without any problems. When I subsequently run in a new window: rsync -v /cygdrive/d/folder/ 127.0.0.1:: cygdrive/folder I get the following error: Connection reset by peer. In the tunneling window teh following error appears: administrativetly prohibited: open failed I'm kind of new in the SSH-RSYNC world and don't know how to solve the problem. I assume it is an SSH problem since the problem persist when I run: ssh [EMAIL PROTECTED] -p 873. Thanx for your help in advance, Stef -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html