LinuxQuestions.org
Register a domain and help support LQ
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
 
LinkBack Search this Thread
Old 09-08-2011, 10:34 AM   #1
Ryan Hoots
Member
 
Registered: Sep 2011
Location: Indiana, USA
Distribution: Ubuntu, Fedora, Linux Mint, Debian
Posts: 35

Rep: Reputation: Disabled
visudo: How to let a user run only a certain program as root?


I have scoured the internet (and the Debian man files) to figure out how to allow a user access to only one program as root, using sudo.
I use root for my administrative stuff, but there's one program my normal user, ryan, needs to run. That program is service. I need to be able to run that program, preferably without entering my password every time, so I can start or stop gdm3 whenever I want (I don't use GNOME much).
What I need to know is how to tell visudo that. This line doesn't pass the parse check:
Code:
ryan ALL=(ALL) service
What do I need to type to get it to work? Thanks.
 
Old 09-08-2011, 10:54 AM   #2
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 111Reputation: 111
Try it this way... it should get you the command and handle the password issue the way you want:

Code:
ryan ALL =  NOPASSWD:/sbin/service
 
Old 09-08-2011, 11:34 AM   #3
Ryan Hoots
Member
 
Registered: Sep 2011
Location: Indiana, USA
Distribution: Ubuntu, Fedora, Linux Mint, Debian
Posts: 35

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by SL00b View Post
Try it this way... it should get you the command and handle the password issue the way you want:

Code:
ryan ALL =  NOPASSWD:/sbin/service
Didn't work. Here's what I got:
Code:
ryan@ryanD610:~$ sudo service gdm3 start
Sorry, user ryan is not allowed to execute '/usr/sbin/service gdm3 start' as root on ryanD610.*****.
Should I replace NOPASSWD:/sbin/service/service with NOPASSWD:/usr/sbin/service?
 
Old 09-08-2011, 11:43 AM   #4
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 111Reputation: 111
Quote:
Originally Posted by Ryan Hoots View Post
Should I replace NOPASSWD:/sbin/service/service with NOPASSWD:/usr/sbin/service?
Correct.
 
Old 09-08-2011, 12:12 PM   #5
Ryan Hoots
Member
 
Registered: Sep 2011
Location: Indiana, USA
Distribution: Ubuntu, Fedora, Linux Mint, Debian
Posts: 35

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by SL00b View Post
Correct.
It's working. Thanks, SL00b.
 
Old 09-09-2011, 01:22 AM   #6
propofol
Member
 
Registered: Nov 2007
Location: Seattle
Distribution: Debian Squeeze, Wheezy
Posts: 244

Rep: Reputation: 46
One other option: try 'super'. Add the required user to /etc/super.tab



Regards,
Stefan
 
Old 09-09-2011, 09:20 AM   #7
Ryan Hoots
Member
 
Registered: Sep 2011
Location: Indiana, USA
Distribution: Ubuntu, Fedora, Linux Mint, Debian
Posts: 35

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by propofol View Post
One other option: try 'super'. Add the required user to /etc/super.tab



Regards,
Stefan
Sounds interesting... I'll look into that...
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Program run as root, configfiles writable by 'user' jonaskellens Linux - Newbie 3 03-05-2010 10:14 AM
how can i run a java program with root privilages from a non-root account? joyjjs Linux - Software 1 08-04-2009 12:14 AM
How can I have a script owned as root and run as root by a user: setuid? stickey bit? abefroman Linux - Newbie 9 04-19-2008 05:15 PM
why lftp command run failed when user isn't root, but ok when logining as root steven_yu Linux - Software 0 06-06-2007 08:36 PM
Run program from root login as non-priveledged user? pr0wl3r Linux - Security 3 08-17-2004 09:52 PM


All times are GMT -5. The time now is 11:40 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration