diff --git a/debian-add-user.sh b/debian-add-user.sh index 2e2cf54..8720837 100755 --- a/debian-add-user.sh +++ b/debian-add-user.sh @@ -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? for yes, <> 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? for yes, <> 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 diff --git a/debian-config.sh b/debian-config.sh index 07984b9..229834b 100755 --- a/debian-config.sh +++ b/debian-config.sh @@ -91,7 +91,7 @@ echo "=== Add a new user $NewUser" source /faronear/fon/sysconfig/debian-add-user.sh $NewUser echo -echo "=== Enable xfce autologin [/etc/lightdm/lightdm.conf] as <$NewUser> for autologin or <> for no change):" +echo "=== Enable xfce autologin [/etc/lightdm/lightdm.conf] as user <$NewUser> for autologin or <> for no change):" read -p ">>> " XfceAutologinUsername if [ $XfceAutologinUsername = $NewUser ] then diff --git a/git-clone-all.sh b/git-clone-all.sh index e009034..83cff19 100755 --- a/git-clone-all.sh +++ b/git-clone-all.sh @@ -10,7 +10,7 @@ popd mkdir fon pushd fon -git clone https://git.faronear.org/npm/sysconfig sysconfig.git +git clone https://git.faronear.org/fon/sysconfig sysconfig.git git clone https://git.faronear.org/fon/www.faronear.com www.faronear.com.git git clone https://git.faronear.org/fon/yapi.faronear.org yapi.faronear.org.git git clone https://git.faronear.org/fon/git.faronear.org git.faronear.org.git diff --git a/home-config.sh b/home-config.sh index 4aeed03..467b301 100755 --- a/home-config.sh +++ b/home-config.sh @@ -34,7 +34,7 @@ fi if [ "$2" ] then - HomePath=$2 + HomePath=/home/$2 else HomePath=~ fi @@ -48,14 +48,14 @@ then read -p ">>> " CopyOrLinkScripts for homescript in $homescriptlist do - mv $homescript $homescript.backup-[$(date +%Y%m%d-%H%M%S)] + mv $homescript $homescript.backup-$(date +%Y%m%d%H%M%S) if [ "$CopyOrLinkScripts" = 'l' ] then echo "--- Linking $SourcePath/$homescript to $HomePath/$homescript ..." - ln -s $SourcePath/$homescript $HomePath + ln -s $SourcePath/$homescript ./ else echo "--- Copying $SourcePath/$homescript to $HomePath/$homescript ..." - cp -r $SourcePath/$homescript $HomePath + cp -r $SourcePath/$homescript ./ fi done echo @@ -66,12 +66,17 @@ then echo "--- Linking $SourcePath/authorized_keys to $HomePath/.ssh/authorized_keys ..." mkdir -p $HomePath/.ssh chmod 700 $HomePath/.ssh - mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup-[$(date +%Y%m%d-%H%M%S)] + chown adot:adot .ssh + mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup-$(date +%Y%m%d%H%M%S) ln -s $SourcePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys elif [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'a' ] then mkdir -p $HomePath/.ssh chmod 700 $HomePath/.ssh + if [ "$2" ] + then + chown $2:$2 $HomePath + fi if [ -L '$HomePath/.ssh/authorized_keys' ] then mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup diff --git a/import-bashrc.sh b/import-bashrc.sh index ca32272..0886dc8 100644 --- a/import-bashrc.sh +++ b/import-bashrc.sh @@ -1 +1 @@ -curl -sSL https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/.bashrc > ~/.bashrc \ No newline at end of file +curl -sSL https://git.faronear.org/fon/sysconfig/raw/branch/main/nixhome/.bashrc > ~/.bashrc \ No newline at end of file