LFCS · 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 administrator should modify the /etc/passwd file by inserting an asterisk after the first colon in the user's entry.
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
(29 responses)- B3% (1)
- C10% (3)
- D79% (23)
- E7% (2)
Why each option
To disable a user account without removing it, an administrator should modify the `/etc/passwd` file by inserting an asterisk after the first colon in the user's entry.
Editing `/etc/gshadow` affects group membership or shadow group passwords and is not the direct method for disabling a user's login access.
Changing all numbers to 0 in `/etc/passwd` would corrupt the user entry, potentially affecting UID, GID, or shell, and is not a standard or safe way to disable an account.
Removing the last field from `/etc/shadow` is incorrect; `/etc/shadow` primarily contains password hashes and expiry, and modifying the last field (often empty) would not disable the account.
Inserting an asterisk (`*`) into the password field (the second field) of a user's entry in `/etc/passwd` renders the password invalid, effectively preventing the user from logging in via password authentication. This method disables the account while preserving the user's home directory, files, and other account details.
Editing `/etc/group` by commenting out a username with '#' would remove the user from that group, but it wouldn't disable the entire user account from logging in.
Concept tested: Disabling user accounts in Linux
Source: https://manpages.ubuntu.com/manpages/jammy/en/man5/passwd.5.html
Topics
Community Discussion
No community discussion yet for this question.