how to add user to sudo group linux code example
Example 1: add sudo user ubuntu
# add a user and set a password
adduser USERNAME
# add user to sudoers / sudo groupe with command below
usermod -aG sudo USERNAME
Example 2: add user to sudoers
echo "username ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/username