0

So how can i get: All system information from Bash cgi script to web site?

1 Answer 1

1

Before any output, your bash CGI script should print a "Content-type" header, for example:

# First output line should be the content-type header + blank line
echo -e "Content/type: text/plain\n"

echo -n "running as: "; whoami

echo "-----------------------------------------"
echo "            /proc/cpuinfo                "
echo "-----------------------------------------"
cat /proc/cpuinfo

echo "-----------------------------------------"
echo "            /proc/meminfo                "
echo "-----------------------------------------"
cat /proc/meminfo

In most apache deployments there is a cgi-bin directory where you should place CGI scripts. Make your script executable (by the user running the webserver) and place it at this directory.

If the user running the webserver has no rights to display the system information you need, you will have to use something like sudo to escalate privileges - be sure to use a very restrictive sudoers file (if you can't sudo, get out of here).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.