nerdexam
CompTIA

LX0-104 · 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 prevent a user from interactively logging in while preserving their account and files, modifying their shell is the most effective and least destructive method.

Security

Question

Of the ways listed, which is the best way to temporarily suspend a user's ability to interactively login?

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

(30 responses)
  • A
    7% (2)
  • B
    3% (1)
  • C
    77% (23)
  • E
    13% (4)

Why each option

To temporarily prevent a user from interactively logging in while preserving their account and files, modifying their shell is the most effective and least destructive method.

AChanging the user's UID.

Changing a user's UID (User ID) would severely impact file ownership and permissions, potentially making their files inaccessible and causing system inconsistencies.

BChanging the user's password.

Changing the user's password would prevent them from logging in with their old password, but they could still log in if they learned the new one or if an admin provided it.

CChanging the user's shell to /bin/false.Correct

Changing a user's login shell to `/bin/false` (or `/sbin/nologin`) prevents them from establishing an interactive session, as these programs immediately exit upon execution. This approach maintains the user's account, files, and permissions, allowing for easy restoration of login access by changing the shell back.

DRemoving the user's entry in /etc/passwd.

Removing the user's entry in `/etc/passwd` would effectively delete the user account, which is a permanent and highly destructive action, not a temporary suspension.

EPlacing the command logout in the user's profile.

Placing `logout` in the user's profile file (e.g., `~/.bash_profile`) would log them out immediately after login, but they might still briefly get a shell or cause issues with non-interactive processes.

Concept tested: Suspending user interactive login

Source: https://man7.org/linux/man-pages/man8/nologin.8.html

Topics

#user management#account suspension#/bin/false#interactive login

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice