1、准备机器,此时使用linux作为server
server---10.0.0.13 (linux)
client---172.168.32.9 (windows)
2、安装与配置linux主机的rsync
SERVER端
---------------------------------
#rpm -qa |grep rsync #检查系统是否安装(默认一般都已安装)
#service iptables stop
#vim /etc/rsyncd.conf #如果不存在,直接用VI新建
添加:
#################################
uid = root
gid = root
use chroot = no
max connections = 200
timeout = 600
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[backup]
path = /backup/
ignore errors
read only = false
list = false
hosts allow = 172.168.32.0/24
hosts deny = 0.0.0.0/32
auth users = rsync_backup
secrets file = /etc/rsync.password
###################################
mkdir /backup
chmod -R 777 /backup #新建目录backup及给予权限
echo "rsync_backup:elain" >/etc/rsync.password #配置帐号及密码
chmod 600 /etc/rsync.password #配置rsync.passwd文件权限
cat /etc/rsync.password
#echo "/usr/bin/rsync --daemon">>/etc/rc.local #设置为开机自启动
#pkill rsync
#rsync --daemon #重启rsync服务
#ps -ef |grep rsync #检查启动是否正常
3、配置windows的rsync客户端
(1)安装client端的rsync包
下载 cwRSYNC 2.0 WINDOWS客户端
点击安装
批处理脚本:
################################
@echo off
title 同步NEWS帐号 BY:dingtm
cd C:\Program Files\cwRsync\bin
rsync -vzrtopg --progress --delete dtm@10.0.0.13::backup /tmp
echo 同步完成
pause
################################
转载于:https://blog.51cto.com/elain/616388