LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-05-2007, 11:37 PM   #1
maniac matt
Member
 
Registered: Oct 2007
Location: Beantown
Distribution: Arch Linux
Posts: 30

Rep: Reputation: 15
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.
 
Old 11-05-2007, 11:50 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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

Last edited by Tinkster; 11-05-2007 at 11:51 PM.
 
Old 11-06-2007, 12:15 AM   #3
maniac matt
Member
 
Registered: Oct 2007
Location: Beantown
Distribution: Arch Linux
Posts: 30

Original Poster
Rep: Reputation: 15
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
 
Old 11-06-2007, 12:17 AM   #4
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
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).
 
Old 11-06-2007, 12:33 AM   #5
maniac matt
Member
 
Registered: Oct 2007
Location: Beantown
Distribution: Arch Linux
Posts: 30

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jay73 View Post
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:$
 
Old 11-06-2007, 03:28 AM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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
 
Old 11-06-2007, 11:04 AM   #7
maniac matt
Member
 
Registered: Oct 2007
Location: Beantown
Distribution: Arch Linux
Posts: 30

Original Poster
Rep: Reputation: 15
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.
 
Old 11-06-2007, 11:21 AM   #8
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
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.
 
Old 04-02-2008, 11:13 PM   #9
cb88
LQ Newbie
 
Registered: Mar 2007
Distribution: slackware,debian
Posts: 4

Rep: Reputation: 0
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 :-)
 
1 members found this post helpful.
Old 04-03-2008, 01:22 AM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
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 ....
 
1 members found this post helpful.
Old 02-26-2013, 10:23 AM   #11
Stickboy06
LQ Newbie
 
Registered: Feb 2013
Distribution: Solaris 10, Red Hat
Posts: 1

Rep: Reputation: Disabled
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
 
Old 06-22-2013, 09:38 AM   #12
ficestat
LQ Newbie
 
Registered: Jun 2013
Posts: 2

Rep: Reputation: Disabled
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!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Edit "read-only" /etc/fstab from "System Recovery#" (without boot cd?) charlweed Linux - General 1 12-31-2006 06:57 PM
How to edit "/etc/sudoers" lchxr Fedora 5 04-02-2006 12:29 PM
Help with sudoers file (visudo) jasongunnisthedevil Linux - Security 1 01-21-2006 12:38 AM
visudo lets me edit sudoers but not save ver 3.3.1 suguru MEPIS 4 12-19-2005 07:23 AM
find, edit and save "startup" file chaoticanuck Linux - Newbie 2 12-19-2002 11:56 AM


All times are GMT -5. The time now is 10:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration