Skip to content

Verify User Who Owns /etc/sudoers.d Directory

An XCCDF Rule

Description

To properly set the owner of /etc/sudoers.d, run the command:

$ sudo chown root /etc/sudoers.d 

Rationale

The ownership of the /etc/sudoers.d directory by the root user is important because this directory hosts sudo configuration. Protection of this directory is critical for system security. Assigning the ownership to root ensures exclusive control of the sudo configuration.

ID
xccdf_org.ssgproject.content_rule_directory_owner_etc_sudoersd
Severity
Medium
References
Updated



Remediation - Ansible

- name: Ensure owner on directory /etc/sudoers.d/
  file:
    path: /etc/sudoers.d/
    state: directory
    owner: '0'
  tags:

Remediation - Shell Script

find -H /etc/sudoers.d/ -maxdepth 1 -type d -exec chown -L 0 {} \;