我正在尝试设置rsync来每天从服务器复制数据.为了使系统尽可能受限制,我试图使用手册页中描述的模式:
“通过远程外壳连接使用RSYNC-DAEMON功能”
“通过远程外壳连接使用RSYNC-DAEMON功能”
所以我在root home文件夹中放了一个名为rsyncd.conf的文件:
[root] path = / read only = true
并尝试将/ etc / passwd复制为测试:
rsync -vv -e ssh myserver::root/etc/passwd .
但我得到以下内容:
opening connection using: ssh myserver rsync --server --daemon . rsync: connection unexpectedly closed (0 bytes received so far) [receiver] rsync error: error in rsync protocol data stream (code 12) at io.c(635) [receiver=3.0.3]
我这样做的原因是,一旦我开始工作,我计划通过指定命令来限制访问
rsync --server --daemon .
在〜/ .ssh / authorized_keys中
解决方法
文档中似乎存在错误或rsync的实现. man rsync说:
Rsync supports connecting to a host using a remote
shell and then spawning a single-use “daemon” server that expects to
read its config file in the home dir of the remote user.
但是当连接到root时,根据/ var / log / messages,它在/etc/rsyncd.conf中查找配置文件(rsyncd.conf文件的标准位置,而不是通过SSH使用).
我不得不通过添加强制ssh服务器使用正确的配置文件
command="rsync --config=/root/rsyncd.conf --server --daemon ."
到/root/.ssh/authorized_keys.
我之所以不把配置放在默认位置的原因是我不想让别人意外启动正常的rsync守护进程 – 我只希望守护进程在获得正确的ssh密钥时拥有这么多的访问权限.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。