nerdexam
Linux_Foundation

LFCS · Question #767

You have a user whose account you want to disable but not remove. What should you do?

The correct answer is D. Edit /etc/passwd and insert an * after thefirst. Inserting an asterisk (*) into the password field of /etc/passwd or /etc/shadow effectively disables the account by making the password invalid.

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

Question

You have a user whose account you want to disable but not remove. What should you do?

Options

  • AEdit /etc/gshadow and just remove his name.
  • BEdit /etc/passwd and change all numbers to 0.
  • CEdit /etc/shadow and remove the last field.
  • DEdit /etc/passwd and insert an * after thefirst : .
  • EEdit /etc/group file and put a # sign in front of his name.

How the community answered

(47 responses)
  • A
    4% (2)
  • C
    2% (1)
  • D
    89% (42)
  • E
    4% (2)

Why each option

Inserting an asterisk (`*`) into the password field of `/etc/passwd` or `/etc/shadow` effectively disables the account by making the password invalid.

AEdit /etc/gshadow and just remove his name.

Editing `/etc/gshadow` to remove a user's name would only affect group memberships for shadowed groups, not disable the user's login.

BEdit /etc/passwd and change all numbers to 0.

Changing all numbers to 0 in `/etc/passwd` would corrupt the user's UID, GID, and other fields, potentially rendering the account unusable and causing system issues, rather than simply disabling login.

CEdit /etc/shadow and remove the last field.

Removing the last field from `/etc/shadow` (typically the expiry date) would not disable the password or account.

DEdit /etc/passwd and insert an * after thefirst : .Correct

Inserting an asterisk (`*`) immediately after the first colon in the user's entry in `/etc/passwd` (or more commonly, replacing the encrypted password hash in `/etc/shadow` with `*` or `!`) makes the password invalid for authentication, effectively disabling the account without removing it.

EEdit /etc/group file and put a # sign in front of his name.

Editing `/etc/group` and commenting out a user's name with `#` would not disable their login, it would only affect their group memberships.

Concept tested: Disabling a user account

Source: https://linux.die.net/man/5/passwd

Topics

#User accounts#Account disabling#/etc/passwd#Security

Community Discussion

No community discussion yet for this question.

Full LFCS Practice