42 lines
837 B
Bash
Executable file
42 lines
837 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# NAME: Configure passwordless sudo for wheel group
|
|
# REQUIRES: sudo
|
|
|
|
set -euo pipefail
|
|
|
|
# Source common functions
|
|
source "$(dirname "$0")/../common.sh" || {
|
|
echo "[ERROR] Could not source common.sh" >&2
|
|
exit 1
|
|
}
|
|
|
|
check_requirements() {
|
|
if ! is_root; then
|
|
log_error "This script requires root privileges"
|
|
log_info "Run with: sudo $0"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
configure_sudo() {
|
|
local sudoers_file="/etc/sudoers.d/wheel"
|
|
local config_line="%wheel ALL=(ALL:ALL) NOPASSWD: ALL"
|
|
|
|
log_sudo "Configuring wheel group for passwordless sudo"
|
|
|
|
echo "$config_line" >"$sudoers_file"
|
|
chmod 440 "$sudoers_file"
|
|
|
|
log_info "Wheel group configured for passwordless sudo"
|
|
log_info "Users in wheel group can now use sudo without password"
|
|
}
|
|
|
|
main() {
|
|
init_script
|
|
|
|
check_requirements
|
|
configure_sudo
|
|
|
|
finish_script 0
|
|
}
|
|
main "$@"
|