Table of contents
We discussed Standard Streams and its types with examples yesterday. Today, we'll look at how Linux handles or manages many users. We'll also look at how to modify a user's file permissions.
Linux User Management ๐จโ๐ป
User is a concept in Linux that has the ability to change files and carry out various activities. Every OS assigns users a special identifier known as a uid. For the root user uid is 0. There is also concept of user groups in Linux. Let's say your company has several teams, such as a Web development team, a DBMS team, and a DevOps team. What will you do if you want to manage all the users from several teams?
You will make several user groups for these various teams and grant them the rights necessary for their job.
Let's check few commands:
pwd
: It will show current working directory.I know I covered this in my previous blogs but this is also useful to check current user also.
Here home
is home directory and shivlalsharma
is my current working directory which is also my username
.
sudo
: It will grant the user system-wide root access. The root user has superuser level access, allowing him to access, alter, and stop any running process.
From the image above, we can surmise that some files in the Linux system require root user access in order to view them. By the way, this is a system file called \etc\shadow
that holds all of the users' encrypted passwords.
You can use sudo su
to create a superuser terminal session if you want to stay in that position for a long time.
sudo useradd "name"
: It will create a new user and add it to the current usergroup.
From the image, we added new user shivay
in the usergroup. You can cross verify with the help of sudo cat /etc/passwd/
.
sudo userdel "name"
: It will delete the user from the usergroup.
sudo passwd name
: User can change it's password using this.
Resources ๐
Ending Credits ๐
Okay, so today we looked over to the Linux user management and few commands. See you next week with a new Linux topic.