Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

Process.groups

Process.groups → array

Get an Array of the group IDs in the supplemental group access list for this process.

Example
Process.groups   #=> [27, 6, 10, 11]

Note that this method is just a wrapper of getgroups(2). This means that the following characteristics of the result completely depend on your system:

  • the result is sorted

  • the result includes effective GIDs

  • the result does not include duplicated GIDs

  • the result size does not exceed the value of Process.maxgroups

You can make sure to get a sorted unique GID list of the current process by this expression:

Example
Process.groups.uniq.sort
See also .groups= .gid= .gid .initgroups also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0