LX0-104 · Question #295
An administrator has a user whose account needs to be disabled but not removed. Which of the following should the administrator do?
The correct answer is D. Edit /etc/passwd and insert an * after the first : .. To disable a user account without removing it, an asterisk should be inserted into the password field of the /etc/passwd file, making the password invalid and preventing login.
Question
Options
- AEdit /etc/gshadow and just remove the user name. and just remove the user? name.
- BEdit /etc/passwd and change all numbers to 0.
- CEdit /etc/shadow and remove the last field.
- DEdit /etc/passwd and insert an * after the first : .
- EEdit /etc/group file and put a # sign in front of the user name. sign in front of the user? name.
How the community answered
(62 responses)- A2% (1)
- B3% (2)
- C6% (4)
- D76% (47)
- E13% (8)
Why each option
To disable a user account without removing it, an asterisk should be inserted into the password field of the `/etc/passwd` file, making the password invalid and preventing login.
/etc/gshadow manages encrypted group passwords, and simply removing a username from it would not disable a user account; it's also not the correct file for user account disabling.
Changing all numbers to 0 in `/etc/passwd` is vague, destructive, and not a standard method for disabling an account; it could corrupt the entry.
/etc/shadow contains hashed passwords and password aging information. Removing the last field would not disable the account and could lead to system instability or incorrect behavior.
By inserting an asterisk (*) after the first colon in the user's entry in `/etc/passwd` (which is the password field), the system effectively makes the password invalid. This prevents the user from logging in via password authentication while keeping the account and its associated files intact.
/etc/group defines group memberships. Putting a `#` sign in front of a username in `/etc/group` would comment out that part of the line, which is not the standard way to disable a user account and might only affect group membership without preventing login.
Concept tested: Linux user account disabling
Source: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_users_and_groups/disabling-an-account_managing-users-and-groups
Topics
Community Discussion
No community discussion yet for this question.