Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
groups prints the group names of the current process, or of the users you name. It is the same as id -Gn. The first name is the primary group.
Zo schrijf je het
groups [OPTION]... [USER]...Opties 3
Meest gebruikt
Niets past bij dit filter.
Voorbeelden 10
$ als gewone gebruiker# als root (of met sudo)
1My groups
groups student wheelThe first is the primary group.
2Groups of other users
groups lisa omar lisa : lisa webadmins omar : omar wheel webadminsWith names, each line starts with the user.
3After adding a group
usermod -aG webadmins student groups; groups student student wheel student : student wheel webadminsThe shell gets the new group only after a new login.
4Check admin rights quickly
wheel = sudo on RHEL.
5Count the groups of a user
groups lisa | wc -wThe output includes the name and the colon for a named user.
6Use it in a script for many users
for u in anna bob carol; do groups "$u"; doneFast check after a lab.
7Compare with id
id -Gn lisaSame names, no "lisa :" before them.
8Check a group for a shared folder
groups | grep -w salesNeeded to write in a folder owned by group sales.
9Check the groups of a service user
groups apache apache : apacheService accounts should have as few groups as possible.
10Find members of the docker or wheel group (audit)
getent group wheelgroupsshows per user;getent groupshows per group.
Niets past bij dit filter.
Exitcodes
0 :: Done. 1 :: A user does not exist.