Before we create the user we must have to know the concept of Group .
What Is Group ?
A group is a collection of users and the purpose is to create the group is to give some certain
permission to some specific users .
Find the below commands to create the users and Groups .
Note :-All those groups and related files are kept in /etc Directory .
and also you can see the etc directory
[root@laxmi rhcsa]#cd /etc
[root@laxmi etc]#ls -l group
-rw-r--r--. l root root 1026 Jun 19 20:23 group
[root@laxmi etc]#cat group
You can see in the end there showing a digit ,This Numbers is the Group ID and this is the unique to each and every group .
Create a group
[root@laxmi etc]#groupadd barik
To see the details about group please run the below commands .
[root@laxmi rhcsa]#cd /etc/group
How To Delete a Group ?
Lets delete this group .
[root@laxmi etc]#groupdel barik
Group should be created first before you created the users otherwise you will not able to add the user in a particular group .
User Administration
Lets Create The users .
The below directory contains the users information . once you will run the below command s then you will be able to see the list of users in this directory .
[root@laxmi etc]#cat /etc/passwd
Lets Create The users .
[root@laxmi etc]#useradd -g laxmi -u1001 -d /home/laxmidhar -s /bin/ksh laxmidhar
-u means User Id
-d means This is the home directory of user
-s means shell
Lets Modify The users .
I want to change the shell of the user
[root@laxmi etc]#usermod -s /bin/bash laxmi
Lets Delete The users now .
[root@laxmi etc]#userdel laxmidhar
In here , I have created a user with a particular home directory so once you will run the above command then the user account will be deleted but still there is the home directory for that user .
So for recommendation you have to run the below command for user deletion .
[root@laxmi etc]#userdel -r laxmidhar
After run the above command you can see there is no home directory for this user .
Lets verify that .
[root@laxmi etc]#cd /home(Go in to the home directory )
[root@laxmi home]#ls -lrt
How to lock The user ?
[root@laxmi home]#usermod -L laxmi
Once you will lock the user then that user will not be able to login into the system .
How to unlock lock The user ?
[root@laxmi home]#usermod -U laxmi
How to verify that user is locked or unlocked ?
[root@laxmi home]#cat /etc/shadow
If there is showing you first exclamation sign then that user is locked and if there is showing you the second exclamation then there is no any password for the users .
To unlock this user .
[root@laxmi home]#usermod -U user1
What Is Group ?
A group is a collection of users and the purpose is to create the group is to give some certain
permission to some specific users .
Find the below commands to create the users and Groups .
Note :-All those groups and related files are kept in /etc Directory .
and also you can see the etc directory
[root@laxmi rhcsa]#cd /etc
[root@laxmi etc]#ls -l group
-rw-r--r--. l root root 1026 Jun 19 20:23 group
[root@laxmi etc]#cat group
You can see in the end there showing a digit ,This Numbers is the Group ID and this is the unique to each and every group .
Create a group
[root@laxmi etc]#groupadd barik
To see the details about group please run the below commands .
[root@laxmi rhcsa]#cd /etc/group
How To Delete a Group ?
Lets delete this group .
[root@laxmi etc]#groupdel barik
Group should be created first before you created the users otherwise you will not able to add the user in a particular group .
User Administration
Lets Create The users .
The below directory contains the users information . once you will run the below command s then you will be able to see the list of users in this directory .
[root@laxmi etc]#cat /etc/passwd
Lets Create The users .
[root@laxmi etc]#useradd -g laxmi -u1001 -d /home/laxmidhar -s /bin/ksh laxmidhar
-u means User Id
-d means This is the home directory of user
-s means shell
Lets Modify The users .
I want to change the shell of the user
[root@laxmi etc]#usermod -s /bin/bash laxmi
Lets Delete The users now .
[root@laxmi etc]#userdel laxmidhar
In here , I have created a user with a particular home directory so once you will run the above command then the user account will be deleted but still there is the home directory for that user .
So for recommendation you have to run the below command for user deletion .
[root@laxmi etc]#userdel -r laxmidhar
After run the above command you can see there is no home directory for this user .
Lets verify that .
[root@laxmi etc]#cd /home(Go in to the home directory )
[root@laxmi home]#ls -lrt
How to lock The user ?
[root@laxmi home]#usermod -L laxmi
Once you will lock the user then that user will not be able to login into the system .
How to unlock lock The user ?
[root@laxmi home]#usermod -U laxmi
How to verify that user is locked or unlocked ?
[root@laxmi home]#cat /etc/shadow
If there is showing you first exclamation sign then that user is locked and if there is showing you the second exclamation then there is no any password for the users .
To unlock this user .
[root@laxmi home]#usermod -U user1
No comments:
Post a Comment