Update scripts
This commit is contained in:
@@ -34,13 +34,13 @@ fi
|
||||
|
||||
ask_ok "Create user $user with password $password?" || exit $?
|
||||
|
||||
restore="no"
|
||||
restore=0
|
||||
if [[ -d /mnt/array/home-retired/$user ]]; then
|
||||
ask_ok "Restore user $user's files from /mnt/array/home-retired/$user?" && restore="yes"
|
||||
ask_ok "Restore user $user's files from /mnt/array/home-retired/$user?" && restore=1
|
||||
fi
|
||||
|
||||
samba="no"
|
||||
ask_ok "Enable shared file access for user $user?" && group_str="smbgrp," && samba="yes"
|
||||
samba=0
|
||||
ask_ok "Enable shared file access for user $user?" && group_str="smbgrp," && samba=1
|
||||
|
||||
ask_ok "Make $user an admin?" && \
|
||||
group_str+="wheel"
|
||||
@@ -48,7 +48,7 @@ ask_ok "Make $user an admin?" && \
|
||||
useradd_cmd+=("-G" "$group_str")
|
||||
useradd_cmd+=("$user")
|
||||
|
||||
if [[ "$restore" == "yes" ]]; then
|
||||
if (( restore )); then
|
||||
if rsync -av --progress=info2 /mnt/array/home-retired/"$user" /home/"$user"; then
|
||||
ask_ok "User $user's files successfully restored, remove backup at /mnt/array/home-retired/$user?" && \
|
||||
rm -rf /mnt/array/home-retired/"$user"
|
||||
@@ -60,12 +60,12 @@ fi
|
||||
echo "$user":"$password" | chpasswd
|
||||
|
||||
|
||||
if [[ "$samba" == "yes" ]]; then
|
||||
if (( samba )); then
|
||||
(echo "$password"; echo "$password") | smbpasswd -a -s "$user"
|
||||
fi
|
||||
|
||||
ask_ok "Prompt user to reset password on next login?" &&
|
||||
sudo passwd --expire "$user"
|
||||
passwd --expire "$user"
|
||||
|
||||
# TODO check if centos 9 does by default
|
||||
# Add subuids & subgids for container namespace
|
||||
|
||||
Reference in New Issue
Block a user