LFCS · Question #272
Which of the following is the BEST way to temporarily suspend a user's ability to interactively login?
The correct answer is C. Changing the user's shell to /bin/false. The most effective way to temporarily prevent a user from interactively logging in is by changing their shell to a non-login shell.
Question
Options
- AChanging the user's UID.
- BChanging the user's password.
- CChanging the user's shell to /bin/false.
- DRemoving the user's entry in /etc/passwd.
- EPlacing the command logout in the user's profile.
How the community answered
(53 responses)- A11% (6)
- B2% (1)
- C79% (42)
- D6% (3)
- E2% (1)
Why each option
The most effective way to temporarily prevent a user from interactively logging in is by changing their shell to a non-login shell.
Changing a user's UID is a destructive action that breaks file ownership and permissions, leading to data loss or system instability, and is not a temporary suspension method.
Changing the user's password only prevents login if the user doesn't know the new password, but it doesn't fundamentally disable interactive login capability; an administrator could simply provide the new password.
Changing a user's shell to `/bin/false` (or `/sbin/nologin`) prevents them from starting an interactive shell session upon login. This method disables interactive access while preserving the user account, home directory, and other settings for potential future re-enablement.
Removing the user's entry in `/etc/passwd` permanently deletes the account and all associated metadata, which is not a temporary suspension.
Placing `logout` in the user's profile would only log them out immediately *after* they successfully log in, effectively creating an infinite login loop rather than preventing login.
Concept tested: User account management, login shells
Source: https://man7.org/linux/man-pages/man8/usermod.8.html
Topics
Community Discussion
No community discussion yet for this question.