Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

class method

Process.initgroups

(::String username, ::Integer gid) -> ::Array[::Integer]
Process.initgroups(username, gid) → array

Sets the supplemental group access list; the new list includes:

  • The group IDs of those groups to which the user given by username belongs.

  • The group ID gid.

Example:

Example
Process.groups                # => [0, 1, 2, 3, 4, 6, 10, 11, 20, 26, 27]
Process.initgroups('me', 30)  # => [30, 6, 10, 11]
Process.groups                # => [30, 6, 10, 11]

Not available on all platforms.

See also .groups= .kill .groups .last_status also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0