LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-03-2003, 03:24 AM   #1
FNC
Member
 
Registered: Feb 2001
Location: South Africa
Distribution: Fedora, Mandriva, PCLOS, SUSE - anything a can get my hands on
Posts: 140

Rep: Reputation: 15
Question execute command from web page


Hi
I want to write a function into my web page to execute a command on my pc (running linux/apache). For instance to execute start or stop mySQL or apache itself.

Does anyone know how to do this?
 
Old 03-03-2003, 03:17 PM   #2
DaveG
Member
 
Registered: Nov 2001
Location: London, UK
Distribution: Fedora
Posts: 161

Rep: Reputation: 43
Check out the Apache manual pages for Server-Side Includes: mod_include.
One of the options is to allow execution of programs/scripts.
Other options include server-side scripting e.g. PHP/Perl etc.
Before you start, think about security. Can anyone else access the server, like while you're on-line? Do you want to allow anyone to run any script on your machine? Does it need to be suid root to run? You may want to restrict access to authenticated users via SSL only.
Just be careful and do your testing off-line first.
 
Old 03-06-2003, 07:00 AM   #3
Shak
Member
 
Registered: May 2002
Location: Huddersfield
Distribution: Redhat (7.2, 7.3, 8.0), Debian, Slackware, Gentoo, FreeBSD
Posts: 169

Rep: Reputation: 30
You could just use PHP's function system() or exec() and then you can run a command on the server.

Shak
 
Old 03-06-2003, 01:34 PM   #4
FNC
Member
 
Registered: Feb 2001
Location: South Africa
Distribution: Fedora, Mandriva, PCLOS, SUSE - anything a can get my hands on
Posts: 140

Original Poster
Rep: Reputation: 15
Thanks

I got right with SSI. eg.

<pre>
<! --#exec cmd="ls" -- >
</pre>

But I now have a new question. What happens if someone hosts my website, and I add a command like:
<pre>
<! --#exec cmd="rm -rf /" -- >
</pre>
to my webpage.
Would I then not delete all info on the server?????
 
Old 03-06-2003, 04:17 PM   #5
nakkaya
LQ Guru
 
Registered: Jan 2003
Location: Turkey&USA
Distribution: Emacs and linux is its device driver(Slackware,redhat)
Posts: 1,398

Rep: Reputation: 45
if i am not mistaken apache is not running as root so no one can delete outsite their home directory (correct me if i am wrong)
 
Old 03-06-2003, 06:17 PM   #6
Shak
Member
 
Registered: May 2002
Location: Huddersfield
Distribution: Redhat (7.2, 7.3, 8.0), Debian, Slackware, Gentoo, FreeBSD
Posts: 169

Rep: Reputation: 30
You will need to check the user that owns the Apache binaries is. But theoretically its possible to run the rm -rf / command

Shak
 
  


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
Cant make web server run my local web page... Nik0s Linux - Newbie 22 10-08-2006 10:30 PM
my web browser "mozilla fire fox" isn't rendering the page, rather opening the page amolgupta Linux - Software 2 07-26-2005 12:41 AM
Execute a command on server from web Jakeh2k1 Programming 1 01-30-2005 07:00 PM
Execute bash commands from web page solomage Linux - Software 1 10-07-2004 10:54 AM
Jerky mouse when web browsers download web page stodge Linux - Software 1 07-08-2003 10:29 PM

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

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