Set up an rsync server in Linux

Source: Internet
Author: User
Tags rsync

Rsync is a file synchronization and transmission tool in Unix systems. Rsync uses the "rsync algorithm" to quickly synchronize files between a client and a remote file server. Some features of rsync javasdersync includes the following features: * can update whole directory trees and filesystems can update the entire directory and tree and file system; * optionally preserves symbolic links, hard links, file ownership, permissions, devices and times selectively maintain the symbolic link, hard link, file belonging, permission, device, and time; * requires no special privileges to install for installation, no special permission requirements; * internal pipelining CES latency for multiple files, the internal pipeline reduces the latency of file waiting; * can use rsh, ssh or Direct sockets as the transport can use rsh, ssh, or direct port as the transmission inbound port; * supports anonymous rsync which is ideal for archiving ing supports anonymous rsync file synchronization, which is an ideal image tool; installation and configuration process: 1. Create the corresponding file and folder [root @ estals60: ~] # Mkdir/etc/rsyncd -- create an rsyncd directory under the/etc directory, which is used to store the rsyncd. conf and rsyncd. secrets files. [root @ estals60: ~] # Touch/etc/rsyncd. conf -- create rsyncd. conf, which is the configuration file of the rsync server; [root @ estals60: ~] # Touch/etc/rsyncd. secrets -- create rsyncd. secrets, which is the user password file; [root @ estals60: ~] # Chmod 600/etc/rsyncd. secrets -- set the permission to 600 for password security. [root @ estals60: ~] # Ls-lh/etc/rsyncd. secrets-rw ------- 1 root 14/etc/rsyncd. secrets [root @ estals60: ~] # Touch/etc/rsyncd. motd 2. Modify rsyncd. conf and rsyncd. secrets and rsyncd. motdrsyncd. conf is the main configuration file of the rsync server. Let's take a simple example. For example, we want to back up/nsn_talko_production/talko/var/www/html/Talko/talko on the server. next/repository/# Minimal configuration file for rsync daemon # See rsync (1) and rsyncd. conf (5) man pages for help # This line is required by the/etc/init. d/rsyncd scriptpid file =/var/run/rsyncd. pidport = 873 address = estals60 # uid = nobody # gid = nobod Yuid = rootgid = rootuse chroot = yesread only = yes # limit access to private LANshosts allow = * #192.168.1.0/255.255.255.0 10.0.1.0/255.255.255.0 # hosts deny = * max connections = 5 motd file =/ etc/rsyncd. motd # This will give you a separate log file # log file =/var/log/rsync. log # This will log every file transferred-up to 85,000 + per user, per sync # transfer logging = yeslog format = % t % a % m % f % Bsyslog facility = local3timeout = 300 [P_repositor] path =/nsn_talko_production/talko/var/www/html/Talko/talko. next/repository/list = yes -- list indicates whether the directory on the rsync server that provides data synchronization is displayed on the server. The default value is yes. If you do not want to list the contents, no is required. If no is used, at least others do not know which directories are provided on your server. As you know, ignore errors -- ignore IO error auth users = root -- User Account (this must be an existing account in the System) secrets file =/etc/rsyncd. secrets -- place where the password is stored comment = P_repositor -- equivalent to an interface name, when the service is running, the client can directly use this name to call the folder content information of the relevant server # exclude = beinan/samba/-- ignore the content of the two folders rsyncd. the content of secrets is similar to root: 123456 yoyun: 123456 rsyncd. the motd file defines the rysnc server information, that is, the user login information. For example, let the user know who provided the server. ++ yow.packages rsync ++ ++ 3. Start the rsync server [root @ estals60: ~] #/Usr/bin/rsync -- daemon -- config =/etc/rsyncd. conf 4. Firewall settings [root @ estals60: ~] # Iptables-a input-p tcp-m state -- state NEW-m tcp -- dport 873-j ACCEPT [root @ estals60: ~] # Iptables-L check if port 873 is enabled on the firewall. 5. Run the synchronization command rsync-avzP root @ estals60 :: p_repositor/nsn_talko/talko/var/www/html/Talko/talko. next/at this time, you will be asked to enter the root password, and then there will be no problem. In addition, you can also create a system task and run it regularly. The truth is the same. With crontab, we will not repeat it here. ##################### Uid = nobodygid = nobodyuse chroot = noread only = falsemax connections = 5 port = 873 motd file =/etc/rsyncd. motdpid file =/tmp/rsyncd. pidlock file =/tmp/rsync. locklog format = % t % a % m % f % blog file =/tmp/rsyncd. logtimeout = 300 [update] path =/data/autoupdate/ignore errors = yeslist = falsecomment = updatesecrets file =/etc/rsyncd. secretshosts allow = * # hosts deny = 0.0.0.0/32 ############################# ##############

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.