I can use the following command to get the effective group ID of a process:
ps -o pid,egid
But how can I get the supplementary groups IDs of a process?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityI can use the following command to get the effective group ID of a process:
ps -o pid,egid
But how can I get the supplementary groups IDs of a process?
On linux these are available for a process in /proc/pid/status
:
-bash-4.2$ grep \^Groups /proc/$$/status
Groups: 6 9 11 18 100 1000
-bash-4.2$
it may be useful to read through the proc(5)
manual for what is stored in the various /proc
files.
The man page has these format specifiers:
supgid SUPGID group ids of supplementary groups, if any. See getgroups(2).
supgrp SUPGRP group names of supplementary groups, if any. See getgroups(2).
So, ps -o supgid
etc. Though if you use supgrp
with some other columns, the default width might not fit all groups if there are many, so you may want to widen it, e.g.
ps -o pid,supgrp:100,args