This commit is contained in:
luk.lu
2022-11-15 13:11:10 +08:00
parent 107b073f18
commit 7f15783d70
5 changed files with 16 additions and 11 deletions

View File

@@ -30,7 +30,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 ] && [ $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/
@@ -44,13 +44,13 @@ echo
# 注意,由 root 为新用户创建的配置文件的 owner 是 root而不是新用户
if [ $NewUser = 'adot' ]
then
source /faronear/fon/sysconfig/home-config.sh /faronear/fon/sysconfig/nixhome /home/$NewUser
source /faronear/fon/sysconfig/home-config.sh /faronear/fon/sysconfig/nixhome $NewUser
else
echo "=== Configure $NewUser home with standard scripts? <y> for yes, <<anything else>> for no"
read -p ">>> " ConfigHome
if [ $ConfigHome ] && [ $ConfigHome = 'y' ]
then
source /faronear/fon/sysconfig/home-config.sh /faronear/fon/sysconfig/nixhome /home/$NewUser
source /faronear/fon/sysconfig/home-config.sh /faronear/fon/sysconfig/nixhome $NewUser
else
echo "--- Nothing configured."
fi