LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   rsync: server vs client (http://www.linuxquestions.org/questions/linux-server-73/rsync-server-vs-client-703568/)

kenneho 02-10-2009 04:53 AM

rsync: server vs client
 
Hello all.


I wish to use rsync to sync some folder from one machine to another, but need to clear up one thing regarding the whole server/client setup.

I've written a small script that fetches files from the server. This script is run on the client, and I'm going to add it to a cron job. The script basically runs the rsync command, and everything seems to be working fine. So where does the rsync daemon (i.e. "server") come into the picture? Do I need the server to be running the rsync deamon, and set up the rsync server service?


Regards,
kenneho

Matey 02-10-2009 06:29 AM

Sorry I am not very experienced in Linux but I think rsync is just an executable file and I dont really think its a TSR sort of thing (damon)that stays in the background? If it was we would have an rsyncd (may be)?
I may be wrong, but I think rsync is a script that does several things simultaneously like copy, compare, updates files etc.
Hope some one can answer this correctly.

Guttorm 02-10-2009 11:27 AM

Hi

No need for a service for that. Install rsync on both computers, then set up ssh key based authentication. When you can ssh from the client to the server without a password, you can use rsync between the computers in cron.

The rsync service, I think is used for public servers to mirrors. Ssh is safer and easier to set up.

chitambira 02-11-2009 11:18 AM

On the server that you would keep your 'served' files, you can actually create an rsync server by just running the rsync as a daemon;
First you create an rsyncd.conf file with contents as below:

[repository_name]
path = /path/to/repo_dir
readonly = yes
uid = root
host allow = 10.0.0.0/16
comment = For rsync of any files/directories with repo_name
logfile = /some_dir/rsync.log


then run rsync as a daemon
# rsync --daemon --config=/path/to/configfile/rsyncd.conf

Then from the client machine, whether on the command line or within a script, you will need to run;
# rsync -av SERVERNAME::repository_name/path/to/file local_directory/

kenneho 02-13-2009 04:47 AM

Quote:

Originally Posted by chitambira (Post 3439849)
On the server that you would keep your 'served' files, you can actually create an rsync server by just running the rsync as a daemon;

This is actually what I don't understand - why would you need a deamon (i.e. server) when the clients can simply run the rsync-utility themselves? Is the deamon really just an alternative to using rsync over SSH (typically using key based authentication)?

your_shadow03 02-13-2009 05:23 AM

True..
I have read a couple of journals and noone talks about rsync.conf file either.

kenneho 02-13-2009 06:53 AM

So is my last question true, the one with daemon being simply an alternative to SSH based rsync?

chitambira 02-13-2009 07:33 AM

You surely have not exhausted your reading. Learning does not stop!!

Read the manual
# man rsyncd.conf

The concept of rsync daemon is to provide a persistent server (Mirror) for files from which you can pull copies, in your case requesting from either within other programs/scripts or at the commandline
The rsync daemon will fork and continue to run in the background. Each new connection will make rsync fork to handle that request
Thi is very necessary if you have files that you want be be syncronised (to be the same all the time) especially if the files are continually being modified on the source server.

Check following links
http://samba.org/rsync/documentation.html
http://www.raskas.be/blog/2007/12/21...n-init-script/
http://sunsite.dk/info/guides/rsync/...mirroring.html

Guttorm 02-13-2009 07:34 AM

Yes you are right. But it is used for different things. A lot of public FTP servers use the rsync daemon. Then mirrors and users can use rsync instead of FTP to save bandwidth.

I really hope there is no such a thing as anonymous ssh.


All times are GMT -5. The time now is 01:35 AM.