nerdexam
CompTIA

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.

Administrative Tasks

Question

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

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)
  • A
    76% (16)
  • B
    10% (2)
  • C
    10% (2)
  • E
    5% (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.

ARun the command chsh -s /bin/false with the user name.Correct

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.

BSet the UID for the user to 0.

Setting UID to 0 would make the user a root user, granting maximum privileges, not preventing login.

CRemove the user from the group staff.

Removing a user from the 'staff' group only affects group-based permissions, not login capability.

DAdd the user to /etc/noaccess.

The /etc/noaccess file is not a standard Linux mechanism for preventing user login.

ECreate a .nologin file in the user's home directory.

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

#user accounts#login control#chsh command

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice