Which command is used to lock a user account in Linux?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Boost your Linux skills with the CompTIA Linux+ Certification Exam simulator. Engage with multiple choice questions and detailed feedback. Master Linux concepts and prepare for your exam with confidence!

The command used to lock a user account in Linux is indeed associated with usermod, but the specific flag to achieve this is not correctly reflected in the choice provided.

To lock a user account, the correct command is typically usermod -L username, where -L specifically signifies that the account should be locked. Locking a user account prevents the user from logging in by placing a special character in the user's password field in the /etc/shadow file, effectively disabling authentication.

The options listed relate to different functionalities:

  • The flag -u changes the user ID of the specified account.
  • The flag -l is used to change the login name of the user.
  • The flag -d primarily updates the home directory for the user.
  • The flag -e sets an expiration date for the user's account.

None of these commands lock the account in the manner that usermod -L does. Therefore, while B is selected, it does not accurately represent the command for locking a user account, and a re-examination of the commands associated with user management in Linux will clarify their respective purposes.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy