获取 rsync 守护进程模块 uid 和 gid

Get rsync daemon module uid and gid

我在服务器上的 /etc/rsyncd.conf 文件中设置了一些 rysnc 模块,如下所示:

[build]
    path = /some/path
    read only = no
    uid = test
    gid = test
    comment = software Build area

[build_test]
    path = /some/other/path
    read only = no
    uid = test1
    gid = test1
    comment = software Build test area

我可以使用以下命令获取服务器上设置的所有 rsync 模块的列表:

>>> rsync server_ip::
build           software Build area
build_test      software Build test area

此命令仅 returns 作业的名称和相关评论。我怎样才能获得模块的 uid 和 gids。有什么命令吗?

更新: 可以在以下位置找到更多详细信息:https://linuxconfig.org/how-to-setup-the-rsync-daemon-on-linux

rsync server_ip:: 命令 returns rsyncd.conf[ 中存在的 rsync 模块名称和注释的列表 将服务器上的文件发送到您的本地终端,而无需通过 ssh 进入该服务器。但是对于 uid 和 gids 等更多详细信息,命令应该是 运行 在使用 ssh 登录后显示该服务器中的 rsyncd.conf 文件内容。经过一些研究,我发现了如何在 python.

中自动执行此过程
>>> import subprocess
>>> subprocess.Popen("ssh user@host -i key.pem \"cat /etc/rsyncd.conf\"", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()

输出如下所示:

>>> '[build]\n        path = /\n        read only = no\n        uid = 1\n        gid = 1\n        comment = software Build area\n\n[build_test]\n        path = /\n        read only = no\n        uid = 1\n        gid = 1\n        comment = software Build test area\n'

然后可以根据需要进行格式化。