Insert a user in the sudoers file in Linux

The sudoers file is a file which tells the system what users can make use of the command “sudo”. If you try this command and your user isn’t authorized, you will get this error:

User not in the sudoers file. This incident will be reported

To give him privileges you have to know the root password or you need the Systems Administrator. Then, use the following commands:

su
nano /etc/sudoers

Then, find the “# User privilege specification” and insert your user (for example, user1):

# User privilege specification
root    ALL=(ALL:ALL) ALL
user1   ALL=(ALL:ALL) ALL

Then, come back to your user:

login

Now you can use the command “sudo” anytime you want.

Good coding!

Leave a Reply

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