Skip to content

Verify /boot/grub/grub.cfg Permissions

An XCCDF Rule

Description

File permissions for /boot/grub/grub.cfg should be set to 600. To properly set the permissions of /boot/grub/grub.cfg, run the command:

$ sudo chmod 600 /boot/grub/grub.cfg

Rationale

Proper permissions ensure that only the root user can modify important boot parameters.

ID
xccdf_org.ssgproject.content_rule_file_permissions_grub2_cfg
Severity
Medium
References
Updated



Remediation - Ansible

- name: Gather the package facts
  package_facts:
    manager: auto
  tags:
  - NIST-800-171-3.4.5
  - NIST-800-53-AC-6(1)

Remediation - Shell Script

# Remediation is applicable only in certain platforms
if [ ! -d /sys/firmware/efi ] && dpkg-query --show --showformat='${db:Status-Status}\n' 'grub2-common' 2>/dev/null | grep -q installed && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then

chmod u-xs,g-xwrs,o-xwrt /boot/grub/grub.cfg

else