How do I add a user to the sudoers file? [duplicate]

Possible Duplicate:
How do I add a user to the sudoers file?

I already know that I should:

  • run visudo
  • be logged in as root

But then what changes should I make to the sudoers file?

I don’t understand all the complexity of the sudoers file, and I don’t want to understand it. Therefore I am only able to formulate my question in the language of a beginner: for example, I cannot say what hosts I want it to work on, because I don’t understand what that means.

I want to run any command by prefixing it with sudo, then typing in my password. I don’t want anything special, I just want the simple, most likely answer to this question. I want an expert to look at this question and think, ‘He probably wants that.’

Answer

most sudoers files start out with a line in them that looks like this:

## Allow root to run any commands anywhere 
root    ALL=(ALL)   ALL

so you want to add a line like this:

<USERNAME> ALL=(ALL) ALL

if you use visudo it wont let you save the file if you have the syntax incorrect.

It’s likely you dont need to edit the sudoers files at though as you should also have a line like this

## Allows people in group wheel to run all commands
# %wheel    ALL=(ALL)   ALL

So just add the user to the group

Attribution
Source : Link , Question Author : houtsnip , Answer Author : Sirex

Leave a Comment