Networking / Beginners

The usermod command

The usermod command modifies an existing user. It has the following syntax:

usermod [options] user-name
  • c comment: Typically, the comment is the user's full name.
  • -d home-dir: The home directory of the new user.
  • -e date: The expiration date for a logon.
  • -f time: The number of days between logons before the user is considered expired.
  • -g group: The initial logon group for the user.
  • -G groups: Additional groups the user should belong to.
  • -m: Creates the new user's home directory if it doesn't exist already.
  • -s shell-path: Specifies the user's logon shell.
  • -l: Locks an account.
  • -u: Unlocks an account.

Here's an example that changes a user's full name:

$ usermod -c 'The Beave' theodore

The userdel command

The userdel command deletes a user. It has a simple syntax:

userdel [-r] user-name

If you specify -r, the user's home directory is deleted along with the account.

[Previous] [Contents] [Next]