What command would you use to lock a user account in Linux?

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

Prepare for the Red Hat Certified Architect Exam with our comprehensive quiz. Master your skills with multiple choice questions and detailed explanations. Gear up to excel!

Locking a user account in Linux is an important administrative task that can prevent unwanted access to the system. The command that is most commonly used for this purpose is the usermod command with the option to lock the account.

When using the usermod command with the -L option, it modifies the user account by adding a prefix to the user's password in the /etc/shadow file. This prefix effectively disables the password and prevents the user from authenticating using their password, thus locking the account.

The other options do not serve the primary purpose of locking a user account effectively. For instance, the passwd command with the -l option also locks a user account but is less commonly highlighted in various documentation compared to usermod. The chage command is intended for managing user password expiration and aging settings, not locking accounts, while the lockuser command does not exist in standard Linux distributions.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy