Files
atap/ATAPAuditor/Helpers/ShellScripts/RHEL9_CIS2.0.0/2.3.3.sh
T
2026-05-11 09:15:08 +02:00

19 lines
445 B
Bash

#!/usr/bin/env bash
config_file="/etc/sysconfig/chronyd"
if [[ ! -f "$config_file" || ! -r "$config_file" ]]; then
echo "Configuration file '$config_file' is missing or not readable. Exiting."
exit 1
fi
regex_pattern="^\s*OPTIONS=\s*([^#\n\r]+\s+)?-u\s+root\b"
value="-u\s+root\b"
if grep -Eq "$regex_pattern" "$config_file"; then
echo " \"$value\" in $config_file is found"
exit 1
else
echo "\"$value\" not found or not set "
fi
exit 0