fix(sudo): For wheel group as sudoer, check and creates the sudoers

directory & file
This commit is contained in:
Pratik Tripathy
2025-10-13 12:08:00 +05:30
parent 40be32107e
commit 18a8012e47

View File

@@ -335,6 +335,13 @@ user_privileged_access() {
command_status=$?
fi
if [ ! -d "$SUDOERS_DIR" ]; then
mkdir -p "$SUDOERS_DIR" >/dev/null
fi
if [ ! -f "$SUDOERS_DIR"/wheel ]; then
touch "$SUDOERS_DIR"/wheel >/dev/null
fi
echo "%wheel ALL=(ALL) ALL" >"$SUDOERS_DIR"/wheel
elif getent group sudo >/dev/null 2>&1; then # Debian, Ubuntu
output=$(usermod -aG sudo "$USERNAME" 2>&1)