How do you lock a user account in Linux?

Prepare for the Linux Professional Institute Certification Level 1. Use flashcards and multiple choice questions, complete with hints and explanations. Enhance your understanding and get ready to ace the exam!

Locking a user account in Linux is typically accomplished through the use of the passwd command with the -l option. This command effectively disables the user’s password, which prevents the user from logging in. When you lock a user account with passwd -l username, the system modifies the user's password in the /etc/shadow file, prepending it with an exclamation mark (or similar character), which indicates that the account is locked. The account can be unlocked later with the corresponding passwd -u username command.

The other options listed do not perform the account locking function as effectively or correctly within standard Linux systems.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy