LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 08: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, 08:25 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

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

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

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
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, 05: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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:02 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
Open Source Consulting | Domain Registration