rsync / ssh / Firewall "Hole" coolness

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Ed Skinner
Date:  
To: plug-discuss
Subject: rsync / ssh / Firewall "Hole" coolness
Just got this working...
     I have two Linux systems at work and two more at home. Each location is 
behind a firewall but, at home, I have a hole punched through to ssh on one 
of the machines. (The port# changes frequently, and "almost" at random.)
     The problem has been the set of files that I like to use in both 
locations, on all four systems, and keeping all those files up to date on the 
four machines. In the past, I've manually kept the four copies in sync but, 
well, since I have to occasionally also use Windows, some of my brain cells 
die off from time to time and I'm afraid I might forget and do it wrong and 
lose a file or an update thereto. Manual solutions are not good.


     So, rsync and ssh to the rescue!
     On each machine I set up a Common/ directory under my login. I put all 
the files there that I want to keep in common with the four machines.
     From one office machine to the other the command to synchronize is very 
straightforward:
rsync -v -r -e ssh Common/ user@system:Common/
     Make the appropriate substitutions for user and system. This will end up 
in a cron entry (but gotta figure out where the password goes) that fires, 
for example, at 2:00AM.
     Synchronizing from office to home took a guess about how rsync would 
actually implement the "-e ssh" option and, because this "feature" isn't 
precisely documented, YMMV, but it seems to work on the four distributions I 
have at my disposal. Here is the command:
rsync -v -r -e "ssh -p port" Common/ user@system:Common/
     Substitute the correct values for port, user and system.
     The "trick" is putting the ssh command option, the "-p port", inside the 
quotes with the "ssh" command itself to get ssh to use the specified port 
number. (The man page for "rsync" *also* talks about port numbers, but those 
are only relevent when using rsyncd *without* ssh.)
     This too will end up in a cron entry (and with a password somewhere?) 
that fires during the night as well, some time *after* the first one 
finishes, or [better still] in a script that runs the first rsync, then this 
one so they are sure to run in the necessary order, and neither too early nor 
unnecessarily late.
     And on my home systems, another cron entry will, at 5:00AM or so, rsync 
those two machines. Presumably by 6:00AM or so, all four systems will be in 
sync each day.


     Don'cha just love Linux?


--
Ed Skinner, , http://www.flat5.net/

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss