Hello, everyone, and welcome to our new listen user account management.
In this lesson, we will learn how can we manage user account in Linux?
There are a few commands that we use to manage user account.
The first one is user add is to create a new user group had to create a new group.
Use it.
Delete to delete a user that is already created.
Group Delete to delete it.
Group and use a mod, which is to modify a user.
Now, whenever we create a new user, those user management are I created.
Their record is maintained in three different files.
The first one is CP password.
Second one is at C Group and the third one is at zero.
Now remember, ETSI password is not a complete word.
Password is just past W.T. example how to run a user command, which includes all the parameters that
you have to define as as.
It goes with user add minus XI with option to add a group minus s option to give a shell environment
minus C two defined as user description minus m minus D to defined as use a home directory and the use
itself.
And as usual, home directory itself and the name of the user.
Now let's look at our Linux machine and we will practice these commands and learn these come in more
into detail.
OK.
Always.
First thing first, you need to find out who you are.
You ask yourself, Where are you?
You are in your home directory.
Perfect.
And what's inside of your home directory just to confirm you are in the right place?
Yes, you are.
When you have confirmed this just to clear screen now, we couldn't create a user call.
Let's see Spiderman.
Before I create a user, I wanted to add that user to a group that is, let's call it, superheroes.
So in order to use these commands, you have to be root.
So become root as you space a stash.
OK, the first command that we will run as user ad space by Spider-Man.
You hit enter.
It gives you the prompt back, which means it did create your user Spider-Man.
How do we verify if the if the user is created, there is a command to check if user's creed is called
ID Spider Man, and I'll tell you that there is ID assigned to the user Spider-Man and the group is
created called Spider-Man.
And the Crusades, so on.
You could also verify by going to the home directory home,
if you notice that it created right here the Spiderman, the next command that we want to learn is group
ad. I want to create a group, a new group to come and the command to add a new group as group ad.
And I wanted to name it superheroes.
It adds up.
We could verified by looking at the group file, which will come in a little bit, but if you wanted
to see it, you can just look at and see groups.
And at the bottom, you'll see it created this.
Group name superheroes.
Now I want to delete.
The user I created, Spiderman to the command to delete is user delete.
Now if you are to delete the home directory of Spiderman.
Which is right here.
You were on the command user delete with minus R as well, so would delete the the directory as well.
So it deleted the user, and let's check if it deleted the home directory.
Yes, it did delete the home directorate as well, so delete that I created and I use it before just
call Spider just for testing purposes, as you can see here.
The next command we have to do is, of course, the group delete.
So let's try to delete the group.
Let's not delete our group.
Superheroes will create a new group and a deleted just for training purposes.
So let's create group add.
No new book is called this new group, the cabal is created people verified by going to the profile
and see at the bottom, says no new group.
That's new group ID.
We could delete the new No new group group delete.
No new group.
And it's deleted, we could verify again at the bottom, see, it's gone.
The next command that we have to learn is use a mod.
This command is used to modify the user.
You go on and on, use a mod to see what it does.
It modifies a user account.
If you notice a appends it as a user to Supplementary Group C, the new values use a password to change
the home directory.
So these are the things if you wanted to do after you create a user.
So we will use this command to add our user spider Spider-Man.
Let's see if we have Spider-Man first.
Oh, we deleted Spider-Man, so let's create Spider-Man again.
You should add Spider-Man.
As soon as you add.
This user who was at Spider-Man, it automatically creates its group as well.
If you don't specify, it creates a group with the same name as user IDs.
Now I wanted to add Spider-Man to a different group as well, which is superhero.
So how do we do that user mod minus G?
Which what's the name of the group?
Super Heroes.
And the name of the user that I want to add is Spider-Man Enter.
And it is added How do we verify it?
You do cat at sea.
But instead of doing the cat and viewing the whole file above, you use grep, command and just type
spider man from Etsy Group File.
And there you go.
You will see this is the super user group, and Spider-Man is also part of that group.
This is the Spider-Man's own group name and own group in the Spider-Man has its own group and is also
belongs to a group called superheroes as well.
Now, if you notice one here, when you do this myself to your the group of Spider-Man right here is
still Spider-Man.
Why didn't change to suit superheroes?
Because it's actual group is Spider-Man that always remains Spider-Man.
It is part of the other group as well, which is superheroes.
If you want this to change, then you have to run the Command Change Group and then you specify superheroes
and then you specify Spider Man.
And remember, we have to use minus our option to cascade this permission of the group to every folder
of the Spider-Man.
So let's run this command and now see if it changes from Spider-Man to superheroes.
Yes.
See now the user's Spider-Man.
The group a superhero.
So that's how you use these five different commands.
User and user group add user delete group delete and use a modification.
And the files that it creates as information is is the first one is Etsy password.
Let's look at the Etsy password card and see password.
And you will see at the bottom as you add a new user to the Linux system, it adds the information of
the user at the bottom, at pens, at the bottom, Spiderman and the Spider.
The one I created earlier, both here and there.
The first column tells you the name.
The second one tells you the password, which is encrypted, is just give you the second one, tell
you the user ID and then the group I.D. And right here in between these two columns, we didn't specify
the description.
So it's empty.
And then here it's a home directory of the Spider-Man.
And then at the end, it's the shell the Spider-Man is using.
So that's the description of the ETSI password.
Let's look at the description of ETSI Group and ETSI Group you have.
The first is group group name and then the group password, which is the same password that is used
for anyone within that group.
And then the Group ID, the last column that you see here with a few of them, that means that these
other users are also part of the group.
Then the last file we'll look at is this see shadow that see shadow file is strictly for passwords of
users that we create.
This does not mean the password right here, right here is the actual password.
It's just encrypted, so we don't see it.
However, it does have some other parameters, like the password does not expire, and these many days
they are password length restrictions and so on.
You can view that in man command of creating uses, you'll get more information about ETSI Shadow for.
Again, if you are Pacific above one user, let's say you just wanted to know the information about
Spider-Man in Etsy password.
You do scrap Spider-Man Etsy password and you will only get the information about your matching criteria,
which is Spider-Man line.
Now we look at the last example, which is the example that is mostly used in the corporate environment
that they were run.
One big command that will take care of all the parameters.
So that's created a new user, the user.
Add.
Minus G to specify the group, which is we already have a group super heroes.
And let's look at let's minimize this so we could move up and view all our command.
OK.
OK, superheroes minus s means the shell that you want to give their different shells, there are bin
bash.
One shell will cover that later.
Minus C is the description you have to specify the description superheroes you wanted to create iron
mantle Iron Man
character just a description.
Nothing more than that then minus n minus d and specify the home directory, which is home.
Iron Man space Iron Man.
This will create a user Iron Man with all the parameters he has specified and how to verify you just
do it, Iron Man.
And you'll see that Iron Man is there and is part of the group superheroes.
And you could also view it in fancy password file.
And you see at the bottom, it's there.
Now, one thing that we do have to cover every time you have to create a user, make sure you create
its password.
So the command to create a password is just simple password.
Man, enter specify the password and the password that I've specified it, says Password Fields Dictionary
Check.
It is based on a dictionary.
You could ignore that as long as you running as a root.
But if you are not rooted, then it's going to force you to change the password that is not based on
dictionary.
But again, your root, you can do anything.
So this concludes our lesson for user account management.
The main the basic commands are these five commands and files that are used to managers is Etsy, Password
Group and Shadow.