NixOS must not allow direct login to the root account.

Severity
Group ID
Group Title
Version
Rule ID
Date
STIG Version
mediumV-268138SRG-OS-000109-GPOS-00056ANIX-00-000900SV-268138r1131081_rule2025-08-191
Description
To ensure individual accountability and prevent unauthorized access, organizational users must be individually identified and authenticated. A group authenticator is a generic account used by multiple individuals. Use of a group authenticator alone does not uniquely identify individual users. Examples of the group authenticator are the UNIX OS "root" user account, the Windows "Administrator" account, the "sa" account, or a "helpdesk" account. For example, the UNIX and Windows operating systems offer a "switch user" capability allowing users to authenticate with their individual credentials and, when needed, "switch" to the administrator role. This method provides for unique individual authentication prior to using a group authenticator. Users (and any processes acting on behalf of users) must be uniquely identified and authenticated for all accesses other than those explicitly identified and documented by the organization, which outlines specific user actions that can be performed on the operating system without identification or authentication. Requiring individuals to be authenticated with an individual authenticator prior to using a group authenticator allows for traceability of actions, as well as adding an additional level of protection of the actions that can be taken with group account knowledge.
ℹ️ Check
Verify the NixOS operating system prevents directly logging in to the root account with the following command: $ sudo passwd -S root root L 01/02/1970 -1 -1 -1 -1 If the second field in the output is not "L" or "NP", then the root account is not locked and has a password configured, and this is a finding.
✔️ Fix
Configure NixOS to ensure the root user is locked. Add the following Nix code to the NixOS Configuration, usually located in /etc/nixos/configuration.nix or /etc/nixos/flake.nix: users.mutableUsers = false; Rebuild and switch to the new NixOS configuration: $ sudo nixos-rebuild switch