A junior admin needs to ensure that the 'apache' user (UID 48) cannot log in via SSH or console. Which command achieves this?
Trap 1: passwd -l apache
Locks password but doesn't prevent SSH key login.
Trap 2: chage -l apache
Lists password expiry; does not restrict login.
Trap 3: usermod -e 1 apache
Sets account expiration; doesn't prevent immediate login.
- A
usermod -s /sbin/nologin apache
Sets shell to nologin, blocking interactive login.
- B
passwd -l apache
Why wrong: Locks password but doesn't prevent SSH key login.
- C
chage -l apache
Why wrong: Lists password expiry; does not restrict login.
- D
usermod -e 1 apache
Why wrong: Sets account expiration; doesn't prevent immediate login.