# Ensure no files or directories without an owner and a group exist

Files and directories without a valid owner or group present a significant security risk. These 'orphaned' files can result from incomplete package removals or improper user account deletions. An attacker could potentially claim ownership of these files to store malicious tools, escalate privileges, or disrupt system operations. Ensuring all files have a valid owner is a fundamental aspect of system hygiene and security. The audit script uses the 'find' command with '-nouser' and '-nogroup' predicates to locate and count any orphaned files on the system. The remediation script also uses 'find' to locate these files but then executes the 'chown' command to assign a specified, valid owner, thereby resolving the misconfiguration. The recommended state for Basic, Moderate, and Strict levels is uniformly [0, 0]. There is no acceptable number of unowned files on a secure system. Any count greater than zero indicates a deviation from security best practices that must be remediated immediately.

## Recommended State Configuration

| Security Level | Value |
|----------------|-------|
| **Basic** | `[0, 0]` |
| **Moderate** | `[0, 0]` |
| **Strict** | `[0, 0]` |
| **Type** | `RANGE` |

## Audit Script Working

Bash script that searches the entire filesystem for files or directories that do not have a valid user or group owner. The script must output only a single integer representing the total count of these orphaned items, with no additional text or formatting.

## Remediation Script Working

Bash script that accepts a single positional argument specifying a new owner and group in the 'user:group' format (e.g., 'root:root'). The script must find all files and directories without a valid owner or group and assign them the new ownership provided in the argument. The script must output 'true' on success and 'false' on failure.

