LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   need HELP with editing sudoers file (https://www.linuxquestions.org/questions/linux-newbie-8/need-help-with-editing-sudoers-file-696235/)

jTm_316 01-10-2009 12:01 AM

need HELP with editing sudoers file
 
Every time i use the su apt-get command i get the message " (username) is not in the sudoers file. My question is, how do i edit the sudoers file?

n03x3c 01-10-2009 12:07 AM

Just run the

Code:

# visudo
(as root of course...) and you'll have your sudoers file opened with default editor (vi) and go the the END of the file (ctrl + g) and you'll see all examples. Following will give you all rights

Code:

username          ALL=(ALL)
FYI, same is written for root there, you'll find easy to config that file...

makuyl 01-10-2009 03:23 AM

I would change that to
Code:

username  ALL=PASSWD:ALL
If you dislike vim you can try with
Code:

export EDITOR=nano && visudo

jschiwal 01-10-2009 03:38 AM

Check if your debian system has the "wheel" group. If so add yourself to the "wheel" group and then use "visudo" as root to uncomment the line near the bottom:
Code:

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

Delete the first two characters of the line.

I don't know if nano is acceptable for visudo. Error detection may be bypassed.

makuyl 01-10-2009 03:45 AM

Umm, where did he say debian?
If debian, from man visudo:
Quote:

There is a hard-coded list of editors that visudo will use set at compile-time that may be overridden via the editor sudoers Default variable. On Debian systems, this list defaults to /usr/bin/editor, which is meant to be a system-wide default editor chosen through the alternatives system.
Normally, visudo does not honor the VISUAL or EDITOR environment variables unless they contain an editor in the aforementioned editors list. However, if visudo is configured with the --with-enveditor flag or the env_editor Default variable is set in sudoers, visudo will use any the editor defines by VISUAL or EDITOR. Note that this can be a security hole since it allows the user to execute any program they wish simply by setting VISUAL or EDITOR. Despite this potential risk, sudo on Debian is compiled with the --with-enveditor flag.


All times are GMT -5. The time now is 12:56 PM.