dev: automated commit - 2025-06-08 23:28:55
This commit is contained in:
parent
33106ea4a6
commit
0ab9f62ace
13 changed files with 1255 additions and 715 deletions
42
runs/sudo
Executable file
42
runs/sudo
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/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 "$@"
|
Loading…
Add table
Add a link
Reference in a new issue