Thursday, December 8, 2016

usermod : Creating and Managing User Accounts

Creating and Managing User Accounts 

usermod 

From time to time, you will need to modify an existing user account. This can be
done from the command line using the usermod utility. The syntax for usermod is very similar to
that used by useradd. You enter


usermod options username 


at the shell prompt.


The options for usermod are likewise similar to those used by useradd. They include the following:


–c 
   Edits the user’s full name.


–e 
   Sets the date when the user account will be disabled. Format the date as yyyy-mm-dd.


–f 
   Sets the number of days after password expiration before the account is disabled. Use
   a value of
   –1 
   to disable this functionality.


–g 
   Sets the user’s default group.


–G 
   Specifies additional groups that the user is to be made a member of.


•  –l
   Changes the username.


–L 
   Locks the user’s account. This option invalidates the user’s password.


–m 
   Sets the user’s home directory.


–p 
   Sets the user’s password. As with the useradd command, you must specify an
   encrypted password when using the –p option with usermod. You can use the

   openssl passwd –crypt 

   command to generate an encrypted password that can be used with this option.


–s 
  Specifies the default shell for the user.


–u 
  Sets the UID for the user.

–U
   Unlocks a user’s account that has been locked.


   For example, suppose my jmcarthur user has recently married and changed her last name to
   Sanders. I could update her user account to reflect this change by entering

   usermod –l jsanders




LX0-104 Exam Objectives (K)

No comments:

Post a Comment