TestOut Linux Pro 2025 – 400 Free Practice Questions to Pass the Exam

Question: 1 / 400

What command is used to lock a user account?

usermod -L username

The command to lock a user account is typically done using the `passwd -l username` option rather than `usermod -L username`. While the `usermod` command can modify user account settings, locking is more directly associated with the `passwd` command, which manages user passwords.

When using `passwd -l username`, it effectively disables the user's password by adding an exclamation mark (`!`) in front of the user's password field in the `/etc/shadow` file. This prevents the user from logging in via traditional methods since they will not be able to provide a valid password.

In contrast, `usermod -L username` is not a standard command for locking accounts across all distributions and may not achieve the desired effect. The other options listed do not represent valid commands in standard Linux distributions for locking user accounts. Thus, the correctness of using `passwd -l` stems from its established role in managing password-based authentication.

Get further explanation with Examzify DeepDiveBeta

passwd -l username

lockuser username

disable username

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy