4

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?

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
user7681202
  • 1,313
  • 3
  • 14
  • 27

2 Answers2

6

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.

thrig
  • 34,938
4

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

ilkkachu
  • 138,973