https://help.ubuntu.com/community/rsync
木饭
English • 中文
RSYNC的简单配置
rsync是类unix系统下的数据镜像备份工具,从软件的命名上就可以看出来了——remote sync。它的特性如下:
可以镜像保存整个目录树和文件系统。
可以很容易做到保持原来文件的权限、时间、软硬链接等等。
无须特殊权限即可安装。
优化的流程,文件传输效率高。
可以使用rcp、ssh等方式来传输文件,当然也可以通过直接的socket连接。
支持匿名传输,以方便进行网站镜象。
软件下载
rysnc的主页地址为:
http://rsync.samba.org/
在UBUNTU下安装RSYNC通过以下步骤可以实现:
$ sudo apt-get install rsync xinetd
编辑/etc/default/rsync 启动rsync作为使用xinetd的守护进程
$ sudo vim /etc/default/rsync
RSYNC_ENABLE=inetd
创建 /etc/xinetd.d/rsync 通过xinetd使rsync开始工作
$ sudo vim /etc/xinetd.d/rsync
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
创建 /etc/rsyncd.conf 配置rsync使其在.
$ sudo vim /etc/rsyncd.conf
max connections = 2
log file = /var/log/rsync.log
timeout = 300
[share]
comment = Public Share
path = /home/share
read only = no
list = yes
uid = nobody
gid = nogroup
auth users = user
secrets file = /etc/rsyncd.secrets
创建 /etc/rsyncd.secrets 配置用户名和密码.
$ sudo vim /etc/rsyncd.secrets
user:password
4.a
$ sudo chmod 600 /etc/rsyncd.secrets
启动/重启 xinetd
$ sudo /etc/init.d/xinetd restart
运行下面的命令检查,确认rsync配置成功。
$ sudo rsync user@192.168.0.1::share Password: drwxr-xr-x 4096 2006/12/13 09:41:59 . drwxr-xr-x 4096 2006/11/23 18:00:03 folders
取自“http://wiki.ubuntu.org.cn/index.php?title=UbuntuHelp:Rsync/zh&variant=zh-cn”