ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Fedora, Mandriva, PCLOS, SUSE - anything a can get my hands on
Posts: 140
Rep:
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.
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.
Distribution: Fedora, Mandriva, PCLOS, SUSE - anything a can get my hands on
Posts: 140
Original Poster
Rep:
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?????
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.