Answer the question
In order to leave comments, you need to log in
How to display all groups (users) that are in the OS (ubuntu)?
Good afternoon, I'm trying to display all the groups that are in Linux OS
import os,grp,pwd
#выводит пользователя
#for p in pwd.getpwall():
# print (p[0])
#таким образом выводит группы только для конкретного юзера
for g in grp.getgrnam('asterisk'):
print (g)
Answer the question
In order to leave comments, you need to log in
https://docs.python.org/3/library/grp.html#grp.getgrall
grp.getgrall()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question