Manual of The Experiment 1.4
Manual of The Experiment 1.4
Manual
In this practical, we all are going to discuss the user and session management commands. As
the name suggests, these all commands will be related to creating users, removing users and
managing their sessions. Along with user management, we will also learn about the group
management commands. So, let's start with the commands for managing users and their
sessions.
a. Creating and managing users and groups using useradd, userdel, groupadd and
passwd:
Users can be created in 3 different ways. First, by using graphical user interface, second,
command line tools, third, edit the local configuration files. We are going to discuss the
Second way here i.e. by using command line tools. So, the commands to create and manage
users are as follows:
1. useradd: Using this command, we can add users to the linux operating system.
Syntax: $useradd name_of_user
Output:
2. su: It stands for super user.
Syntax: $su
Output:
4. usermod: You can modify the properties of a user with the usermod command.
Syntax: $usermod
Output:
5. passwd: Passwords of users can be set with the passwd command. Users will have to
provide their old password before twice entering the new one.
Syntax: $passwd
Output:
Note: Configuration file, where the information about the users is placed is /etc/passwd.
3. groupmod: You can change the group name with the groupmod command.
Syntax: groupmod newname oldname
Output:
4. Groupdel: You can permanently remove a group with the groupdel command.
Syntax: groupdel GroupName
Output:
Note: Configuration file, where the information about the groups are placed is /etc/group.
(b) Controlling Access to Files with Access Control Lists (ACL) using chmod, chgrp and
chown
Access Control Lists came to existence in order to protect files and directories, File systems
supporting access control lists, or acls, have to be mounted with the acl option listed in
/etc/fstab.
3. chmod: This command is used to change the permissions. There are 3 types of users
to whom 3 types of permissions can be granted.
3 types of permissions are Read, Write and Execute
3 types of users are Users, Groups and Others
4. chgrp: It change the group owner of a file using the chgrp command.
Syntax: $chgrp GroupName FileName
Output: chgrp hope file.txt
It will Change the owning group of the file file.txt to the group named hope.
5. chown: The user owner of a file can be changed with chown command.
Syntax: $chown NewOwnerName FileName
Output: sudo chown myuser myfile.txt
This command will change the owner of file myfile.txt to myuser
References:
1. https://www.computernetworkingnotes.com/rhce-study-guide/linux-group-
management-explained-with-examples.html
2. https://devconnected.com/how-to-list-users-and-groups-on-linux/
3. http://www.yourownlinux.com/2013/09/chmod-basics-of-filesdirectories.html