From 33fe74b869c41f7620ab88da2f099d1a9ac8763e Mon Sep 17 00:00:00 2001 From: Bryan Roessler Date: Fri, 22 Oct 2021 15:52:30 -0400 Subject: [PATCH] Fix script-user-remove --- script-user-add | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) 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