LX0-104 · Question #689
What happens if the password of a user in the /etc/shadow file is prepended with the ! character?
The correct answer is E. The password becomes invalid which disables password based logins although other login. Prepending an exclamation mark (!) to a password hash in /etc/shadow disables password-based logins for that user, while other authentication methods remain functional.
Question
Options
- AWhen logging in, the user automatically gets root privileges in addition to his regular
- BThe password is inverted which allows the user to log in with any password other than the
- CThe user is disabled and all login methods, including but not limited to password based logins,
- DUpon the next log in, the user is forced to change his password.
- EThe password becomes invalid which disables password based logins although other login
How the community answered
(31 responses)- B3% (1)
- C3% (1)
- E94% (29)
Why each option
Prepending an exclamation mark (`!`) to a password hash in `/etc/shadow` disables password-based logins for that user, while other authentication methods remain functional.
Prepending `!` to a password hash does not grant root privileges; its function is to disable password authentication.
The password is not inverted; instead, the `!` character explicitly marks the password as disabled, preventing any successful password-based login.
This action disables password-based logins specifically; it does not necessarily disable all login methods, as SSH key-based authentication or other methods might still be available.
Disabling a password with `!` prevents login attempts with a password and does not force the user to change their password upon the next login.
When the password field in `/etc/shadow` begins with an `!` character, the system renders the password hash invalid, effectively disabling all password-based login attempts for that specific user. However, other authentication mechanisms, such as SSH key-based authentication, would still work if correctly configured for the user.
Concept tested: Disabling Linux user password logins
Source: https://man7.org/linux/man-pages/man5/shadow.5.html
Topics
Community Discussion
No community discussion yet for this question.