Add wheel group support to add_user function

Signed-off-by: Connor C <ceo@pixelridgesoftworks.com>
This commit is contained in:
Connor C 2024-07-17 07:56:45 -06:00
parent c9f52319a0
commit 93ad356dbf

View File

@ -197,8 +197,15 @@ add_users() {
echo "$USERNAME:$PASSWORD" | chpasswd
if prompt_yes_no "Do you want to grant sudo access to $USERNAME?"; then
usermod -aG sudo "$USERNAME"
log "$USERNAME has been granted sudo access."
if getent group sudo >/dev/null; then
usermod -aG sudo "$USERNAME"
log "$USERNAME has been granted sudo access via sudo group."
elif getent group wheel >/dev/null; then
usermod -aG wheel "$USERNAME"
log "$USERNAME has been granted sudo access via wheel group."
else
log "Neither sudo nor wheel group exists. Cannot grant sudo access to $USERNAME."
fi
fi
if prompt_yes_no "Do you want to add a public key for $USERNAME?"; then