Add wheel group support to add_user function
Signed-off-by: Connor C <ceo@pixelridgesoftworks.com>
This commit is contained in:
parent
c9f52319a0
commit
93ad356dbf
|
@ -197,8 +197,15 @@ add_users() {
|
|||
echo "$USERNAME:$PASSWORD" | chpasswd
|
||||
|
||||
if prompt_yes_no "Do you want to grant sudo access to $USERNAME?"; then
|
||||
if getent group sudo >/dev/null; then
|
||||
usermod -aG sudo "$USERNAME"
|
||||
log "$USERNAME has been granted sudo access."
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user