Skip to content

Verify that system commands directories are group owned by root

An XCCDF Rule

Description

System commands files are stored in the following directories by default:

/bin
/sbin
/usr/bin
/usr/sbin
/usr/local/bin
/usr/local/sbin
All these directories should be owned by the root group. If the directory is found to be owned by a group other than root correct its ownership with the following command:
$ sudo chgrp root DIR

Rationale

If the operating system allows any user to make changes to software libraries, then those changes might be implemented without undergoing the appropriate testing and approvals that are part of a robust change management process. This requirement applies to operating systems with software libraries that are accessible and configurable, as in the case of interpreted languages. Software libraries also include privileged programs which execute with escalated privileges. Only qualified and authorized individuals must be allowed to obtain access to information system components for purposes of initiating changes, including upgrades and modifications.

ID
xccdf_org.ssgproject.content_rule_dir_groupownership_binary_dirs
Severity
Medium
References
Updated



Remediation - Shell Script

find -H /bin/  -type d -exec chgrp 0 {} \;
find -H /sbin/  -type d -exec chgrp 0 {} \;
find -H /usr/bin/  -type d -exec chgrp 0 {} \;
find -H /usr/sbin/  -type d -exec chgrp 0 {} \;
find -H /usr/local/bin/  -type d -exec chgrp 0 {} \;
find -H /usr/local/sbin/  -type d -exec chgrp 0 {} \;

Remediation - Ansible

- name: Ensure group owner on /bin/ recursively
  file:
    path: /bin/
    state: directory
    recurse: true
    group: '0'