Skip to content

Verify that system commands directories have root as a group owner

An XCCDF Rule

Description

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

/bin 
/sbin 
/usr/bin 
/usr/sbin 
/usr/local/bin 
/usr/local/sbin
All these directories should have root user as a group owner. If any system command directory is not group owned by a user other than root correct its ownership with the following command:
$ sudo chgrp root DIR

Rationale

If the operating system were to allow 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_system_commands_group_root_owned
Severity
Medium
References
Updated



Remediation - Ansible

- name: Retrive system commands directories and set its group owner to root
  command: find -L {{ item }} ! -group root -type d -exec chgrp root '{}' \;
  with_items:
  - /bin
  - /sbin
  - /usr/bin

Remediation - Shell Script

for SYSCMDDIRS in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin
do
     find -L $SYSCMDDIRS ! -group root -type d -exec chgrp root '{}' \; 
done