List_Members from Command Line Permission
![](https://secure.gravatar.com/avatar/55dd4b9d4dca2dc661df666477622d76.jpg?s=120&d=mm&r=g)
I am developing a script that gets a list of members from a mailing list (mailman 2.1.15). I'm using popen (in python 2.7.5) to issue the command. However, even though I am running it as admin for that list, I'm getting a permissions error. How/what do I need to set in order to run that command?
def getUsers(): "This function returns a list of users from mailman" p=subprocess.Popen(["/usr/lib/mailman/bin/list_members","listname"],stdout=subprocess.PIPE) lines=p.stdout.readlines() p.wait return(lines)
![](https://secure.gravatar.com/avatar/55dd4b9d4dca2dc661df666477622d76.jpg?s=120&d=mm&r=g)
My apologies if this is a duplicate but since I have received nothing back I am assuming this did not get through the first time. I am guessing I need to somehow provide a password but the list_members command does not seem to have that as an option.
I am developing a script that gets a list of members from a mailing list (mailman 2.1.15). I'm using popen (in python 2.7.5) to issue the command. However, even though I am running it as admin for that list, I'm getting a permissions error. How/what do I need to set in order to run that command?
def getUsers(): "This function returns a list of users from mailman" p=subprocess.Popen(["/usr/lib/mailman/bin/list_members","listname"],stdout=subprocess.PIPE) lines=p.stdout.readlines() p.wait return(lines)
![](https://secure.gravatar.com/avatar/267565c6ab7816fe29beedf9a9cbcd44.jpg?s=120&d=mm&r=g)
- Dennis Putnam <dap1@bellsouth.net>:
I guess the script must run as user "mailman" or "root" Which error messag exactly?
-- Ralf Hildebrandt Charité - Universitätsmedizin Berlin Geschäftsbereich IT | Abteilung Netz | Netzwerk-Administration Invalidenstraße 120/121 | D-10115 Berlin
Tel. +49 30 450 570 155 ralf.hildebrandt@charite.de https://www.charite.de
![](https://secure.gravatar.com/avatar/55dd4b9d4dca2dc661df666477622d76.jpg?s=120&d=mm&r=g)
On 6/28/2024 12:06 PM, Ralf Hildebrandt via Mailman-Users wrote:
Hi Talf,
Thanks for the reply. Here is the python traceback.Traceback (most recent call last): File "/usr/lib/mailman/bin/list_members", line 286, in <module> main() File "/usr/lib/mailman/bin/list_members", line 230, in main mlist = MailList.MailList(listname, lock=False) File "/usr/lib/mailman/Mailman/MailList.py", line 130, in __init__ self.Load() File "/usr/lib/mailman/Mailman/MailList.py", line 655, in Load dict, e = self.__load(file) File "/usr/lib/mailman/Mailman/MailList.py", line 620, in __load fp = open(dbfile) IOError: [Errno 13] Permission denied: '/var/lib/mailman/lists/cufsalumni/config.pck' I didn't think about running it as mailman (really dumb). Yes it works if run as mailman. Thanks again.
![](https://secure.gravatar.com/avatar/56f108518d7ee2544412cc80978e3182.jpg?s=120&d=mm&r=g)
On 6/28/24 9:02 AM, Dennis Putnam wrote:
There are many reasons why you might not receive a response to a post within 2 days. If you are really concerned that your post didn't reach the list, you can always check the archives where you would find it at https://mail.python.org/archives/list/mailman-users@python.org/message/46IJ7...
The above should be p.wait()
, not p.wait
and should precede the
lines=p.stdout.readlines()
statement.
return(lines)
For the permissions issue, you need to run this as the Mailman user or possibly the web server user, i.e. a user that has permission to read the list's config.pck.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
![](https://secure.gravatar.com/avatar/55dd4b9d4dca2dc661df666477622d76.jpg?s=120&d=mm&r=g)
My apologies if this is a duplicate but since I have received nothing back I am assuming this did not get through the first time. I am guessing I need to somehow provide a password but the list_members command does not seem to have that as an option.
I am developing a script that gets a list of members from a mailing list (mailman 2.1.15). I'm using popen (in python 2.7.5) to issue the command. However, even though I am running it as admin for that list, I'm getting a permissions error. How/what do I need to set in order to run that command?
def getUsers(): "This function returns a list of users from mailman" p=subprocess.Popen(["/usr/lib/mailman/bin/list_members","listname"],stdout=subprocess.PIPE) lines=p.stdout.readlines() p.wait return(lines)
![](https://secure.gravatar.com/avatar/267565c6ab7816fe29beedf9a9cbcd44.jpg?s=120&d=mm&r=g)
- Dennis Putnam <dap1@bellsouth.net>:
I guess the script must run as user "mailman" or "root" Which error messag exactly?
-- Ralf Hildebrandt Charité - Universitätsmedizin Berlin Geschäftsbereich IT | Abteilung Netz | Netzwerk-Administration Invalidenstraße 120/121 | D-10115 Berlin
Tel. +49 30 450 570 155 ralf.hildebrandt@charite.de https://www.charite.de
![](https://secure.gravatar.com/avatar/55dd4b9d4dca2dc661df666477622d76.jpg?s=120&d=mm&r=g)
On 6/28/2024 12:06 PM, Ralf Hildebrandt via Mailman-Users wrote:
Hi Talf,
Thanks for the reply. Here is the python traceback.Traceback (most recent call last): File "/usr/lib/mailman/bin/list_members", line 286, in <module> main() File "/usr/lib/mailman/bin/list_members", line 230, in main mlist = MailList.MailList(listname, lock=False) File "/usr/lib/mailman/Mailman/MailList.py", line 130, in __init__ self.Load() File "/usr/lib/mailman/Mailman/MailList.py", line 655, in Load dict, e = self.__load(file) File "/usr/lib/mailman/Mailman/MailList.py", line 620, in __load fp = open(dbfile) IOError: [Errno 13] Permission denied: '/var/lib/mailman/lists/cufsalumni/config.pck' I didn't think about running it as mailman (really dumb). Yes it works if run as mailman. Thanks again.
![](https://secure.gravatar.com/avatar/56f108518d7ee2544412cc80978e3182.jpg?s=120&d=mm&r=g)
On 6/28/24 9:02 AM, Dennis Putnam wrote:
There are many reasons why you might not receive a response to a post within 2 days. If you are really concerned that your post didn't reach the list, you can always check the archives where you would find it at https://mail.python.org/archives/list/mailman-users@python.org/message/46IJ7...
The above should be p.wait()
, not p.wait
and should precede the
lines=p.stdout.readlines()
statement.
return(lines)
For the permissions issue, you need to run this as the Mailman user or possibly the web server user, i.e. a user that has permission to read the list's config.pck.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (3)
-
Dennis Putnam
-
Mark Sapiro
-
Ralf Hildebrandt