LinuxQuestions.org
Review your favorite Linux distribution.
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 02-06-2003, 09:16 AM   #1
davee
Member
 
Registered: Oct 2002
Location: Ayrshire, Scotland
Distribution: Suse(home) RHEL (Work)
Posts: 263

Rep: Reputation: 30
Running a script as root


Is it possible to let users run a script as root, without giving them root access?

I have a script that restarts a (domino) application server on a machine - I would like a user to be able to do that via a shell script I have written, without giving them either linux or domino admin rights...
 
Old 02-06-2003, 09:25 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 234Reputation: 234Reputation: 234
Your probably looking for sudo. Gives access to particular tasks without giving them root password.

man sudo for more details.
 
Old 02-06-2003, 10:39 AM   #3
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
There's another alternative to sudo that might make life less complicated. When you say "without giving them root access" I take it to mean that you want just about any user to be able to run this script. There are two special permission bits available: setuid and setgid. When they are set, the file will have root access or root-group access (not sure what the difference is to tell you the truth). The permissions I'm talking about can be set using chmod in octal form (i.e. chmod 764 <files>). To do it, add another octal number to the front. A 4 enables the setuid bit, a 2 enables the setgid bit, and a 1 enables the "sticky bit". As always, you can have any combination (won't go into what the sticky bit does though). In this case, you'd want "chmod 4755 <script file>". Any user can execute it and read it, but only root has permission to write the file. When run, the script will behave as if root launched it.
 
Old 02-07-2003, 06:27 AM   #4
davee
Member
 
Registered: Oct 2002
Location: Ayrshire, Scotland
Distribution: Suse(home) RHEL (Work)
Posts: 263

Original Poster
Rep: Reputation: 30
Thanks, guys! Problem solved.

Your help is really appreciated.

Dave
 
  


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
Running a script as root with sudo without entering the user password kloss Linux - General 8 10-10-2005 12:39 PM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 11:23 PM
running root-tail from shell script not working Nuk Linux - Newbie 1 04-09-2004 09:56 AM
Need clarification re: Running a script as root. phil1076 Linux - General 5 12-18-2003 02:55 PM
writing a script running firestarter automatically with kppp without root priviliges melquiades Linux - Newbie 3 08-11-2003 07:50 AM


All times are GMT -5. The time now is 02:22 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