nerdexam
LPI

102-500 · Question #3

Which of the following steps prevents a user from obtaining an interactive login session?

The correct answer is B. Running the command chsh -s /bin/false with the user name. Setting a user's shell to /bin/false (via chsh -s /bin/false username) prevents interactive login because the login process executes the shell after authentication - /bin/false immediately exits with a failure code, dropping the connection before a session is established. A is…

Administrative Tasks

Question

Which of the following steps prevents a user from obtaining an interactive login session?

Options

  • ASetting the UID for the user to 0.
  • BRunning the command chsh -s /bin/false with the user name.
  • CRemoving the user from the group staff.
  • DAdding the user to /etc/noaccess.
  • ECreating a .nologin file in the user's home directory.

How the community answered

(27 responses)
  • B
    78% (21)
  • C
    11% (3)
  • D
    4% (1)
  • E
    7% (2)

Explanation

Setting a user's shell to /bin/false (via chsh -s /bin/false username) prevents interactive login because the login process executes the shell after authentication - /bin/false immediately exits with a failure code, dropping the connection before a session is established. A is wrong because UID 0 grants root privileges, not a login restriction - that would make the account more powerful, not locked out. C is wrong because group membership controls permissions and access to resources, not the ability to log in interactively. D is wrong because /etc/noaccess is not a standard Linux/Unix file that controls login access (/etc/nologin is, but it blocks all logins system-wide, not per-user). E is wrong because .nologin in a home directory is not a recognized mechanism - the system-wide /etc/nologin file is what halts logins, and it affects everyone.

Memory tip: Think "false shell = false login" - assigning /bin/false or /sbin/nologin as a user's shell is the standard, targeted way to disable interactive access for a specific account (common for service accounts).

Topics

#login shells#user access control#chsh command#authentication

Community Discussion

No community discussion yet for this question.

Full 102-500 Practice