Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Hi I have web server on it also. I had made simple bash script using vi editor..which will open file and then add some lines into it at last it will save automatically...and after that 2-3 linux command will be run as a specific user.

Now I want to do the same from web browser...so what I need to do for this? html?perl?python?cgi?....?which is easy way to do the same?

share|improve this question

2 Answers 2

You want to start with Apache 'suexec':

http://httpd.apache.org/docs/2.2/suexec.html

suexec support is compiled/ready in your default Apache install on a Red Hat/CentOS/Fedora - do a Google on "suexec howto" and you'll find a lot of articles for various tools (PHP, etc.) which will give you ideas.

share|improve this answer
    
It is vitally important that, as of September 2014, you ensure that Bash is patched against Shellshock. CGI scripts are one of the main known attack vectors. –  joews Sep 26 at 10:57

Add the following options in your apache config under your Directory (or Virtual hosts been a while so not sure on the virtual hosts bit) section.

Options ExecCGI Includes
AddHandler cgi-script .cgi

then rename your shell script to something .cgi and then make sure that the file has the correct permissions/ownership

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.