fbpx Linux usermod Command: Changing User Settings | Certificação Linux

Linux usermod Command: Changing User Settings

📅 01/01/2019 ⏱ 3 min ✍️ Uira Ribeiro
Linuxcommands
Linux usermod Command: Changing User Settings
Exam Pass App — mais de 7.000 questões LPI, offline, em 5 idiomas, disponível no Android e na App Store
Available on
Google Play
Available on
App Store

The usermod command in Linux modifies the settings of a specific user account.

It accepts the following options:

  • -d home_directory: This option provides the full path of the user's home directory;
  • -c "user's name": This option writes to the passwd file the name of the account owner or any other important remark and comment;
  • -g group_number: This option provides the default group of the user's account;
  • -s shell: This option must provide the full path of the shell used by the account. For example /bin/bash, /bin/tcsh, /bin/false, etc;
  • -L: Locks the user account by adding the "!" sign to the password;
  • -U: Unlocks the user account, removing the "!" sign from the password.
  • -e 2019-12-31:  Indicates that the account should be deactivated on December 31, 2019. The format must be YYYY-MM-DD.

Examples:

Changes the comment, with the user name Arthur:

# usermod –c “Arthur Ribeiro” arthur

Locks the user account analima on the system no longer allowing logon:

# usermod –L analima

Expires the user account arthur on October 31, 2019:

# usermod -e 2019-10-31 arthur

You can confirm the expiration date of an account with the chage command using the "-l" option:

# chage -l arthur Last password change                                : Oct 17, 2019Password expires                                    : neverPassword inactive                                   : neverAccount expires                                     : Oct 31, 2019Minimum number of days between password change      : 0Maximum number of days between password change      : 99999Number of days of warning before password expires   : 7

Learn much more about Linux in our online course. You can enroll here. If you already have an account, or want to create one, simply log in or create your user here.

Liked it? Share

Uira Ribeiro

Prof. Uirá Ribeiro

Chair do Board do Linux Professional Institute

After years of watching professionals waste hours on simple tasks because they didn't know the right Linux tools, I decided to teach.
Today I'm the author of most of LPI's official Learning Materials and mentor to over 14,000 certified students.

See my full story →

That was just one piece. The course teaches the whole path — from your first command to exam day.

Certificação Linux — a plataforma líder em certificações Linux no Brasil
WhatsApp