← All rules
SOCLE-CLD-FSP-031// File ownershipmediumfilesystem state

Verify Group Who Owns shadow File

Ensures the /etc/shadow password-hash file is owned by group root (gid 0).

Checked against a path’s metadata, mode, owner, group, SUID/SGID.

A pass proves✓ running now✓ on disk✓ survives rebootthe qualified verdict →
Debian 12CIS 1.1.0Debian 13CIS 1.0.0FedoraRHEL 10 / Rocky 10 / AlmaLinux 10RHEL 8 / Rocky 8 / AlmaLinux 8CIS 4.0.0RHEL 9 / Rocky 9 / AlmaLinux 9CIS 2.0.0Ubuntu 22.04CIS 3.0.0Ubuntu 24.04CIS 1.0.0Ubuntu 26.04
One check, maps to 4 standards

A mapping is a cross-reference to where each standard places this requirement, anchored and cross-validated, not a claim of equivalence. A passing check is evidence toward these references, how to read it.

Why this rule matters

The /etc/shadow file stores password hashes for every local account. If its owning group is not root (gid 0), an unprivileged group could be granted read access, exposing hashes to offline cracking and ultimately to account takeover. Restricting group ownership to root is a prerequisite for the strict permissions (typically 0640 root:shadow or 0000) that keep the hashes secret.

What Pavois checks

Pavois resolves the file's actual group id with InSpec's file('/etc/shadow') resource and asserts gid == 0. It reads the effective ownership recorded by the filesystem (the real stat value applied right now), not a packaging manifest or a hardening script that may have drifted, so a manual chgrp or a misbehaving package post-install that changed the group is caught immediately.

only_if { file('/etc/shadow').exist? }
describe file('/etc/shadow') do
  its('gid') { should eq 42 }
end

How to verify it is applied

Run stat -c '%G %g' /etc/shadow. Expected output: root 0 (the group name may be shadow on some Debian/Ubuntu installs, in that case confirm with getent group shadow, but this rule mandates gid 0).

Inspect & investigate

Ownership changes are not logged by default. With the auditd watch enabled (auditctl -w /etc/shadow -p wa -k identity), every write or attribute change appears in /var/log/audit/audit.log; filter with grep 'key="identity"' /var/log/audit/audit.log.

Remediation

No automated remediation is wired for this rule, so it must be applied manually: chgrp 0 /etc/shadow (or chgrp shadow /etc/shadow on systems using the shadow group, then confirm gid 0 is intended). Re-run pavois harden verify afterwards.

Pavois applies this with its own harden engine, the plan below, not a shell script:

groupshadow
path/etc/shadow
resourcefile
pavois harden plan local

where the target is local, a user@host SSH alias, or a container , Docs

Impact & precautions

If the group is too permissive, password hashes can leak to non-root accounts and be cracked offline. Setting the group back to root has essentially no operational risk, passwd, login, PAM and sudo access /etc/shadow as root. Precautions: keep the matching strict mode (0640/0000) and, on Debian/Ubuntu, do not break the shadow group convention used by some tools; verify with getent group shadow before changing.

Standards mapping

StandardReferenceTypeVersionConfidence
ANSSI BP-028R50direct2.0high
CIS2.2.6, 7.1.5directper OS, see the benchmark tablehigh
NISTAC-6(1), CM-6(a)supporting800-53 Rev 5 · 800-171 Rev 2 (pinned)medium
PCI DSS2.2.6supporting4.0.1medium

Each reference is a cross-reference anchored in the upstream benchmark and cross-validated against the SCAP Security Guide and ansible-lockdown, not a claim of equivalence. Direct = a prescriptive, line-level requirement; supporting = an abstract control family (NIST) the check provides evidence toward. How to read a mapping.

Sources & references