LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-15-2007, 02:53 AM   #1
unforkable
LQ Newbie
 
Registered: Jul 2006
Posts: 9

Rep: Reputation: 0
Scripts with root privileges launched from a web browser


Hello,
I am currently developping a web-based administration interface, using php.
My question is:
How can I launch scripts requiring root privileges from the web browser?

Example: an interface to launch snort with a button that will trigger: /etc/init.d/snort start


Thanks guys in advance.
 
Old 03-15-2007, 04:29 AM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Moved: This thread is more suitable in Programming and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 03-15-2007, 04:56 AM   #3
unforkable
LQ Newbie
 
Registered: Jul 2006
Posts: 9

Original Poster
Rep: Reputation: 0
Thank you win32sux
I hesitated between putting it here or in the security section, because yes it is more a programming question. But somehow there's a security concern! let me explain:


First I used a technique of escalating privileges for running root commands: but having two compiled C programs launched by the web page: the first being owned by www-data, and the second by root with setuid bit.

Yes you guessed it : too complicated!
But it had the advantage of having multiple C programs running each a specific command (predefined), with a low possibility of seeing a random command run.


Now setuid scripts can't be run root.
So I'm trying su-php with minuid = 0! but it seems to me a big security concern!

Thanks for giving advises!
 
Old 03-15-2007, 05:14 AM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Would it help if you sudo the privilages to apache user? (or whoever the web server runs under?)
 
Old 03-15-2007, 08:15 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
what about an application server?
I use a simple one I knocked up at work for simple intranet CGI stuff.
I was using so many network transactions I made a generic app to save rewriting networking code.

the CGI makes a client request, the server runs on another machine and deals with it.
so the server runs under whomever you want.

I have a bunch of scripts in a special location, which are run by the server when
requested. It's dead simple.
So you need a new command just add a new shell script wrapper and call it from the CGI script.

A bit like rsh but a bit safer as the scripts can only be in a certain location.
 
Old 03-15-2007, 08:37 AM   #6
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
A few things here:
https://www.linuxquestions.org/quest...d.php?t=452660
 
Old 03-15-2007, 09:12 AM   #7
unforkable
LQ Newbie
 
Registered: Jul 2006
Posts: 9

Original Poster
Rep: Reputation: 0
Thank you guys very much!
I really appreciate! I'm gonna give it a shot, and think about each suggestion.
Thanks again .
 
  


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
LXer: New Open-source Time and Attendance Web-based Package Launched LXer Syndicated Linux News 2 07-03-2011 08:30 AM
mkdir with root privileges slam Programming 3 09-29-2006 05:22 PM
kplayer 0.5.2 crashes when launched as root on KDE 3.3.2 stl1859 Linux - Software 0 12-10-2004 09:57 AM
User with root privileges ShakyJake Linux - Newbie 2 06-18-2004 12:12 PM
root privileges and permissions evil_lafta Slackware 7 08-20-2003 09:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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