Add files via upload

This commit is contained in:
stornic56
2026-05-05 20:27:02 -05:00
committed by GitHub
parent 887ec4de25
commit 3178cf98ab
8 changed files with 827 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Adds user to sudo group and optionally enables pwfeedback
config_sudo() {
echo -e "${YELLOW}Configuring sudo...${NC}"
if groups "$USER" | grep -qE '\bsudo\b'; then
echo "User is already in the sudo group."
else
echo "Adding user '$USER' to sudo group..."
if sudo usermod -aG sudo "$USER"; then
echo -e "${GREEN}Done. Note: you need to log out and back in for group changes to take effect.${NC}"
else
echo -e "${RED}Failed to add user to sudo group.${NC}"
return 1
fi
fi
local answer
answer=$(whiptail --title "Sudo Password Feedback" \
--yesno "Show asterisks when typing the sudo password?" 8 60 3>&1 1>&2 2>&3)
local exitstatus=$?
if [ $exitstatus -eq 0 ]; then
echo 'Defaults pwfeedback' | sudo tee /etc/sudoers.d/pwfeedback > /dev/null
if [ $? -eq 0 ]; then
echo -e "${GREEN}Password feedback enabled.${NC}"
else
echo -e "${RED}Failed to create /etc/sudoers.d/pwfeedback.${NC}"
fi
else
echo "Skipping password feedback setting."
fi
}