User & Group Management Concept in Linux

User & Group Management Concept in Linux

User and Group Management:-

User Management :

  1. To Create User Account:-
    #Useradd Nilesh
    where, Nilesh = Username

    Note:- If you want to create a user as a normal user then you have to follow the below command. So Basically this will create Nilesh folder in the home directory.
    #sudo useradd -m Nilesh

  2. To Create user account password:-

    #passswd Nilesh

    For switch user account:-

    #su - Nilesh

    For Logout from user account:-

    #exit
    or
    Press "Ctrl+d" key

    To delete user account:-

    #userdel Nilesh

    Note:- A normal user can not create another user without the help of sudo.

    Group Management:

    A group is a collection of user accounts that is very useful to administrators for managing and applying permission for several users.

  3. To add group account:-

    #groupadd devopsgrp

    To find groups present on the system:-

    #cat /etc/group

    If you want to find out the last three groups:-

    #tail -3 /etc/group

    To check group account property:-

    #grep devopsgrp /etc/group

    To check group admin property:-
    #grep devopsgrp /etc/gshadow

    For Delete group account:-

    #groupdel devopsgrp

    Note:

    If you want to add a single member to a group:- To add a member in a group that member must be present in your system, if the member is not created or not present in the system you are not able to add it into the group.

    For adding a single member to group:-

    #gpasswd -a ravina devopsgrp

    For adding multiple members to group:-
    #gpasswd -M ravina,priti,suman devopsgrp

    To remove group member:-

    #gpasswd -d suman devopsgrp

    To make group admin:-
    #gpasswd -A ravina devopsgrp