Make user functions more robust

This commit is contained in:
2023-04-07 10:37:03 -04:00
parent 1bde2a2478
commit 49365cb712
3 changed files with 11 additions and 12 deletions

View File

@@ -26,15 +26,15 @@ fi
ask_ok "Create user $username with password $password?" || exit $?
restore="no"
if [[ -d /mnt/array/home-retired/"$username" ]]; then
if [[ -d /mnt/array/home-retired/$username ]]; then
ask_ok "Restore user $username's files from /mnt/array/home-retired/$user?" && restore="yes"
fi
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"
group_str+=",wheel"
useradd_cmd+=("-G" "$group_str")
useradd_cmd+=("$username")