diff --git a/script-user-add b/script-user-add index 001eba65..1b803577 100755 --- a/script-user-add +++ b/script-user-add @@ -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