# Ensure local interactive user home directories are configured

The existence of a home directory for every interactive user is a fundamental requirement for a functional Linux system. The home directory serves as the primary location for user-specific configuration files, scripts, and personal data. Without a home directory, users may fail to log in, or their sessions may be unstable, leading to application errors and potential data loss. This setting ensures system integrity and a stable user environment. The audit script verifies this by checking the home directory path specified in '/etc/passwd' for each interactive user. The remediation script creates any missing directories, ensuring they have the correct ownership and permissions, thereby restoring proper functionality for the affected user accounts. A state of 'Compliant' is the only acceptable configuration across all security levels (Basic, Moderate, and Strict) because this is a binary state of correctness. An account is either correctly configured with a home directory or it is broken; there is no intermediate level of security or functionality.

## Recommended State Configuration

| Security Level | Value |
|----------------|-------|
| **Basic** | `['Compliant']` |
| **Moderate** | `['Compliant']` |
| **Strict** | `['Compliant']` |
| **Type** | `ENUM` |

## Audit Script Working

Bash script that iterates through all local users defined in '/etc/passwd' with a UID of 1000 or greater and a valid login shell (not '/sbin/nologin' or '/bin/false'). For each user, the script must check if their home directory, as specified in the sixth field of their '/etc/passwd' entry, exists. The script must output only the string 'Compliant' if all such users have an existing home directory, or 'Non-Compliant' otherwise.

## Remediation Script Working

Bash script that accepts a single positional argument, which must be the string 'enforce'. The script will identify all local interactive users (UID >= 1000, valid login shell) whose home directory does not exist. For each of these users, the script must create the home directory, set the correct ownership to the user and their primary group, and apply appropriate permissions (e.g., 750). Using 'mkhomedir_helper <username>' is the recommended method. The script must output only the string 'true' on successful creation of all missing directories, or 'false' if the script fails or the input argument is invalid.

