Monday, February 18, 2019

rhcsa | user and group management


Objective of this part:
  • What is a group? 
  • Group management 
  • User management 
  • How to assign password to users? 
  • How to force user to change password on next logon?




rhcsa | user and group management
What is group?
 
We can say a group is a collection of users. Users are collected together with a name and the name is group. Group is actually for giving some specific permission.
Let us consider a group name “dba” and in this group we have some users like oracle, user1, user2 etc.

This group dba can give some permission to users and this is the concept of group. Hope you clear. If anything else then please feel free to comment below


 



rhcsa | user and group management
Group Management


          We have a group file and location of this group file is following below…
          [root@reyaz ~]# cd /etc/
          [root@reyaz etc]# ls -l group
          -rw-rw-r-- 1 appsdba dba 1008 Feb 11 12:02 group

linux group management




To open this group file and to see all group in this file please use this below command

[root@reyaz etc]# cat group

linux command


From above picture we see a group named “dba” and there are 2 user “appsdba” and “oracle”. Please note that there is a number 1002 and it a group ID of “dba


 
Groups add:

                Now we will create a group and for this I will use the linux command “groupadd”

    [root@reyaz etc]# groupadd test1

    [root@reyaz etc]# groupadd test2

linux command groupadd

after creating group you can check them by using the previous command .Given below again.
  [root@reyaz etc]# cat group
linux command to check group list



Groups delete:

                Now we will delete a group and for this I will use the linux command “groupadel”

    [root@reyaz etc]# groupdel test1
    [root@reyaz etc]# groupdel test2

linux command groupdel


rhcsa | user and group management 
User Management:

               
 At first we will see all the users are present in this system and their storage  location.

[root@reyaz ~]# cd /etc/
[root@reyaz etc]# cat passwd
 

linux command to check user list
 


Create User
                We can create a user by using below command
                 [root@reyaz etc]# useradd user10

                But we can create a user with some attribute also. See below
                 [root@reyaz etc]# useradd -u6001 -d /home/user10 -s /bin/bash user10
                          

linux command create user

 After creating user with some attribute you can check by using this command
                        [root@reyaz etc]# cat passwd
 
linux command to check user



User lock:

                To lock a user use below command
                [root@reyaz ~]# usermod -L user1
linux command user lock -L 




 And to unlock a user please use below command
[root@reyaz ~]# usermod -U user1

linux command -U to unlock user


rhcsa | user and group management 
How to assign password to users?

 To assign a password you have to use the linux command "passwd username"
After that system will ask you to type a new password. then again you have to write your new password. Remember one thing, you can not see your password while you are typing the password. Finally you will get a successful message.

linux command user password

rhcsa | user and group management 
How to force user to change password on next logon?

linux command to force to change password


Here in this picture "0" (zero) used to force user to change the password at the first login. 


Please comment your opinion and suggestion below.  

 

You can find me on Fiverr & LinkedIn


No comments:

Post a Comment