05 Chapter 03
05 Chapter 03
05 Chapter 03
Groups
Section 1: Describe User and Group concepts
What is a user?
A user account provide security boundaries between different people and programs that can run
commands.
Users have user names to identify them to human users. The system uses UID which is assigned to
them.
User accounts are fundamental to system security. Every process on the system run as a particular
user. Every file has a particular user as its owner. With the ownership, the system enforces access
control for users of the files. The user that is associated with running process determines the files
and directories that are accessible to that process.
Super user
System user
Regular user
Super user: The super user account administers the system. The super user name is root and the
account has a UID of 0.
System user: The system user account are used by processes that provide support services.
Regular user: Most users have regular user accounts for their day-to-day work.
#id shows the information about the current logged in user.
#ps –au shows the running process in the current shell. –a all process –u to view user that is
associated with the process.
The system uses the /ect/passwd file to store information about local users. The file is divided into
seven colon-seperated fields.
#cat /etc/passwd
user01:x:1000:1000:user one:/home/user01:/bin/bash
x the users encrypted password was stored here, this is now a placeholder
User one a brief comment, description or the real name for this user
/bin/bash The default shell program for this user that runs at login. Some accounts use the
/sbin/nologin shell to disallow interactive login with that account.
What is a group?
A group is a collection of users that need to share access to files and other system resources. Groups
can be used to grant access to files to set of users instead a single user. The system uses GID which is
assigned to them.
The system user /etc/group file to store information about local groups.
Each line in the /etc/group file contains information about one group. Each group entry is divided
into four colon-separated fields.
#cat /etc/group
group01:x:10000:user01,user02,user03
user01,user02,user03 a list of users that are members of this group as a secondary group
When creating a regular user, a group is created with the same name as the user to be primary
group of the user.
Users might also have secondary groups. Membership in secondary group is stored in the /etc/group
file. Users are granted access to files based on whether any of their groups have access, regardless of
whether the groups are primary or secondary.
Password:
$su –
Sudo requires users to enter their own password authentication. They need not know the root
password.
$su – usero1
Password: <password>
Authentication failure
Configure sudo
The /etc/sudoers file is the main configuration file for the sudo command.
#visudo command to edit the sudo file. It also validates the file for any syntax errors.
Syntax
%wheel ALL=(ALL:ALL) ALL
%wheel string is the user or group that the rule applies to. The % symbol specifies a group.
ALL=(ALL:ALL) 1st all -> on any host 2nd all -> users in wheel group can run commands as any other
users and any other group
All It specifies that the users in the wheel group can run any command.
#vim /etc/sudoers
It sets up the user’s home directory and account information and creates a private group for the user
called <username>
# useradd -u 2000 -c “production user” <username> to create user with UID and real name
# userdel <username> just deletes the username from /etc/passwd. It becomes a security risk if
the same user or different user with same UID is created. The new user will own users file.
New password:
Retype password:
UID Ranges
UID 0 : The superuser(root) account UID
UID 201 to 999: UID assigned to system processed that do not own files on this system. Software
that requires an unprivileged UID is dynamically assigned UID from this available pool.
There is no difference between primary and secondary group for accessing files. The only difference
is when the user created a file. The user’s primary group is used for new file’s group ownership.
# gpasswd group01
Password: redhat
# cat /etc/shadow
-M maximum days
-W warning days
-I Inactive days
-E End date
# chage –d 0 user01