Friday 20 December 2013

The use of usermod & userdel command in the Red Hat Linux

Hello friends I am Deepak Saini adn today i m trying to explain the usermod command
It is a important command in the User management .
lets start


1 How to lock a user account
 syntax :- usermod -L <user name>
here usermod is command and -L for lock the user and user name is the name which one we want to lock

2 How to Unlock the locked user account
 syntax :- usermod -U <user name>

How to change the secondary  group of a user
 syntax :- usermod - G <group name > <user name>

4 How to change the Primary group of a user
  syntax :- usermod -g <group name> <user name>

How to change the home directory of any user
   syntax :- usermod -h </root/Deepak <user name>
  here we are give the path of the dir which we want to make home directory

6 How to move the user Home directory in the new location
syntax :- usermod -md </root/Deepak> <user name>
 here we are give the dir where we want to move our home dir or make our home dir

7 How we apeend the splemental groups without removeing other groups
 syntax :- usermod -a -G <groupname> <username>

8 How to set the new vaule of the login name
  syntax :- usermod -l <new login name> <old login name>

9 How to change the UID of a user
  syntax :- usermod -u <UID> <user name>

10  How to change the shell  of a user
     syntax :- usermod -s  <shell name or path > <user name>
here shell path like this sbin/no login like this 

11 How to apply comment for a user
    syntax -c <comment> <user name >

12  How to set the expire date of a user account
     syntax:- usermod -e <expire date> <user name>

13 How to set duplicate UID a user
       syntax :- usermod -o <UID> <user name>

 many other option are avilabe in the usermod i m not able to explain all so plz check those self

How to use userdel command 

1 If we want to delete the account  only we not want to delete the user home directory and mail directory and etc data. Then we are using the userdel command 
syntax :- userdel <user name>

2 If we want to delete all the data of the user then we are using this command
  syntax :- userdel -rf <username>
here we are using the -rf for remove and f for forcefully delete the all files and directory

  thanks for reading and Sorry for R.I.P english
Jai Hind _/\_

0 comments:

Post a Comment