This commit is contained in:
Luk
2024-09-14 12:13:01 +08:00
parent 9992fb331a
commit c23af842fd
6 changed files with 177 additions and 12 deletions

View File

@@ -24,7 +24,7 @@ sed -i "s|/home/$NewUser:$|/home/$NewUser:/bin/bash|g" /etc/passwd
echo "=== Allow the new user [[$NewUser]] to sudo without password? [y] for yes, [anything else] for no"
read -p ">>> " AllowSudo
if [ "$AllowSudo" == "y" ]
if [ "$AllowSudo" = "y" ]
then
#usermod -a -G sudo $NewUser # Add to sudo group # Option 1: add user to %sudo group
echo "$NewUser ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers.d/${NewUser//./-} # Option 2: add a user file into /etc/sudoers.d/