Saturday, August 28, 2010

How to setup sudo

To enable sudo for your user you need to edit the sudoers file and add your user to the the wheel group.
First lets edit the sudoers file.
Open a terminal and type visudo then hit enter.
Now scroll down until you get to the part of the file that looks like this:

root    ALL=(ALL)       ALL

now right under
root    ALL=(ALL)       ALL
you are going to put
your-user-name    ALL=(ALL)       ALL
After you do that the file should look like this:

root    ALL=(ALL)       ALL
your-user-name    ALL=(ALL)       ALL


If you dont want to have to type in your password when you use sudo remove the "#" from in front of:

# %wheel ALL=(ALL)       NOPASSWD: ALL
So it looks like this:
 %wheel ALL=(ALL)       NOPASSWD: ALL

Now to exit and save the sudoers file type :wq! and hit enter.

Now to add you user to the wheel group enter:
usermod -a -G wheel your-user-name

There you go sudo is now set up

No comments:

Post a Comment