Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'rsync w/o daemon' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
rsync w/o daemon
Authored by: copelanduk on Oct 23, '02 03:10:45PM

You can rsync any two machines (as long as rsync is installed on both machines) without running a daemon on either machine or adding rsync to inetd etc.

For example I use something like this to backup my ~ to one of my debian servers:

rsync -rptvlWe ssh --exclude-from=/Users/USERNAME/Documents/Scripts/rsyncexclude.txt --delete --progress --stats ~/ server:backup/MACHINENAME

my rsyncexclude.txt file looks something like this:

# --- MACHINENAME ---
- com.apple.loginwindow.plist # root owned file
- com.apple.NetInfoManager.plist # root owned file
- .localized
- .FBC* # can always re-index
- .DS* # window positions not critical
- Cache/ # skip mozilla/chimera cache
- *.waf # skip IE stuff
- .Trash* # no trash please

As long as you have sshd running on the destination and use "-e ssh" (assuming ssh is in your path), you'll be able to use rsync over ssh w/o an rsync daemon. All Jaguar installs can be used as destination or source with rsync by just turning on remote login in the sharing panel.

PS. I use rsync to mirror my entire Mac OS X home directory and various other directories with no problems (mostly .txt, .rtf, .doc, .html, .xml, java, .class, .mp3, .mov, .sh, .pl, .pdf .png, .tif, etc) and have used rsync with FreeBSD and Linux for some time now. On Mac OS X there ARE problems; I wouldn't try to keep my /Applications folders on my 3 macs in sync with rsync.

Lets say rsync is not for everyone, and indeed it's probably more suited to 10.2 users with a unix background than a classic background. Nonetheless letting users know how they can use a really powerful tool like rsync is important.



[ Reply to This | # ]
rsync w/o daemon
Authored by: fireproof on Oct 24, '02 11:32:25PM

How do you deal with the password stuff? I can't seem to get --password-file=FILE to work (does it have to be in some special format? I'm using a text file), or the RSYNC_PASSWORD environment variable to work either...

Aside from that your post rocks! Very handy, thanks to both of you for putting this information together.



[ Reply to This | # ]
rsync w/o daemon
Authored by: copelanduk on Oct 25, '02 06:32:44AM
I copied the text below from the rsync man page, this is the section on the different ways rsync can be used:
1. for copying from the local machine to a remote machine using a remote shell program as the trans- port (such as rsh or ssh). This is invoked when the destination path contains a single : separator. 2. for copying from a remote machine to the local machine using a remote shell program. This is invoked when the source contains a : separator. 3. for copying from a remote rsync server to the local machine. This is invoked when the source path con- tains a :: separator or a rsync:// URL. 4. for copying from the local machine to a remote rsync server. This is invoked when the destination path contains a :: separator.
In my case I am using server:~/ (not server:: as in the original hint) and specifying to use ssh with the -e switch so I am using method 1. (to server) and 2. (from server). Whatever method you use you to authenticate with ssh will also apply for the rsync over ssh connection. After you enter the rsync command ssh will make a connection and prompt you for your account password if necessary. In my case I use key exchange so I can just enter the rsync command from my previous post and it will run right away. (I've got several different rsync commands stored as term files in: ~/Library/Application Support/Terminal/*.term So I can easily access them from Terminal.)

[ Reply to This | # ]
rsync w/o daemon
Authored by: fireproof on Oct 28, '02 05:40:11PM
Would you care to write a tip on using key exchange? Sounds useful...

[ Reply to This | # ]
rsync w/o daemon
Authored by: copelanduk on Oct 31, '02 11:21:12PM
By key exchange I meant ssh public/private key exchange, which is covered in these hints: here and here. Otherwise google for ssh-keygen, and ssh-agent.

[ Reply to This | # ]
rsync w/o daemon
Authored by: themax on Oct 30, '02 03:17:38PM

Ok here we go. I took your advice and tried

rsync -rptvlWe ssh --delete --progress --stats ~/rsynctest.txt server:/users/myusername/

I was promprted for my ssh key password which I entered correctly and then...

building file list ...
1 file to consider
51303.1/rsynctest.txt.151303
22 100% 0.00kB/s 0:00:00
rsynctest.txt
37 100% 0.00kB/s 0:00:00
rsynctest.txt/rsrc

Number of files: 1
Number of files transferred: 1
Total file size: 37 bytes
Total transferred file size: 37 bytes
Literal data: 59 bytes
Matched data: 0 bytes
File list size: 32
Total bytes written: 223
Total bytes read: 36

wrote 223 bytes read 36 bytes 47.90 bytes/sec
total size is 37 speedup is 0.14


But when I go to look at the file on the remote machine it has a size of ZERO?

Any ideas??

Thanks
BostonMACOSX



[ Reply to This | # ]
rsync w/o daemon
Authored by: copelanduk on Oct 31, '02 11:46:35PM
Ok I just ran: rsync -rptvlWe ssh --delete --progress --stats ~/rsynctest.txt server:~/ And this is what I see:
rsync: building file list... rsync: 1 files to consider. rsynctest.txt 6947 100% 0.00kB/s 0:00:00 Number of files: 1 Number of files transferred: 1 Total file size: 6947 bytes Total transferred file size: 6947 bytes Literal data: 6947 bytes Matched data: 0 bytes File list size: 32 Total bytes written: 7035 Total bytes read: 36 wrote 7035 bytes read 36 bytes 744.32 bytes/sec total size is 6947 speedup is 0.98
My file is fine on the server. Which leads me to believe that the output you saw was from a file with a resource fork. I see only one "100%", you had two, so I guess your file is copied and then replaced by its resource. Try creating a new text file from the CLI: touch ~/rsynctest2.txt then add some text to the file with vi/pico (or TextEdit.app) or just type: cat ~/Sites/index.html >> ~/rsynctest2.txt and run the rsync command again but with rsynctest2.txt. If it works then I guess it was a resource issue, and you'll have to use RsyncX and be careful about what you use rsync on. If the command still doesn't work with the plain text file, you might have a problem with the server (what OS is it running?) or conflicts between rsync versions etc.

[ Reply to This | # ]
rsync w/o daemon
Authored by: themax on Nov 04, '02 10:28:42AM

Ok the solution was that I only had RSYNC on my Jaguar box and RSYNCX on my 10.1.5 box. Now that I have RSYNCX on both I'm fine.

Thanks for the advice.!!!!!!



[ Reply to This | # ]
rsync w/o daemon
Authored by: themax on Nov 04, '02 10:33:18AM

Ok the solution was that I only had RSYNC on my Jaguar box and RSYNCX on my 10.1.5 box. Now that I have RSYNCX on both I'm fine.

Thanks for the advice.!!!!!!



[ Reply to This | # ]