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?


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.

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy