当你在编辑文本时,可以使用Markdown格式来使其更具可读性和结构。以下是使用Markdown格式整理你提供的文章的示例:
安装rsync
执行以下命令安装:
apt-get install -y rsync
然后可以使用以下命令查看安装了哪些文件:
dpkg -L rsync
配置rsync
修改配置文件 /etc/default/rsync 中的相应内容为:
RSYNC_ENABLE=true
增加配置文件 /etc/rsyncd.conf,内容为:
port = 873
uid = root
gid = root
use chroot = yes
read only = yes
hosts allow = 204.74.0.0/255.255.0.0
hosts deny = *
max connections = 5
log file = /var/log/rsyncd.log
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
[public]
path = /home/pics/www
list = yes
ignore errors
auth users = pics
secrets file = /etc/rsyncd.secrets
comment = pics www
创建文件 /etc/rsyncd.secrets,内容为用户名和密码,例如:
pics:mypassword
然后执行以下命令:
chmod 700 /etc/rsyncd.secrets
这样就配置好了,可以运行以下命令启动rsync服务端:
/etc/init.d/rsync restart
rsync客户端
在客户端可以使用rsync命令,例如:
rsync rsync://pics@216.18.195.23/public
rsync --password-file=/etc/rsync.password rsync://pics@216.18.195.23/public /home/pics/www --recursive --times --links --hard-links --delete -av