LFCA practice question 4 of 15
Which of the following commands can be used to lock a user’s account so that they cannot log into a Linux server without removing any files, folders, or data?
Full set: 60 questionsDomain System Administration Fundamentals
The usermod command is the standard utility for modifying an existing user account's properties. The -L (or --lock) option is specifically designed to lock a user's password. This action prepends an exclamation mark (!) to the beginning of the encrypted password hash in the /etc/shadow file, which prevents the user from authenticating via password. This method effectively locks the account from login without deleting the user's account, home directory, or any associated data. The account can be unlocked later using the usermod -U command.
A. lock: This is not a standard Linux command for locking user accounts. Utilities with this name are typically for file locking, not user account management.
C. userdel: This command is used to delete a user account. Using it would violate the requirement that no files, folders, or data be removed.
D. chmod: This command changes the permissions of files and directories. It does not have a function to lock a user's ability to log in.
1. The Linux man-pages project, usermod(8) Manual Page: The official man page for usermod describes the -L, --lock option: "Lock a user's password. This puts a '!' in front of the encrypted password, effectively disabling the password." (Source: man usermod(8))
2. Red Hat Enterprise Linux 9 Documentation, "Configuring basic system settings", Chapter 10. Managing local users and groups, Section 10.5. Modifying a user account: This official vendor documentation states, "To lock a user account, use the usermod utility with the -L or --lock option... This command prevents the user from logging in by changing the password to an invalid value."
3. Ubuntu Server Guide, "User Management", Section "Locking and Unlocking Users": This official distribution guide provides the following command and explanation: "To lock a user’s account, the usermod command can be used with the -L option... This will prevent the user from logging in."
Keep practicing
Take the free LFCA practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other LFCA practice questions
- Question 1Which measures can be taken to prevent unauthorized access to cloud instances and service…
- Question 2Which of the following is considered a best practice for hardening SSHD?
- Question 3An IT team needs to synchronize large amounts of data between two nodes on the company’s …
- Question 5Which of the following best describes serverless computing?
- Question 6A server on the network is unreachable. What is the best method to verify connectivity be…
- Question 7Which of these providers host repositories of container images?
