0% found this document useful (0 votes)
24 views3 pages

Pract3 Linux

The document outlines a practical exercise for students at Shri Ramdeobaba College of Engineering and Management focused on user and group management in Linux. It details the theory behind user accounts, types of users, group accounts, and essential commands for managing users and groups. The practical section includes specific tasks for creating users and groups, setting permissions, and verifying group memberships.

Uploaded by

unhaleshubham
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views3 pages

Pract3 Linux

The document outlines a practical exercise for students at Shri Ramdeobaba College of Engineering and Management focused on user and group management in Linux. It details the theory behind user accounts, types of users, group accounts, and essential commands for managing users and groups. The practical section includes specific tasks for creating users and groups, setting permissions, and verifying group memberships.

Uploaded by

unhaleshubham
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Shri Ramdeobaba College of Engineering and Management, Nagpur

Department of Computer Science and Engineering


Session: 2024-2025

Fundamentals of Linux OS I Semester

PRACTICAL NO. 3

Aim: Explore and Execute User and Group Management in Linux.

Theory:
In Linux, user and group management is fundamental for administering and securing a multi-user
environment. By organizing users into groups, administrators can enforce permissions and access
control, ensuring that users have appropriate access to files, directories, and other system
resources.

Understanding Users in Linux

 User Accounts: Each user in Linux has a unique account, which is represented by a user
name (UID) and associated with a unique numeric identifier. Users also have a home
directory and a default shell.
 Types of Users:
o Root User: The superuser with unrestricted access to the entire system. The root user
can perform any operation, including system-wide configuration changes and
administrative tasks.
o Regular Users: These are standard user accounts created for day-to-day tasks. They
have limited permissions and typically only have access to their home directories and
files they own.
o System Users: These accounts are used by system services and daemons. They
usually do not have login privileges.

 User Account Files:


o /etc/passwd: Contains user account information such as username, UID, GID, home
directory, and default shell.
o /etc/shadow: Stores password information and password aging policies in an
encrypted format.
o /etc/login.defs: Defines system-wide settings related to user accounts.

Understanding Groups in Linux

 Group Accounts: A group is a collection of users. Each group has a unique name
(GID) and associated with a numeric identifier. Groups are used to manage
permissions and access controls collectively rather than individually.
 Types of Groups:
o Primary Group: Every user is associated with a primary group, typically
matching the user’s name. Files created by the user are automatically assigned
to this group.
o Secondary Groups: Users can be members of additional groups, granting
them access to files and resources shared by those groups.

 Group Management Files:


o /etc/group: Contains group account information such as group name, GID, and
group members.
o /etc/gshadow: Stores encrypted group passwords and administrative settings.

Commands
1. sudo command - Runs a specified command with elevated (root) privileges, allowing
administrative tasks.
2. Useradd - This command creates a new user account, sets up a home directory, and
assigns a default shell.
sudo useradd -m -s /bin/bash username
3. Passwd - Assigns or changes the password for the specified user.
sudo passwd username
4. Userdel - Removes a user account and deletes their home directory if the -r option is
used.
sudo userdel -r username
5. Groupadd - Creates a new group in the system for managing user permissions.
sudo groupadd groupname
6. Usermod - Adds an existing user to a specified group, allowing additional
permissions.
sudo usermod -aG groupname username
7. Groupmod - Renames an existing group, updating its name across the system.
sudo groupmod -n newgroupname oldgroupname
8. Groupdel - Deletes an existing group from the system.
sudo groupdel groupname
9. chmod 755 filename - Sets read, write, and execute permissions for the owner, and
read and execute permissions for the group and others.
10. sudo chown owner:group filename - Changes the owner and group of a file or
directory, adjusting access rights.
11. sudo chgrp groupname filename - Updates the group ownership of a file or
directory, assigning it to a different group.
12. cut -d: -f1 /etc/passwd - Lists all user accounts on the system by extracting
usernames from the /etc/passwd file.
13. cut -d: -f1 /etc/group - Displays all group names on the system by extracting them
from the /etc/group file.
14. id username - Provides detailed information about a user, including their UID, GID,
and group memberships.
15. groups username - Lists all the groups that the specified user is a member of,
showing their permissions and access.

EXPERIMENTATION:

Part 1: User Management


1. How would you create a new user named student with a home directory and set their
default shell to /bin/bash?

2. How can you set the password for the student user to password123?
3. How would you add the student user to the sudo group?
4. Which command would you use to display detailed information about the student
user, including their UID, GID, and group memberships?
5. How would you remove the student user and delete their home directory?

Part 2: Group Management


1. How would you create a new group named developers?

2. How can you create a new user named devuser and add them to the developers group?
3. Which command would you use to verify if devuser is a member of the developers
group?
4. How would you rename the developers group to devteam?
5. How would you delete the devteam group from the system?

You might also like