First, server-side configuration:
# yum -y install xinetd
# vi /etc/xinetd.d/rsync The following code
service rsync { disable = yes socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = –daemon log_on_failure += USERID }
disable = yes Change to disable = no
Then start xinetd # /etc/init.d/xinetd start or service xinetd restart Note: If the firewall is installed on the server, remember to open the port, the default port is 873
# telnet 127.0.0.1 873 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused # iptables -A INPUT -s 192.168.0.0/255.255.255.0 -p tcp -m tcp --dport 873 -j ACCEPT # iptables -A INPUT -p tcp -m tcp --dport 873 -j DROP
# vi /etc/rsyncd.conf (This file is created if it does not exist)
#Global Settings uid = root #Run rsync gid = root use chroot = no #do not use chroot max connectio Ns = 20 #Maximum number of connections secrets file = /etc/rsyncd.secrets #password file location, authentication file settings, set username and password log file = /var/log/rsyncd.log #specify rsync log files instead of The log is sent to syslog pid file = /var/run/rsyncd.pid #Specify the pid file of rsync lock file = /var/run/rsync.lock #Specify the lock file that supports the max connections parameter. The default value is /var/run/Rsyncd.lock comment = hello world #motd file = /etc/rsyncd.motd # Welcome information file name and storage location (this file does not, you can add it yourself) [backup] # Here is the authentication module name, you need to specify on the client side Path = /titan24/www/repos # The directory to be mirrored auth users = rsync # Authorized account. The authenticated username, if there is no such line, it means anonymous, separated by multiple users. read only = no # yes read-only value means readable and writable mode, data recovery with NO hosts allow = 192.168.3.128 #Allow access to the server IP hosts deny = * #blacklist list = true #Allow column files #ignore errors # Can ignore some extraneous IO errors #exclude = cache/111/cache/222/#Ignore directory
# vi /etc/rsyncd.secrets (Set access (authentication) username and password)
rsync:111111 #username:password
Give the file the correct permissions #chown root: Root /etc/rsyncd.secrets # chmod 600 /etc/rsyncd.secrets #(Must be 600)
Second, the client side synchronizes The client seems to have installed rsync by default, if not installed: # yum -y install rsync
Perform an asynchronous synchronization operation:
/usr/bin/rsync -avz --progress [email protected]::backup /www
# crontab -e #(You can synchronize the file every three minutes)
*/3 * * * * rsync -avz --progress [email protected]::backup /www
The following command is complete:
#vi /etc/rsyncd.pas Add password rsyncofpass Note that the client's password file only requires a password, not a username!
Change file permissions: #chmod 0600 /etc/rsyncd.pas
#rsync -vzrtopgu --progress --delete --password-file=/etc/rsyncd.pas [email protected] .0.2::rsync_module_name1 /www/
In this command line, v in vzrtopg is verbose, z is compressed transmission, r is recursive, and topg is the parameter that keeps the original attributes of the file such as owner and time. . u is to synchronize only the files that have been updated, to avoid the files that have not been updated are updated repeatedly, but pay attention to the synchronization of the clocks of the two machines. –progress means to show detailed progress, –delete means that if the server deletes the file, the client will delete the file accordingly and keep it true. In the following [email protected]::rsync_module_name1, the following rsync_module_name1 is the module name, which is the name customized in /etc/rsyncd.conf, and rsync_user is the user name that can be synchronized specified in the specified module. The last /www is the directory name backed up to the local. In this case, you can also establish an encrypted connection with the -e ssh parameter. You can use –password-file=/password/path/file to specify the password file so that it can be used in the script without having to enter the verification password interactively. It should be noted that this password file permission attribute should be set. Only the owner can read.
#/usr/local/rsync/bin/rsync -vzrtopg –progress –delete [email protected]::rsync_module_name1 Please continue to the next page: Synchronization Command Description ---------------------------- -----Synchronization Command Description:--------------------------------- 1 Display Directory Content Command —— a) rsync b) rsync -r c) rsync [email protected]:: d) rsync [email protected]: Command Description — —— a) Display directory contents (layer 1) b) Recursive display of directory contents c) Display remote host directory contents *Note 1: Port mode, based on rsync user authentication *Note 2: The directory on the rsync server must be Have xx7 permissions. d) View remote host directory contents *Note 1: Remote shell mode, system local user authentication via ssh connection *Note 2: Only one colon (:) is used here At the same time, the username is the ssh user of the remote host, and the password is also the password corresponding to the ssh user. *Note 3: Use ”” to list the information of the folder itself. To list the contents of a folder, you should use ”/”. Parameter Description ——— -r Recursive operation of directory 2 Synchronization between local directories Command —— a) rsync -av &ndash ;progress /*** Note (/) *** b) rsync -av –progress c) rsync -avu –progress –delete /d) rsync -av –progress –temp-dir=/tmp / Command Description ——— a) Synchronize all files in the src-dir directory to the dst-dir directory b) Synchronize all files in the src-dir directory to the dst-dir/src-dir directory c) Differentially update the contents of the src-dir directory to the dst-dir directory. If there is an add/update, add or replace it. If there is a decrease, delete it. d) More than a) –temp-dir=/tmp, that is Specify /tmp as a temporary swap area to avoid errors that cannot be synchronized due to insufficient target directory space. Parameter Description ——— -a Equivalent to the collection of -rlptgoD -u is equivalent to –update, not updated if the target file is newer than the source file -v displays the synchronized file – Progress Shows the percentage progress of file synchronization, transfer rate –delete Deletes files in the target directory that are more than the source directory 3 Synchronizes between remote hosts Command —— a) rsync -avz –progress jack @192.168.0.1::/b) rsync -avz –progress [email protected]::/–password-file=/home/jack/rsync.jack c) rsync -avuz –progress –delete jack@ 192.168.0.1::/–password-file=/home/jack/rsync.jack d) rsync -avz –progress [email protected]::/ Command Description ——— a) Synchronize the contents of the local directory to the remote host 192.168.0.1 directory, jack is the rsync database user (see 3. /etc/rsync.secrets) b) Non-interactive login file synchronization by automatically reading the user password c) More than b) -u and –delete d) Synchronize remote host content to a local directory
/tmp/Password: or you can also make a password File Because the system crontab is required to be executed, the method of reading the password file is used here, and this time is successful.
VPS is basically the same as the general stand-alone Linux server. There is basically no difference
Server security has always been a top priority, especially since the viruses and T
Before, the black station was a lot darker, but I didnt think about whether it would be traced. I di
First enter the nginx configuration file directory Please enter the following com
Establishment of an internal FTP server for the enterprise
How to know who is switching process in Linux
IIS server Web access prompts for password question
The IIS configuration file backdoor
Server Security Settings Tutorial: Hard Disk Permission Settings
Backing up and restoring Windows IIS server settings
Teach you how to add pseudo-static under nginx
Php-cgi process cpu takes up too much resources and solutions
Configure the WSUS server client computer for automatic update
Start IIS7 with 0x8ffe2740 error solution
Case review: Hot Standby Keeping the server uninterrupted The
.cbox can't open the ultimate solution
What is the difference between 32-bit win7 system and 64-bit win7 system
File Recovery Tool EasyRecovery Introduction and User Guide
How to make win 8 system boot without loading unnecessary service items
Windows10 BAD_POOL_CALLER or Bad_pool_caller blue screen failure solution
The common usage of the Tab key is shared. The
Win XP system how to quickly defragment hard disk