0

I have a few rysnc modules setup in /etc/rsyncd.conf file on a server like this:

[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

I am able to get the list of all the rsync modules setup on the server with following command:

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

This command returns jobs' names and associated comments only. How can I get the uids and gids of the modules as well. Is there any command for that?

Update: More details can be found at: https://linuxconfig.org/how-to-setup-the-rsync-daemon-on-linux

  • have you tried `ps aux | grep rsync` ? – Manifest Man Apr 20 '21 at 22:12
  • There's no mechanism for determining this from the client side. What are you trying to do with this information? – Anya Shenanigans Apr 23 '21 at 09:35
  • Yes, after some research I found out that uids and gids cannot be obtained with any command from client side like this. But contents of the file `rsyncd.conf` can be displayed to client side terminal using an automated process of log in using ssh along with `cat /etc/rsyncd.conf` command. Please see the answer to my own question below. – Mujeeb Ur Rehman Apr 23 '21 at 09:47

1 Answers1

0

rsync server_ip:: Command returns list of rsync modules' names and comments present in rsyncd.conf file on the server to your local terminal without the need of ssh into that server. But for more details like uids and gids, command should be run to display rsyncd.conf file contents in that server after log in using ssh. And after some research I found out how this process can be automated in python.

>>> import subprocess
>>> subprocess.Popen("ssh user@host -i key.pem \"cat /etc/rsyncd.conf\"", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()

And output looks like this:

>>> '[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'

Which then can be formatted according to need.