5 Setting up and disabling “sudo”

Use the following command to learn more about sudo and how to set up the /etc/sudoers file:

man sudo  
man sudoers

I will, however, present a quick guide to let a regular user use sudo to gain root access.

First, use su to switch to the root account. Then execute the program visudo. Do not use a regular editor to open /etc/sudoers!

In this file, add the following lines:

user1 ALL=PASSWD: ALL  
  

Replace user1 with the name of the account that can gain root access.

If you want to disable sudo to root, make sure you enable su first. Then, su as root, run the command visudo, and comment out the line previously mentioned. Commenting out is putting the start-of-comment symbol (#) at the beginning of the line.