What is Linux Group?
A Linux group is a collection of user accounts that share common access permissions to files, directories, and other system resources. Each user on a Linux system is associated with one or more groups, and groups are used to simplify the process of managing user access and privileges.
Key Characteristics:
- Group Identifier (GID): Each group is assigned a unique numerical identifier known as the Group ID (GID). The GID is used by the system to differentiate between groups and is associated with specific permissions.
- Group Membership: Users can belong to one or more groups. When a user is part of a group, they inherit the permissions assigned to that group. This simplifies the process of managing permissions for multiple users who require similar access levels.
Types of Groups:
- Primary Group: Every user has a primary group, which is the main group associated with their account. The primary group is specified in the user’s entry in the
/etc/passwd
file. - Secondary Groups: Users can also belong to additional groups known as secondary groups. These groups provide supplementary permissions beyond those granted by the primary group.
How to Add User to a Group in Linux
A group in Linux is a way to put users with similar access and permissions in a collection. By using groups, an administrator can define access control and permissions for all the users belonging to that group. Without groups, the administrator would have to define roles for individual users however, with groups those roles can be given to a group which in turn, will apply to all the users in the group.
In this article, we shall learn how to add a user to a group. We shall see different methods to do the same.
Table of Content
- What is Linux Group?
- Pre-requisites to Add a User to a Group in Linux
- How to Add User to a Group in Linux while creating the user.
- How to Add User to a Group in Linux Which Already exist.
- Frequesty Asked Questions