LX0-104 · Question #110
Which of the following steps prevents a user from obtaining an interactive login session?
The correct answer is A. Run the command chsh -s /bin/false with the user name. Changing a user's login shell to /bin/false or /sbin/nologin effectively prevents them from starting an interactive shell session, restricting accounts to non-interactive tasks or system services.
Question
Options
- ARun the command chsh -s /bin/false with the user name.
- BSet the UID for the user to 0.
- CRemove the user from the group staff.
- DAdd the user to /etc/noaccess.
- ECreate a .nologin file in the user's home directory.
How the community answered
(21 responses)- A76% (16)
- B10% (2)
- C10% (2)
- E5% (1)
Why each option
Changing a user's login shell to /bin/false or /sbin/nologin effectively prevents them from starting an interactive shell session, restricting accounts to non-interactive tasks or system services.
The chsh command modifies a user's login shell. Setting the shell to /bin/false or /sbin/nologin ensures that when the user attempts to log in, no interactive shell is spawned, thus preventing an interactive session.
Setting UID to 0 would make the user a root user, granting maximum privileges, not preventing login.
Removing a user from the 'staff' group only affects group-based permissions, not login capability.
The /etc/noaccess file is not a standard Linux mechanism for preventing user login.
Creating a .nologin file in a user's home directory does not prevent login; /etc/nologin (system-wide) can, but not a user-specific one.
Concept tested: Preventing interactive user login on Linux
Source: https://linux.die.net/man/1/chsh
Topics
Community Discussion
No community discussion yet for this question.