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

Image Description

Question: 1 / 400

Which command can be used to lock a user account in Linux?

usermod -L [username]

The command used to lock a user account in Linux is best represented by the option that utilizes "passwd" with the "-l" option. When you run the command "passwd -l [username]", it effectively locks the specified user's account by placing a '!' at the beginning of the encrypted password in the /etc/shadow file, which prevents the user from being able to log in using their password.

In contrast, the "usermod -L [username]" command is also a valid method to lock an account, functioning similarly by locking the user's password so that they cannot log in. This modifies the user account directly, which is why it is considered correct. The "lockuser [username]" command does not exist in standard Linux distributions, making it invalid, and "userdel [username]" would delete the user account rather than lock it, making it unsuitable for the task of locking an account.

Thus, while both the passwd and usermod commands can achieve the goal of locking a user account, the option that is most straightforward and commonly referenced is the one utilizing "passwd."

Get further explanation with Examzify DeepDiveBeta

passwd -l [username]

lockuser [username]

userdel [username]

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy