nerdexam
Linux_Foundation

LFCS · 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. To prevent a user from initiating an interactive login session, their default shell can be changed to a non-interactive shell like /bin/false using the chsh command.

Submitted by hans_de· Apr 18, 2026User and Group Management

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

(65 responses)
  • A
    89% (58)
  • C
    2% (1)
  • D
    3% (2)
  • E
    6% (4)

Why each option

To prevent a user from initiating an interactive login session, their default shell can be changed to a non-interactive shell like `/bin/false` using the `chsh` command.

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

Changing a user's login shell to `/bin/false` (or `/sbin/nologin`) with `chsh -s /bin/false <username>` effectively prevents them from starting an interactive shell session, as `/bin/false` simply exits immediately. This is a common method for disabling interactive logins for service accounts.

BSet the UID for the user to 0.

Setting a user's UID to 0 would grant them root privileges, not prevent them from logging in; it would give them full system access.

CRemove the user from the group staff.

Removing a user from a specific group like `staff` only affects their group-based permissions, not their ability to log in interactively.

DAdd the user to /etc/noaccess.

`/etc/noaccess` is not a standard Unix/Linux mechanism for preventing user logins; this might be specific to other Unix variants or non-standard configurations.

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

Creating a `.nologin` file in a user's home directory does not universally prevent interactive login sessions; the `/etc/nologin` file typically applies globally to prevent *all* non-root users from logging in.

Concept tested: Linux user account security (disabling interactive login)

Source: https://man7.org/linux/man-pages/man1/chsh.1.html

Topics

#User management#Login shells#Account security

Community Discussion

No community discussion yet for this question.

Full LFCS Practice