首页
|
新闻
|
娱乐
|
游戏
|
科普
|
文学
|
编程
|
系统
|
数据库
|
建站
|
学院
|
产品
|
网管
|
维修
|
办公
|
热点
首页
>
网站
>
建站经验
> 正文
Ubuntu 下配置Rsync服务的方法
2019-11-02 16:29:04
字体:
大
中
小
来源:
转载
供稿:网友
默认情况Ubuntu安装了rsync服务,但在/etc下没有配置文件,一般情况可以copy示例文件到/etc下
#cp /usr/share/doc/rsync/examples/rsyncd.conf /etc
#vi /etc/rsyncd.conf
# sample rsyncd.conf configuration file
# GLOBAL OPTIONS
motd file=/etc/motd #登录欢迎信息
log file=/var/log/rsyncd #日志文件
# for pid file, do not use /var/run/rsync.pid if
# you are going to run rsync out of the init.d script.
pid file=/var/run/rsyncd.pid
syslog facility=daemon
#socket options=
# MODULE OPTIONS
[rsync]
comment = public archive
path = /home/soft/rsync
use chroot = yes
# max connections=10 #最大连接数
lock file = /var/lock/rsyncd
# the default for read only is yes...
read only = yes
list = yes
uid = nobody
gid = nogroup
# exclude =
# exclude from =
# include =
# include from =
# auth users =
# secrets file = /etc/rsyncd.secrets
strict modes = yes
# hosts allow =
# hosts deny =
ignore errors = no
ignore nonreadable = yes
transfer logging = no
# log format = %t: host %h (%a) %o %f (%l bytes). Total %b bytes.
timeout = 600
refuse options = checksum dry-run
dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz
修改看个人情况,一般修改path=/home/soft/rsync为自己的目录
修改完后在/etc/下新建一文件rsyncd.pass
#vi /etc/rsyncd.pass
backup:backup
:wq
修改rsyncd.pass权限
#chmod 600 /etc/rsyncd.pass
现在就可以启动rsync了
#rsync --daemon
启动成功后可以用lsof -i:873是否正常启动,也可以查看/var/log/rsyncd相关日志文件。
备份命令:rsync -vzrtopg --progress --delete backup@172.28.156.88::rsync /cygdrive/f/a
注:cygdrive/f/a即表示f:/a目录
详细格式说明:
-v, verbose 详细模式输出
-q, quiet 精简输出模式
-c, checksum 打开校验开关,强制对文件传输进行校验
-a, archive 归档模式,表示以递归方式传输文件,并保持所有文件属性,等于-rlptgoD
-r, recursive 对子目录以递归模式处理
-R, relative 使用相对路径信息
-b, backup 创建备份,也就是对于目的已经存在有同样的文件名时,将老的文件重新命名为
~filename。可以使用 suffix选项来指定不同的备份文件前缀。