Koozali.org: home of the SME Server
Obsolete Releases => SME Server 9.x => Topic started by: Drifting on September 10, 2019, 01:27:28 PM
-
Is there a way to export the groups, and the users who have rights to those groups in a csv?
Trying to audit a system that the user has managed, trouble is he has a goodly few groups.
Not urgent, just trying to save myself time reading.
Thanks Paul
-
The basic info is in the accounts db.
db accounts show
Try grepping for groups eg
db accounts show |grep =group
Then you can look for members
db accounts getprop {group} Members
I guess you can probably script that and output to csv.
-
You can use the lazy admin tools contrib to export config as text files. You will get pipe separated files for users, groups, domains...
-
list group names and members from the config db:
for g in $(db accounts show |grep '=group' |sed 's/=group//'); do printf "$g\t$(db accounts getprop $g Members)\n"; done
list groups with 1 or more members (entries that don't end with a colon) from /etc/group:
grep -v :$ /etc/group
list ibay names and their groups:
for i in $(db accounts show |grep '=ibay' |sed 's/=ibay//'); do printf "$i\t$(db accounts getprop $i Group)\n"; done
-
Wow guys!
Thank you so much, was not a task I was looking forward to. As per usual it was a favour job! The joys of retirement!
Thanks again Paul.
-
Reading groups from /etc/groups you might get system groups in the way.