1. Install rsync
Yum-y Installrsync
2, no password command line synchronization
Client actions
Ssh-keygen-trsa
Ssh-copy-id-i/root/.ssh/[email protected]
SSH [email protected]
Mkdir-pv/data/shell
rsync-az--delete [Email protected]:/data/rsyncdata//data/shell/
3. synchronization with password service mode
because rsync belongs to the XINETD service, you need to install XINETD first
Yum-y installxinetd
Vi/etc/xinetd.d/rsync
change distable to No
Start the service
/etc/init.d/xinetdstart
NETSTAT-TUNPL |grep 873
Create user
Useraddrsyncuser
Echo ' 123456 ' |passwd--stdin rsyncuser
Create a backup directory
Mkdir-pv/data/rsyncdata
Setting up a configuration file
Vi/etc/rsyncd.conf
Uid=nobody
Gid=nobody
address=192.168.1.181
port=873
hostsallow=192.168.1.186
Use Chroot=yes
Maxconnections=5
Pidfile=/var/run/rsyncd.pid
Lockfile=/var/run/rsync.lock
Log File=/var/log/rsyncd.log
Motdfile=/etc/rsyncd.motd
[Backdata]
Path=/data/rsyncdata
Comment=rsyncbackup
Read Only=yes
List=yes
Authusers=rsyncuser
secretsfile=/etc/rsyncd.passwd
Create a reminder file and password file
Echo ' Welcome Tobackup server ' >/ETC/RSYNCD.MOTD
vi/etc/rsyncd.passwd
rsyncuser:123456
chmod 600/etc/rsyncd.passwd
Service Xinetdrestart
Client No Password Synchronization
exportrsync_password=123456
rsync [Email protected]::backdata/data/shell/
This article is from the "track to record work learning" blog, so be sure to keep this source http://stephenliu.blog.51cto.com/6470474/1676556
rsync Sync Data under CentOS