Skip to content

Verify User Who Owns /var/log Directory

An XCCDF Rule

Description

To properly set the owner of /var/log, run the command:

$ sudo chown root /var/log 

Rationale

The /var/log directory contains files with logs of error messages in the system and should only be accessed by authorized personnel.

ID
xccdf_org.ssgproject.content_rule_file_owner_var_log
Severity
Medium
References
Updated



Remediation - Shell Script

find -H /var/log/ -maxdepth 1 -type d -exec chown 0 {} \;

Remediation - Ansible

- name: Ensure owner on directory /var/log/
  file:
    path: /var/log/
    state: directory
    owner: '0'
  tags: