make sudo user linux code example

Example 1: add user to sudoers

usermod -aG sudo username

Example 2: 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 3: create sudo user centos

Create a new user accoun: useradd username
Set the user password: passwd username
Add the new user to the sudo group: usermod -aG wheel username
su - username, then run, echo "username  ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/username

Example 4: add user to sudoers

echo "username  ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/username

Tags:

Sql Example