Ensure All User Initialization Files Have Mode 0740 Or Less Permissive
An XCCDF Rule
Description
Set the mode of the user initialization files to 0740
with the
following command:
$ sudo chmod 0740 /home/USER/.INIT_FILE
Rationale
Local initialization files are used to configure the user's shell environment upon logon. Malicious modification of these files could compromise accounts upon logon.
- ID
- xccdf_org.ssgproject.content_rule_file_permission_user_init_files
- Severity
- Medium
- References
- Updated
Remediation - Ansible
- name: XCCDF Value var_user_initialization_files_regex # promote to variable
set_fact:
var_user_initialization_files_regex: !!str <xccdf-1.2:sub xmlns:xccdf-1.2="http://checklists.nist.gov/xccdf/1.2" idref="xccdf_org.ssgproject.content_value_var_user_initialization_files_regex" use="legacy"/>
tags:
- always
Remediation - Shell Script
var_user_initialization_files_regex='<xccdf-1.2:sub xmlns:xccdf-1.2="http://checklists.nist.gov/xccdf/1.2" idref="xccdf_org.ssgproject.content_value_var_user_initialization_files_regex" use="legacy"/>'
readarray -t interactive_users < <(awk -F: '$3>=1000 {print $1}' /etc/passwd)
readarray -t interactive_users_home < <(awk -F: '$3>=1000 {print $6}' /etc/passwd)