0% found this document useful (0 votes)
65 views42 pages

Usergroup

Linux allows multiple users to access the same system simultaneously through individual user accounts. Each user should have their own account for security and privacy. User accounts can be assigned to primary and secondary groups to control file permissions. The root user is the superuser account that has full system access for administration tasks, while regular user accounts have limited access defined by their group memberships.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views42 pages

Usergroup

Linux allows multiple users to access the same system simultaneously through individual user accounts. Each user should have their own account for security and privacy. User accounts can be assigned to primary and secondary groups to control file permissions. The root user is the superuser account that has full system access for administration tasks, while regular user accounts have limited access defined by their group memberships.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 42

02/28/24

Linux is a multi-user system, meaning that more


than one person can interact with the same
system simultaneously. If multiple people use
one system, it is best to create a user account
for each person to ensure their security and
privacy.

02/28/24
02/28/24
02/28/24
02/28/24
To be able to log in as the newly created user,
you need to set the user password. You can
do that by running the passwd command
followed by the username:

02/28/24
02/28/24
Login in into ae

02/28/24
User groups
groups are collections of users

02/28/24
Linux Primary Groups

A primary group is the default group that a user


account belongs to. Every user on Linux
belongs to a primary group. A user’s primary
group is usually the group that is recorded in
your Linux system’s /etc/passwd file. When a
Linux user logs into their system, the primary
group is usually the default group associated
with the logged in account.

02/28/24
You can find a user’s primary group ID by
viewing the contents of the your system’s
/etc/passwd file.

cat /etc/passwd

02/28/24
Secondary
Once a user has been created with their primary
group, they can be added to secondary
groups. Linux system users can have a
maximum of 15 secondary groups. A Linux
system’s groups are stored in the /etc/group
file.

02/28/24
To add a user to a secondary group use the
example command. Replace
second_example_group with the group name
and example_user with the name of the user
to add to the group.

sudo usermod -a -G second_example_group


example_user

02/28/24
You can also add a user to multiple groups. The example
command adds the user example_user to the groups
second_example_group, third_example_group, and
fourth_example_group. The -a and -G options ensure that the
user is not removed from any group that the user already
belongs to.

sudo usermod -a -G
second_example_group,third_example_group,fourth_example
_gro

02/28/24
Linux File Ownership
Every Linux system have three types of owner:
1.User: A user is the one who created the file.
By default, whosoever, creates the file
becomes the owner of the file. A user can
create, delete, or modify the file.

02/28/24
1.Group: A group can contain multiple users.
All the users belonging to a group have same
access permission for a file.
2.Other: Any one who has access to the file
other than user and group comes in the
category of other. Other has neither created
the file nor is a group member.

02/28/24
User accounts are of the following main types:
the superuser, system users, and regular
users.

The superuser account administers the system.


The superuser name is root and the account
has a UID of 0. The superuser has full system
access.

02/28/24
The system user accounts are used by processes
that provide supporting services. These
processes, or daemons, usually do not need to
run as the superuser. They are assigned non-
privileged accounts to secure their files and
other resources from each other and from
regular users on the system. Users do not
interactively log in with a system user account.

02/28/24
Most users have regular user accounts for their
day-to-day work. Like system users, regular
users have limited access to the system.

02/28/24
Use the id command to show information about
the currently logged-in user:

02/28/24
02/28/24
A group is a collection of users that need to
share access to files and other system
resources. Groups can grant access to files to a
set of users instead of to a single user.

02/28/24
Like users, groups have group names for easier
recognition. Internally, the system distinguishes
groups by the unique identification number,
the group ID or GID, which is assigned to them.
The mapping of group names to GIDs is defined
in identity management databases of group
account information. By default, systems use
the /etc/group file to store information about
local groups.
02/28/24
Each line in the /etc/group file contains
information about one group. Each group
entry is divided into four colon-separated
fields.

02/28/24
02/28/24
The Superuser

Most operating systems have a superuser that


has all power over the system. In Red Hat
Enterprise Linux, it is the root user. This user
has the power to override normal privileges
on the file system, and you can use it to
manage and administer the system. For tasks
such as installing or removing software, and to
manage system files and directories, users
must escalate their privileges to the root user
02/28/24
Usually, only the root user can control most
devices, but some exceptions apply. Normal
users can control removable devices, such as
USB devices. Thus, normal users can add and
remove files and otherwise manage a
removable device, but only root can manage
hard drives by default.

02/28/24
Users and groups can be locally managed
in /etc/psswd or /etc/group

02/28/24
02/28/24
If you want to create a group with a specific
group ID (GID), use the --gid or -g option:

02/28/24
02/28/24
Change the group ID
You can change the group ID of any group with
the groupmod command and the --gid or -g
option:

$ sudo groupmod -g 1011 demo1

02/28/24
Rename a group
You can rename a group using groupmod with
the --new-name or -n option:

$ sudo groupmod -n test demo1


Verify all these changes from the /etc/group file.

02/28/24
02/28/24
For security reasons, in some cases system
administrators configure the root user not to
have a valid password. Thus, users cannot log
in to the system as root directly with a
password. Moreover, you cannot use su to get
an interactive shell. In this case, you can use
the sudo command to get root access.

02/28/24
Unlike the su command, sudo normally requires
users to enter their own password for
authentication, not the password of the user
account that they are trying to access. That is,
users who use the sudo command to run
commands as root do not need to know the
root password. Instead, they use their own
passwords to authenticate access.

02/28/24
02/28/24
view the owner of a file
Use the ls -l command to view the owner of a
file. Use the ls -ld command to view the owner
of a directory, rather than the contents of that
directory. In the following output, the third
column shows the username.

02/28/24
02/28/24
processes in the current shell
Use the ps command -a option to view all
processes with a terminal. Use the ps
command -u option to view the user that is
associated with a process. In the following
output, the first column shows the username.

02/28/24
02/28/24
02/28/24

You might also like