Linux - Group (Gid)


Every user who has access to a Linux system needs a login and a password. Each user must belong to a primary group and for security or access purposes can belong to several secondary groups.

The easiest way to manage users and groups is through the graphical application, User Manager (redhat-config-users). The following command line tools can also be used to manage groups:

  • groupadd, groupmod, and groupdel — Industry-standard methods of adding, deleting, and modifying user groups.
  • gpasswd — Industry-standard method of administering the /etc/group file.
  • pwck, grpck — Tools for the verification of the password, group, and associated shadow files.

How to

Create a new group

groupadd mygroup


Add a group to a user

usermod -a -G groupName userName


  • a stands for append
  • -G stands for supplementary group (not the primary group)

Get the groups of a user

groups oracle
oracle : oracle davfs2

The user oracle has two groups: oracle and davfs2


id -Gn userName

Get your groups

oracle davfs2

Delete a group

[root@ebs121 /]# /usr/sbin/groupdel oinstall
groupdel: cannot remove user's primary group.

Get Group information (secondary group)

Group information is stored in /etc/group. This file can be directly edited.

Format of the file is:

  • Group name
  • Group password (hardly ever used)
  • Group ID
  • User names (separated by commas)

Each field is separated by a colon.

cat /etc/groups

Extra Information

User Private Groups

Red Hat Linux uses a user private group (UPG) scheme, which makes UNIX groups easier to manage.

A UPG is created whenever a new user is added to the system. A UPG has the same name as the user for which it was created and that user is the only member of the UPG.

UPGs makes it is safe to set default permissions for a newly created file or directory which allow both the user and that user's group to make modifications to the file or directory.

The setting which determines what permissions are applied to a newly created file or directory is called a umask and is configured in the /etc/bashrc file. Traditionally, on UNIX systems the umask is set to 022, which allows only the user who created the file or directory to make modifications. Under this scheme, all other users, including members of the creator's group are not allowed to make any modifications. However, under the UPG scheme, this “group protection” is not necessary since every user has their own private group.

Reference on UPG

Discover More
Card Puncher Data Processing
Ansible - User management

user management in Ansible - An how to of the User module of Ansible where: vault_dev_login_password is a vault variable (encrypted)...
Bash Liste Des Attaques Ovh
Bash - (Builtin|Intern|System|Reserved|Shell) variable name

Reserved variable name are named that have a special meaning for the bash shell. PS1 defines the shell's command-line prompt. HOME defines the home directory for a user. PATH defines a list...
Bash Liste Des Attaques Ovh
Bash - Complete (Builtin command) - Completion

The programmable completion feature in Bash permits typing a partial command, then pressing the [Tab] key to auto-complete the command sequence The process of applying these completion specifications...
Bash Liste Des Attaques Ovh
Bash - Runuser

Runuser - run a shell with substitute user and group IDs, similar to su, but will not run Linux_PAMLinux Pluggable Authentication Modules (PAM) hooks Basic From the init library:
Linux - Resource Manager - Processes limitations (/etc/security/limits.conf)

Limiting user processes is important for running a stable system. To limit user process resource, you have just to set shell limit by adding: a user name or group name or all users to /etc/security/limits.conf...
Bash Liste Des Attaques Ovh
Linux - Stat (File status)

This page is the file metadata (also known as file status) on the linux file system Principally, the stat command display the file metadata. find command man where: Through the --printf=FORMAT...
Linux - User (Uid)

Every user who has access to a Linux system needs a login and a password. The root login is the super admin user. The term root may refer to: the root account (the superuser, who has permission...
Linux - su command (switch user)

The su command (switch user) is a part of the user management. To switch to another user, use the su command. This is most commonly used to switch to the root account. su run a shell with substitute...
Obi Edition
OBIEE 10G - Linux OEL 5 x86 Installation version

Open the Set the JavaHome parameter to the point to the new JDK location. For example, . tail Oracle BI Java Host start-up details: /usr/local/OracleBIData/web/log/javahost.out.log Oracle BI Java...
What is the Wheel group on Linux?

The users of the wheel group are able to su to root. This usually consists of a group named “wheel” and a set of users that are permitted to use the utility ‘su’ in order to change to root. The...

Share this page:
Follow us:
Task Runner