nerdexam
Linux_Foundation

LFCS · Question #295

An administrator has a user whose account needs to be disabled but not removed. Which of the following should the administrator do?

The correct answer is D. Edit /etc/passwd and insert an * after the first. To disable a user account without removing it, an administrator should modify the /etc/passwd file by inserting an asterisk after the first colon in the user's entry.

Submitted by valeria.br· Apr 18, 2026User and Group Management

Question

An administrator has a user whose account needs to be disabled but not removed. Which of the following should the administrator do?

Options

  • AEdit /etc/gshadow and just remove the user name. and just remove the user? 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 the first : .
  • EEdit /etc/group file and put a # sign in front of the user name. sign in front of the user? name.

How the community answered

(29 responses)
  • B
    3% (1)
  • C
    10% (3)
  • D
    79% (23)
  • E
    7% (2)

Why each option

To disable a user account without removing it, an administrator should modify the `/etc/passwd` file by inserting an asterisk after the first colon in the user's entry.

AEdit /etc/gshadow and just remove the user name. and just remove the user? name.

Editing `/etc/gshadow` affects group membership or shadow group passwords and is not the direct method for disabling a user's login access.

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

Changing all numbers to 0 in `/etc/passwd` would corrupt the user entry, potentially affecting UID, GID, or shell, and is not a standard or safe way to disable an account.

CEdit /etc/shadow and remove the last field.

Removing the last field from `/etc/shadow` is incorrect; `/etc/shadow` primarily contains password hashes and expiry, and modifying the last field (often empty) would not disable the account.

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

Inserting an asterisk (`*`) into the password field (the second field) of a user's entry in `/etc/passwd` renders the password invalid, effectively preventing the user from logging in via password authentication. This method disables the account while preserving the user's home directory, files, and other account details.

EEdit /etc/group file and put a # sign in front of the user name. sign in front of the user? name.

Editing `/etc/group` by commenting out a username with '#' would remove the user from that group, but it wouldn't disable the entire user account from logging in.

Concept tested: Disabling user accounts in Linux

Source: https://manpages.ubuntu.com/manpages/jammy/en/man5/passwd.5.html

Topics

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

Community Discussion

No community discussion yet for this question.

Full LFCS Practice