Skip to content

Verify Permissions On /etc/sudoers File

An XCCDF Rule

Description

To properly set the permissions of /etc/sudoers, run the command:

$ sudo chmod 0440 /etc/sudoers

Rationale

Setting correct permissions on the /etc/sudoers file is important because this file hosts sudo configuration. Protection of this file is critical for system security. Restricting the permissions ensures exclusive control of the sudo configuration.

ID
xccdf_org.ssgproject.content_rule_file_permissions_etc_sudoers
Severity
Medium
References
Updated



Remediation - Ansible

- name: Test for existence /etc/sudoers
  stat:
    path: /etc/sudoers
  register: file_exists
  tags:
  - configure_strategy

Remediation - Shell Script






chmod u-xws,g-xws,o-xwrt /etc/sudoers