rsync: server vs client
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?
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.
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.
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:
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/
I have read a couple of journals and noone talks about rsync.conf file either.
So is my last question true, the one with daemon being simply an alternative to SSH based rsync?
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
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 12:33 PM.|