Fix script-user-remove

This commit is contained in:
2021-10-22 15:52:30 -04:00
parent 9c350ce6aa
commit 33fe74b869

View File

@@ -26,20 +26,17 @@ if [[ -d /mnt/array/home-retired/"$username" ]]; then
ask_ok "Restore user $username's files from /mnt/array/home-retired/$user?" && restore="yes"
fi
ask_ok "Make user $username an admin?" && \
group_str="wheel"
samba="no"
ask_ok "Enable shared file access for user $username?" && group_str+=",smbgrp" && samba="yes"
ask_ok "Enable shared file access for user $username?" && group_str+="smbgrp" && samba="yes"
ask_ok "Make user $username an admin?" && \
group_str=",wheel"
useradd_cmd+=("-G" "$group_str")
useradd_cmd+=("$username")
echo "Command: ${useradd_cmd[*]}"
"${useradd_cmd[@]}"
if [[ "$samba" == "yes" ]]; then
(echo "$password"; echo "$password") | smbpasswd -a -s "$username"
fi
echo "$username":"$password" | chpasswd
if [[ "$restore" == "yes" ]]; then
if rsync -av --progress=info2 /mnt/array/home-retired/"$username" /home/"$username"; then
@@ -48,7 +45,9 @@ if [[ "$restore" == "yes" ]]; then
fi
fi
echo "$username":"$password" | chpasswd
if [[ "$samba" == "yes" ]]; then
(echo "$password"; echo "$password") | smbpasswd -a -s "$username"
fi
# Add subuids & subgids for container namespace
id_offset=100000