PRACTICAL NO.
3 – User and Group Management in Linux (Updated)
Institution: Shri Ramdeobaba College of Engineering and Management,
Nagpur
Department: Computer Science and Engineering
Session: 2024–2025
Subject: Fundamentals of Linux OS – I Semester
Aim: Explore and execute user and group management in Linux using modern command-line tools.
THEORY OVERVIEW
Linux is a multi-user operating system where user and group management is essential for security
and resource control. Users are assigned permissions individually or through groups, which simplifies
administration.
User Types
● Root: Superuser with full access.
● Regular Users: Limited access to their own files.
● System Users: Used by services; no login shell.
Key Files
● /etc/passwd: User info
● /etc/shadow: Encrypted passwords
● /etc/group: Group info
● /etc/gshadow: Group password policies
Commands
Task Command
Create user sudo useradd username
Set password sudo passwd username
Delete user sudo userdel -r username
Create group sudo groupadd groupname
Add user to group sudo usermod -aG groupname username
Rename group sudo groupmod -n newgroupname oldgroupname
Delete group sudo groupdel groupname
Change file owner/group sudo chown owner:group filename
Task Command
Change group ownership sudo chgrp groupname filename
View users cut -d: -f1 /etc/passwd
View groups cut -d: -f1 /etc/group
View user info id username
View user groups groups username
EXPERIMENTATION TASKS
🔹 Part 1: User Management
1. Create a user student with home directory and shell /bin/bash.
2. Set password for student to password123.
3. Add student to sudo group.
4. Display UID, GID, and group memberships of student.
5. Delete student and their home directory.
6. Create user rbu with:
o UID: 123
o GID: 1003
o Home: /home/rbu/rbu
o Shell: /bin/sh
o Password: rbu
Part 2: Group Management
1. Create group developers.
2. Create user devuser and add to developers.
3. Verify group membership of devuser.
4. Rename group developers to devteam.
Part 3: Ownership and Permissions
1. Create file file1.txt as user rbu.
2. Create user rbu2 without setting a password.
3. Change owner of file1.txt to rbu2 and group to devteam.
BONUS: FILE PERMISSIONS
Use ls -l filename to view permissions. Use chmod 755 filename to set:
● Owner: read/write/execute
● Group: read/execute
● Others: read/execute