User and Group Administration
local graph
Chapter 4 — User and Group Administration
Section titled “Chapter 4 — User and Group Administration”Linux is a multi-user operating system, meaning many users can work on the same system at the same time, each with different permissions and access levels. It is critical for a system administrator to control who can do what, which commands they are allowed to run, and which system areas they can access. The SCA exam places strong emphasis on user and group administration because it directly affects security, accountability, and stability.
This chapter teaches:
- How to create, modify, and remove users and groups
- How Linux stores credentials and identity details
- How to manage passwords and enforce security policies
- How to assign privileges through sudo
- Role-based access patterns used in enterprise environments
By the end of this chapter, you will be able to design access structures that balance usability and security.
Understanding Users, Groups, and Ownership
Section titled “Understanding Users, Groups, and Ownership”Every file and process on a Linux system is associated with:
- A user
- A group
Users are individual identities. Groups are collections of users who share access rights.
Key Identity Files
Section titled “Key Identity Files”| File | Purpose |
|---|---|
| /etc/passwd | Stores basic user account information |
| /etc/shadow | Stores encrypted password hashes |
| /etc/group | Defines system groups |
| /etc/sudoers | Defines administrative sudo permissions |
You will not edit these files manually during normal administration. Instead, use system tools which update them safely.
Creating and Managing Users
Section titled “Creating and Managing Users”Creating a User
Section titled “Creating a User”sudo useradd usernameCreating a User with Home Directory (recommended)
Section titled “Creating a User with Home Directory (recommended)”sudo useradd -m usernameSetting a Password
Section titled “Setting a Password”sudo passwd usernameDeleting a User
Section titled “Deleting a User”sudo userdel usernameDeleting User and Their Home Directory
Section titled “Deleting User and Their Home Directory”sudo userdel -r usernameManaging Groups
Section titled “Managing Groups”Create a Group
Section titled “Create a Group”sudo groupadd developersAdd User to Group
Section titled “Add User to Group”sudo usermod -aG developers usernameCheck Group Membership
Section titled “Check Group Membership”groups usernameDelete Group
Section titled “Delete Group”sudo groupdel developersGroups allow shared access to directories, files, and systems, without granting full administrative access.
Understanding User IDs and Group IDs
Section titled “Understanding User IDs and Group IDs”The system identifies users using numeric values:
- UID (User ID)
- GID (Group ID)
Check:
id usernameTypical ranges:
- System users: UID 1 to 999
- Normal users: UID 1000+
Knowing this helps with audits and troubleshooting access issues.
Password Policies and Security
Section titled “Password Policies and Security”Passwords are stored in /etc/shadow as encrypted hashes.
To enforce password aging:
sudo chage -l username (view password info)sudo chage -M 90 username (set max age to 90 days)sudo chage -m 7 username (set min days to 7 before change)sudo chage -W 14 username (warn 14 days before expiration)Enterprises often enforce:
- Minimum password length
- Expiration policies
- Lockout after failed attempts
On SUSE, you can manage this through:
sudo yast usersor by editing /etc/login.defs.
Delegating Privileges Using sudo
Section titled “Delegating Privileges Using sudo”Administrators should avoid logging in as root during daily operations.
Instead, use sudo, which runs specific commands with elevated privileges.
Example:
sudo systemctl restart networkGranting sudo Access
Section titled “Granting sudo Access”Use:
sudo visudoAdd a line:
username ALL=(ALL) ALLThis grants full sudo rights.
Role-Based Access Patterns (Enterprise Practice)
Section titled “Role-Based Access Patterns (Enterprise Practice)”Instead of full sudo access, grant only what is needed.
Examples:
Allow user to restart web service only:
username ALL=(root) /usr/bin/systemctl restart apache2Allow users of group ops to manage logs:
%ops ALL=(root) /bin/journalctlThis approach:
- Reduces risk
- Improves accountability
- Supports audit policies
Real-World Case Example
Section titled “Real-World Case Example”A telecom provider once faced frequent accidental service outages. Investigation showed multiple junior engineers had full root access, and a harmless typo caused system downtime.
Solution:
- Root login disabled
- All engineers given limited sudo based on job function
- Logging enabled to track every privileged command
Outcome:
- No accidental outages for over a year
- Smooth security compliance audits
Professional Linux administration is less about power and more about control.
Memory Booster
Section titled “Memory Booster”Always remember the sequence for safe user access creation:
Create → Assign Group → Set Password → Test Login
Or simply:
C A S T
This ensures users are both configured and verified, preventing lockouts.
Hands-On Exercise Lab 4
Section titled “Hands-On Exercise Lab 4”Complete the following:
- Create a new user:
sudo useradd -m analyst- Set password:
sudo passwd analyst- Create a group:
sudo groupadd audit_team- Add the user to the group:
sudo usermod -aG audit_team analyst- Verify:
id analyst- Grant limited sudo to view logs only:
sudo visudoAdd:
analyst ALL=(root) /usr/bin/journalctlTest:
su - analystjournalctlNote what works and what does not.
Reflection Questions
Section titled “Reflection Questions”- Why is it considered a bad practice to log in directly as root in production?
- How can group-based permissions help avoid giving users unnecessary privileges?
- What risks arise from weak or non-expiring password policies?
- Why is sudo logging valuable during audits?
Answering these builds operational maturity, not just exam correctness.
End-of-Chapter Summary
Section titled “End-of-Chapter Summary”In this chapter, you learned:
- How Linux stores identity and account details
- How to create, modify, and delete users and groups
- How to manage password aging and security policies
- How to assign administrative privileges using sudo safely
- How to use role-based patterns to prevent mistakes and secure systems
You now understand how to create a safe, organized, and well-structured user environment on a SUSE system.