usermod command examples


– Using usermod we can change the user parameters.

– To modify the users comment

                # usermod -c “test User” 

  
– To change the users home directory

                # usermod -d /home/test santosh 

  
– To change the users expiry date

                # usermod -e 2013-12-31 santosh 

  
– To change the inactivity day number, before expiry

                # usermod -f 2 santosh 

  
– To change the primary group of the user

                # usermod -g UNIX santosh 

  
– To change/add the secondary groups to the user


                # usermod -G Logicalis, IT santosh 

  
– To change the name of the user

                # usermod -l sandy santosh 

  
– To lock the user password

                # usermod -L santosh 

  
– To unlock the user password

                # usermod -U 

  
– To change the shell of the user

                # usermod -s /bin/csh santosh 

  
– To change the users ID

                # usermod -u 580 santosh 

Leave a Reply

Your email address will not be published. Required fields are marked *