Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 what I need to do for this? html?perl?python?cgi?....?which is easy way to do the same?

share|improve this question

You want to start with Apache 'suexec':

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 '14 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


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