配置如下:
/etc/rsyncd.conf
pid file = /var/run/rsyncd.pid
use chroot = yes
read only = yes
secrets file = /etc/rsyncd.secrets
[gentoo-portage]
path = /usr/portage
comment = Gentoo Portage tree
exclude = /distfiles /packages
auth users = kangkang
/etc/rsync.secrets
kangkang:pass
如果 /etc/rsync.secrets 权限不是0600,则会出现如下错误:
$ rsync rsync://kangkang@localhost/gentoo-portage/
@ERROR: auth failed on module gentoo-portage
rsync error: error starting client-server protocol (code 5) at main.c(1383) [receiver=2.6.9]
另外,推荐用上述格式书写rsync协议的命令,如使用
rsync kangkang@localhost::gentoo-portage
少输入一个`:'时:
rsync kangkang@localhost:gentoo-portage
rsync会使用系统的远程shell认证,现在一般情况会使用ssh,这不是我们所期待的。