Resets a session's process group set.
setgroups [ - ] [ -a GroupSet ] [ -d GroupSet ] [ -r [ Group ] ] [ GroupSet ]
The setgroups command, by default, displays the user's current group set and process group set for the current shell. A user's group set is defined in the user database files. When given a flag and a GroupSet parameter, this command resets the process group set as listed by the GroupSet parameter. The GroupSet parameter is a comma-separated list of group names. The available groups are defined in the user database files.
You can also use the setgroups command to add or delete groups from the current group set. Using the -r flag, you can reset the real group ID. If you specify the Groupset parameter but no flags, the setgroups command resets all the groups and makes the first group in the list the real group. The setgroups command does not change the security characteristics of the controlling terminal.
When you run the setgroups command, the system always replaces your shell with a new one. The command replaces your shell regardless of whether the command is successful or not. For this reason, the command does not return error codes.
The setgroups -r command is identical to the newgrp command.
Access Control: This command should be a general user program. This command should be installed as a program in the trusted computing base (TCB). The command should be owned by the root user with the setuid (SUID) bit set.
Mode | Files |
---|---|
r | /etc/passwd |
r | /etc/group |
Event | Information |
---|
USER_SetGroups | realgroup, groupset |
setgroupsOutput similar to the following appears:
sah: user groups = staff,payroll process groups = staff,payroll
setgroups -a finance
setgroups finance,staff,payrollThis sets finance as the real group. The staff and payroll groups make up the supplementary group list.
setgroups -d payroll
setgroups -This resets your current session to its original state just after you log in.
/usr/bin/setgroups | Contains the setgroups command. |
/etc/group | Contains basic group attributes. |
/etc/passwd | Contains basic user attributes. |
The login command, newgrp command, setsenv command, tsm command.