USD ($)
$
United States Dollar
Euro Member Countries
India Rupee

User and Group Management

Lesson 15/49 | Study Time: 20 Min

Linux is inherently a multi-user operating system where each user has a unique identity and is associated with one or more groups. Managing users and groups enables administrators to control permissions efficiently, facilitate collaboration, and enforce organization-wide policies. 

Understanding Users and Groups in Linux

User and group management forms the foundation of Linux security and access control. Following are the core components involved in managing users and groups.


1. User Accounts: Each user is assigned a unique user ID (UID) and typically owns files and processes. Users have personal home directories and specific permissions.

2. Groups: Groups are collections of users. Permissions can be assigned to groups, allowing shared access control without assigning permissions individually to users.

3. Primary Group: Each user has a primary group, which is the default group assigned upon user creation.

4. Secondary (Supplementary) Groups: Additional groups that a user can belong to for accessing shared resources.

Key Files Storing User and Group Information

User authentication and group management rely on specific configuration files. Following are the important files that store user and group data in Linux.


/etc/passwd: Stores basic user account information including username, UID, GID (primary group ID), home directory, and default shell.

/etc/group: Contains group names, GIDs, and lists of group members.

/etc/shadow: Stores encrypted user password information (restricted access for security).

/etc/gshadow: Stores encrypted group password and administration info.

Common User Management Commands

Common Group Management Commands

Adding Users to Groups


  • Use usermod with -aG to add a user to one or multiple secondary groups without removing from existing groups:
bash
sudo usermod -aG group1,group2 alice


  • To set or change the primary group of a user:
bash
sudo usermod -g groupname alice

Viewing Group Membership


  • To check which groups a user belongs to:
bash
groups alice


  • To view all members of a group:
bash
getent group groupname

Best Practices in User and Group Management


1. Use groups to organize users by roles or departments for efficient permissions management.

2. Assign the least privileges necessary to users and groups to maintain security.

3. Regularly audit user accounts and group memberships to ensure compliance.

4. Use centralized authentication systems (LDAP, Active Directory) for large environments.

5. Always backup related files (/etc/passwd, /etc/group) before making bulk changes.

Samuel Wilson

Samuel Wilson

Product Designer
Profile

Class Sessions

1- What is Linux and Operating System Concepts 2- Linux History and Evolution 3- Linux Distributions and Their Purposes 4- Open Source Software and Licensing 5- Graphical User Interface (GUI) and Desktop Environments 6- Terminal Access and Command-Line Fundamentals 7- Getting Help and Command Documentation 8- File System Hierarchy and Directory Structure 9- Navigating Directories and Listing Contents 10- Creating, Copying, and Moving Files and Directories 11- Deleting Files and Directories 12- Symbolic and Hard Links 13- Understanding File Permissions Model 14- Modifying Permissions and Ownership 15- User and Group Management 16- Sudo and Privilege Escalation 17- Text Searching and Pattern Matching 18- Text Processing and Stream Editing 19- Compressing and Archiving Files 20- Text Editing and File Creation 21- Package Management Systems Overview 22- Installing and Updating Software with APT 23- Installing and Updating Software with YUM/DNF 24- Managing Software from Non-Repository Sources 25- Understanding Processes and Process Management 26- Viewing Running Processes 27- Process Control and Termination 28- Task Scheduling with Cron 29- Networking Concepts and IP Addressing 30- Viewing and Configuring Network Interfaces 31- Basic Network Troubleshooting 32- Shell Script Basics 33- Variables and Data Types 34- Conditional Logic in Scripts 35- Loops and Iteration 36- Functions and Code Reuse 37- Input/Output and User Interaction 38- System Authentication and Access Control 39- File System Security 40- Software Updates and Patching 41- Basic Firewall Concepts 42- System Information and Monitoring 43- Service and Daemon Management 44- System Boot Process and Runlevels 45- System Backup and Disaster Recovery 46- Comprehensive File System Management 47- System Automation Workflows 48- Multi-Concept Troubleshooting Scenarios 49- Continued Learning Pathways

Sales Campaign

Sales Campaign

We have a sales campaign on our promoted courses and products. You can purchase 1 products at a discounted price up to 15% discount.