加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

无法使rsync在daemon-over-ssh模式下工作

发布时间:2020-12-13 18:19:57 所属栏目:Linux 来源:网络整理
导读:我正在尝试设置rsync来每天从服务器复制数据.为了使系统尽可能受限制,我试图使用手册页中描述的模式: “通过远程外壳连接使用RSYNC-DAEMON功能” 所以我在root home文件夹中放了一个名为rsyncd.conf的文件: [root]path = /read only = true 并尝试将/ etc
我正在尝试设置rsync来每天从服务器复制数据.为了使系统尽可能受限制,我试图使用手册页中描述的模式:
“通过远程外壳连接使用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密钥时拥有这么多的访问权限.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读