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

Verify Owner on SSH Server config file

Ensures the SSH server configuration file /etc/ssh/sshd_config is owned by root (uid 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 3 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

/etc/ssh/sshd_config controls every security-relevant aspect of the SSH server: authentication methods, root login, ciphers, port and access restrictions. A misconfiguration here leads directly to a remotely exploitable host. If a non-root user owns the file, they can edit it to enable PermitRootLogin yes, weaken authentication or open a backdoor, then trigger an sshd reload, escalating a local account to remote root access. Restricting ownership to root (uid 0) ensures only the superuser can change the SSH server's policy.

What Pavois checks

Pavois asserts that the live file /etc/ssh/sshd_config has owner uid 0, skipped via only_if if absent. It reads the effective owner from the filesystem (stat), so a manual chown of the main SSH policy file is detected even when no change-management record exists. (Note: Pavois audits the SSH server's behaviour via sshd -T in other rules; this ownership rule protects the integrity of the file that sshd -T ultimately reflects.)

only_if { file('/etc/ssh/sshd_config').exist? }
describe file('/etc/ssh/sshd_config') do
  its('uid') { should eq 0 }
end

How to verify it is applied

Run stat -c '%U %u' /etc/ssh/sshd_config. Expected output: root 0. ls -l /etc/ssh/sshd_config should likewise show root as the owner.

Inspect & investigate

Ownership has no continuous log; query it with stat /etc/ssh/sshd_config. SSH service events and config-load errors appear in /var/log/auth.log (Debian/Ubuntu) or via journalctl -u ssh. sshd will refuse to start if it considers the config unsafe, logging the reason there.

Remediation

No automated harden plan is defined, so apply it manually: chown root:root /etc/ssh/sshd_config. Reinstalling openssh-server also restores correct ownership.

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

ownerroot
path/etc/ssh/sshd_config
resourcefile
pavois harden plan local

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

Impact & precautions

A non-root owner of this file can rewrite SSH policy and gain remote root access, one of the highest-leverage local-to-remote escalations. Restoring root ownership is safe and does not drop current sessions. Precaution: after correcting ownership, run sshd -t to confirm the config still parses, do not loosen the file mode (keep 0600/0644 per baseline), and keep a second SSH session or console open before reloading sshd in case of a mistake.

Standards mapping

StandardReferenceTypeVersionConfidence
ANSSI BP-028R50direct2.0high
CIS5.1.1, 5.1.2directper OS, see the benchmark tablehigh
NISTAC-17(a), AC-6(1), CM-6(a)supporting800-53 Rev 5 · 800-171 Rev 2 (pinned)medium

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