Configure rsync server in linux

Source: Internet
Author: User
In linux, the rsync server usually uses code management, data backup, and more on the same machine. if the hard disk breaks down, it is almost unable to go back to the day, even if many of them have backups, most of them are local backups, so remote backup is required. I prefer rsync. for free, the following articles are also queried, and then...
In linux, the rsync server usually uses code management, data backup, and multiple servers on the same machine. if the hard disk breaks down, it is almost unable to go back to the day,
Even if many backups exist, most of them are local backups. Therefore, remote backup is required. rsync is preferred. for free, the following articles are also queried and written after the actual operation. www.2cto.com my system environment is CentOS 6.2 first confirm whether the local rsync has been installed rpm-qa | grep rsync my execution result is rsync-3.0.6-9.el6.x86_64 if not installed, you can mount the disc, find the corresponding RPM Package and install it with rpm-I. you can also install it using yum. after installation, you can start to configure. create the rsync configuration file vi/etc/rsyncd. conf # Global configurationsecrets file =/etc/rsyncd. secrets # Password-stored file motd file =/etc/rsyncd. motd # show welcome information # no means user can upload filesread only = nowrite only = no # yes means user can list the directorylist = yesuid = rootgid = rootmax connections = 5 # hosts allow = 172.18.2.0 /24 hosts allow = * hosts deny = * use chroot = nolog file =/var/log/rsyncd. logpid file =/var/run/rsyncd. pid # Component configuration # note the name in the brackets, which will be used for data transmission. www.2cto.com [rsyncd] comment = backup directorypath =/opt/backup/x041201/svncodeauth users = rsyncsecrets file =/etc/rsyncd. in addition to the configuration file, secrets also creates two files referenced in the configuration file: secrets file =/etc/rsyncd. secrets # Password-stored file motd file =/etc/rsyncd. motd # display the welcome information, which can be disabled if you do not want to use it. remember to comment out this line. the device starts the service at random. chkconfig -- list has a ****** xinetd based services: chargen-dgram: off chargen-stream: off cvs: off daytime-dgram: off daytime-stream: off discard-dgram: off discard-stream: off echo-dgram: off echo-stream: off rsync: on swat: off tcpmux-server: off time-dgram: off time-stream: off ***** The rsync service has been installed, and my result list is I have enabled it. this is to control the random startup of the rsync service. if this item is off in your list, you can modify it as follows. vi/etc/xinetd. d/rsync modify disable = yes to disable = no start service xinetd restart so far, the configuration is basically complete, you can use the client to test: in windows, I used cwrsync to switch to the bin directory of cwrsync, and then run the following command to download the file/directory: rsync-vzrtopg -- progress -- delete -- password-file =/cygdrive/e/code/rsync/conf/rsyncpass rsync@172.18.2.36 :: rsyncd/cygdrive/e/code/rsync/rsynctest Upload file/directory: rsync-vzrtopg -- progress -- delete/cygdrive/d/Code/SVNCodeBak rsync
@ 172.18.2.36: rsyncd -- password-file =/cygdrive/c/windows/rsyncpass. If no problem occurs, the configuration is complete. download is basically not a problem, but Upload may still encounter some problems.
Is Permission denied. you can see my solution: When the Permissions denied prompt appears, we generally add write Permission to the corresponding directory on linux.
After this operation, test again and find that the upload is still the same. I don't know how to complete it. in general, se-linux on linux is on, which is also for system security. you should be familiar with it,
The above problem may be caused by se-linux. first, let's take a look at the settings related to se-linux getsebool-a | grep rsync for rsync: response --> onrsync_client --> offrsync_export_all_ro --> offrsync_use_cifs --> offrsync_use_nfs --> off www.2cto.com one of my results lists is open, which is the result of my modification, if you disable it, you can modify
And then test whether the upload is successful. it may take about 30 seconds to execute this command. setsebool-P allow_rsync_anon_write on, of course, you can find many articles similar to this article, which will also introduce se-linux problems and many
If it is a production machine, do you dare to close it? Setenforce 0 # Disable se-linux. it will expire after restart. permanently disable se-linuxvi/etc/selinux/config, change SELINUX = enforcing to SELINUX = disabled, and then restart the system. se-linux will no longer be enabled.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.