LFCS · Question #465
Of the ways listed, which 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. To temporarily suspend a user's ability to log in interactively, changing their default shell to /bin/false or /sbin/nologin is the best method.
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
(52 responses)- B4% (2)
- C87% (45)
- D2% (1)
- E8% (4)
Why each option
To temporarily suspend a user's ability to log in interactively, changing their default shell to `/bin/false` or `/sbin/nologin` is the best method.
Changing a user's UID would invalidate their file ownership and permissions, causing significant system issues beyond just suspending login.
Changing the user's password would prevent them from logging in unless they are given the new password, which is not a 'temporary suspension' in the same controlled manner as changing the shell.
By setting a user's shell to `/bin/false` (or `/sbin/nologin`), the system will execute this program upon login, which immediately exits with an error status, preventing the user from getting an interactive shell while keeping their account intact.
Removing the user's entry in `/etc/passwd` permanently deletes the user account, which is not a temporary suspension.
Placing `logout` in a user's profile would still allow the user to initiate a login and their shell environment, which is less secure and less controlled than preventing shell execution altogether.
Concept tested: Suspending user interactive login
Source: https://man7.org/linux/man-pages/man8/chsh.8.html
Topics
Community Discussion
No community discussion yet for this question.