LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to edit "sudoers" file using visudo (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-edit-sudoers-file-using-visudo-597400/)

maniac matt 11-05-2007 10:37 PM

How to edit "sudoers" file using visudo
 
Hey everyone. I am somewhat newer to linux, and i do not know how to edit my sudoers file so that my non-root user account can use tools such as wifi-radar.

On Slack Builds it says what to do, but every time i try and follow what is says, i have no luck because i don't know where to put this line:

%users ALL = NOPASSWD: /usr/sbin/wifi-radar


Here's the link: http://slackbuilds.org/repository/12...rk/wifi-radar/


Anyway i would like to add my other user account so that it has full sudo privileges similar to root.

anyone know how?

I checked the Sudoers man page, but i seem to be somewhat linux-illiterate
and didn't find any solutions...

thanks, matt.


p.s. sorry if it confusing, it is past my bed time.. good night.

Tinkster 11-05-2007 10:50 PM

Please think about what you're asking for very carefuly... if you
do what you intend any flawed application that you run can potentially
damage your system with that mechanism w/o needing a password.

More specifically that line would give every user account the
ability and the right to damage the system.


Cheers,
Tink

maniac matt 11-05-2007 11:15 PM

hmmm, let me put it this way... The biggest problem that i have is that i want to be able to use my network managers (wifi-radar and wlassistant) and as of now the only way i can access them is if i am logged in as root.


How yould i be able to access these two tools not logged in as root (becasue both require sudo to run)?

-matt

jay73 11-05-2007 11:17 PM

There should be a line like: root ALL=(ALL) ALL. You can simply create a second line like that but replacing "root" with your username.

Alternatively, you can use
%admin ALL=(ALL) ALL
In that case, however, you'll have to add yourself to the admin group (/etc/groups).

maniac matt 11-05-2007 11:33 PM

Quote:

Originally Posted by jay73 (Post 2949554)
There should be a line like: root ALL=(ALL) ALL. You can simply create a second line like that but replacing "root" with your username.

Alternatively, you can use
%admin ALL=(ALL) ALL
In that case, however, you'll have to add yourself to the admin group (/etc/groups).

So you are saying that i should be able to go into console, type viduso, to bring up mu sudoers file, then right under where is see root i can put in either

matthew ALL=(ALL) ALL

or

%admin ALL=(ALL) ALL


is there any specific spacing or anything...because i am pretty sure i tried that.. :(

hmm:$

Tinkster 11-06-2007 02:28 AM

Nope ... those should work just like that. Does visudo complain
when you try to save the file? It performs a syntax check on it,
and if it fails sanity it warns you.

That said: while "(ALL) ALL " without the NOPASSWD is a more
sane set-up you could also add a NOPASSWD: /path/to/special/file
for those two tools, and use "su - " for other (less frequent)
tasks...



Cheers,
Tink

maniac matt 11-06-2007 10:04 AM

this may sound stupid... but what is the correct way to save visudo after you edit it?

do i run visudo again?


-matt



yes, i know i am a newbie...but you gotta start somewhere.

jay73 11-06-2007 10:21 AM

I don't know, in what editor is it opened? If it is in VIM, you simply use ESC :wq to save it. In nano, it would be ctrl+o ctrl+x.

cb88 04-02-2008 10:13 PM

you can change the editor visudo uses by typing

EDITOR=nano

you can also change it back to vi or vim like this
EDITOR=vi

I recommend the nano or pico editor for you because they are easy to use i use the all the time myself they

make sure you type

username ALL ALL=(ALL) ALL

in ALL caps! :-) except for you user name of course :-)

chrism01 04-03-2008 12:22 AM

Actually, in vi(m) it's

esc :x

x= save changes & exit

w= write
q= quit

of course wq has the same effect as x ....

Stickboy06 02-26-2013 09:23 AM

I actually use the easiest way to save and exit in vi(m)
It is ZZ
The keys you press are right next to each other.
Three different ways to do the exact same thing. haha

ficestat 06-22-2013 08:38 AM

Being a day 2 new user to CentOS 6.4, I ran into the same challenge of not haivng my user account in the sudoers file. I read this forum post, and found this great tutorial http://www.garron.me/en/linux/visudo...lt-editor.html

This worked for me!


All times are GMT -5. The time now is 08:39 PM.