2.2.3 Ensure the NGINX service account has an invalid shell

Information

The NGINX service account must be configured with an invalid login shell to prevent interactive access.

The NGINX service account is strictly for running daemon processes. Assigning it a valid login shell (like /bin/bash ) unnecessarily expands the attack surface. If an attacker compromises the account credentials (or adds an SSH key), a valid shell facilitates interactive system access. Setting the shell to /sbin/nologin or /bin/false ensures that even with valid credentials, the system immediately rejects a login attempt.

Solution

Change the login shell for the identified user to /sbin/nologin :

usermod -s /sbin/nologin nginx

(Replace nginx with the actual user)

Impact:

None. Service accounts do not require interactive login capabilities for normal operation.

See Also

https://workbench.cisecurity.org/benchmarks/18528

Item Details

Category: CONFIGURATION MANAGEMENT, SYSTEM AND SERVICES ACQUISITION

References: 800-53|CM-2, 800-53|CM-6, 800-53|CM-7, 800-53|CM-7(1), 800-53|CM-9, 800-53|SA-3, 800-53|SA-8, 800-53|SA-10, CSCv7|5.1

Plugin: Unix

Control ID: 2421cccc3ade00e97656c4edb7becffcac250309db9f3ea5cee13e4ac6f47ddd