LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-06-2009, 02:30 PM   #1
Nagglfar
LQ Newbie
 
Registered: Mar 2009
Posts: 6

Rep: Reputation: 0
Editing the sudoers file


I know I need to use visudo to modify the sudoers file. However, I want to make commands for sudo as root.

I wanted to use the command userdel. How do I go about managing this?
 
Old 03-06-2009, 02:53 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
Are you the only sudo user on your system. If so, then simply make yourself a member of the wheel group and then uncomment the line in visudo top allow members of wheel to use sudo. You can run any command then as root.

If there are other admin users and you want to restrict the commands that can be run, there is a sample cdrom mounting example you can modify to allow using the userdel command.

Code:
# %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
You could substitute your username or a group for users in the example and change the command run. Be sure you use the full path to the command. The example given has two comma separated commands.

There is one gotha to be aware of. You sometimes need to log out after modifying sudo or especially if you add yourself to a group. Group membership is read when you start a new session.

Last edited by jschiwal; 03-06-2009 at 02:54 PM.
 
Old 03-06-2009, 11:53 PM   #3
Nagglfar
LQ Newbie
 
Registered: Mar 2009
Posts: 6

Original Poster
Rep: Reputation: 0
I have many users on the system. I need to configure sudo commands as root for only one specific user. Would the syntax look something like this?

*for instance assume the user is bob and i want to use the ifconfig command:

bob ALL=(ALL) ALL
ifconfig=/sbin/ifconfig
 
Old 03-07-2009, 12:02 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,159

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Try "man sudoers" - plenty of doco in there.
 
Old 03-09-2009, 07:16 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
Generally, you just need to add users authorized to use sudo to the `wheel' group and then uncomment the line that let's members of the wheel group use sudo.
 
  


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
need HELP with editing sudoers file jTm_316 Linux - Newbie 4 01-10-2009 02:45 AM
sudoers config file crashed while editing and can no longer be written to CrinkElite Linux - Software 2 03-16-2008 12:02 AM
Editing Sudoers File... aapanju Linux - Newbie 7 03-06-2008 09:10 PM
Editing sudoers (shows as new file in nano) rushinblue Linux - Newbie 2 11-06-2007 01:17 PM
Help Editing Sudoers File Rubicone Linux - Newbie 2 05-03-2002 01:50 AM


All times are GMT -5. The time now is 06:07 PM.

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