102-500 practice question 27 of 30

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

Full set: 233 questions
Answer options
A: Use passwd -d username to give the user an empty password.
B: Use chage to expire the user account. Correct answer
C: Change the user's password.
D: Add the command exit to the user's .login file.
Correct Answer:
B. Use chage to expire the user account.
Explanation

The best method among the choices to temporarily suspend a user's interactive login is to expire the account. Using chage -E YYYY-MM-DD username to set the account expiration date to a date in the past (e.g., 1970-01-01 or simply 0) immediately blocks logins. This is a standard, effective, and easily reversible administrative action. To re-enable the account, the administrator can simply set a future expiration date or remove it entirely (chage -E -1). This is superior to manipulating passwords or shell startup files.

Why Incorrect

A: Using passwd -d deletes the password, which may allow passwordless login depending on system configuration, making the system less secure. C: Changing the user's password is a valid but less clean method, as it requires the administrator to manage the new password and restore the old one. D: Adding exit to .login is unreliable. It only affects certain shells, does not prevent non-interactive sessions (like scp), and can be bypassed.

References

1. chage(1) Linux manual page. The description for the -E, --expiredate option states it is used to "Set the date on which the user account will no longer be accessible."

2. Red Hat Enterprise Linux 8 Documentation, "Configuring basic system settings", Chapter 10, Section 10.6, "Disabling a user account". It explicitly recommends expiring the account: "# chage -E 0 username".

3. usermod(8) Linux manual page. The -e, --expiredate option provides the same functionality, confirming this is a standard method for account expiration.

Scroll to Top