2.3.1 Ensure NGINX directories and files are owned by root

Information

The NGINX configuration directory and all contained files must be owned by the root user and group to prevent unauthorized modification.

The NGINX configuration controls the security posture of the web server. If a non-privileged user (including the nginx worker user) can modify these files, they can trivially escalate privileges (e.g., by loading a malicious module or changing the user directive to root ). Ensuring that only root owns these files guarantees that configuration changes require administrative privileges.

Solution

Set the ownership of the NGINX configuration directory and files to root :

chown -R root:root /etc/nginx

(Replace /etc/nginx with the actual configuration path in case it is different)

Note: Ensure that this does not break access to specific files if you have a custom setup where external processes need write access.

Impact:

None. The NGINX master process runs as root and can read these files. The worker processes (running as nginx ) do not need write access to the configuration.

See Also

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

Item Details

Category: ACCESS CONTROL, MEDIA PROTECTION

References: 800-53|AC-3, 800-53|AC-5, 800-53|AC-6, 800-53|MP-2, CSCv7|14.6

Plugin: Unix

Control ID: 85ce2ab4f3e6c190596b5504f118405e074f8c934fe12232124b7fdb260fd308