Add User to Sudoer

Use following command to edit the sudoer file

$ sudo visudo

The sudo command is configured through a file located at /etc/sudoers.

Note: Never edit this file with a normal text editor! Always use the visudo command instead!

Because improper syntax in the sudoers file can leave you with a system where it is impossible to obtain elevated privileges, it is important to use the visudo command to edit the file.

How To Modify the Sudoers File

use the visudo command to open the file, and file the following line
## Allow root to run any commands anywhere
root ALL=(ALL) ALL

add user  ALL=(ALL) ALL following the root  ALL=(ALL) ALL line

If you want the sudo command without password, you can change the command to

user  ALL=(ALL)  NOPASSWD:ALL

If you want to add the  whole group to sudoer, you can change the command to

user ALL=(ALL:ALL) ALL

 

Reference  Reference

Add a Comment

Your email address will not be published. Required fields are marked *

eighteen + 14 =