To add a user to sudoers, edit the file /etc/sudoers.
Many systems come with a /etc/sudoers file that gives permission to a specific group. If your /etc/sudoers has a line that looks like one of these, you can allow a user to use
%sudo ALL=(ALL:ALL) ALL
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
The first line allows any user in the group sudo to run any command on any host as anybody. The second line does the same thing except users won’t be prompted for their password.
Lines that begin with # are comments. They are ignored when sudo reads the file. For example:
%sudo ALL=(ALL:ALL) ALL
#%sudo ALL=(ALL:ALL) NOPASSWD: ALL
If you don’t want users in the sudo group to have to enter their password when they run sudo, remove the # before the second line in the example and place one before the first like this:
#%sudo ALL=(ALL:ALL) ALL
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
If you do not wish to add them to a group, one of the examples below allows the user tyler to use sudo with and without a password, respectively.
tyler ALL=(ALL:ALL) ALL
tyler ALL=(ALL:ALL) NOPASSWD: ALL
The first column is who you are giving access to. Names preceded with % are groups. The second part (in this example ALL is the hostnames(s) they are allowed to run sudo on. ALL means any host. The next part, (ALL:ALL), specifies the user and group they are allowed to run commands as. The users are on the left side of the :, while the groups are on the right. The presence of NOPASSWD: means that the user will not be prompted for their password when they run sudo. Finally, the last ALL means they can run any command with sudo.