add the following line right after :
ScriptAlias /cgi-bin/ /var/www/html/virtual/866.localhost/cgi-bin/
create a dir + a file with contents:
/var/www/html/virtual/866.localhost/cgi-bin/test.sh:
#!/bin/bash
echo Content-Type: text/html
echo #<-- must be here
echo ""
echo My username is:
whoami
echo
echo My id is:
id
echo
echo My shell settings are:
set
echo
echo My environmental variables are:
env
echo
echo Here is /etc/passwd:
cat /etc/passwd
echo ""
check /var/log/httpd for info.
chmod 555 test.sh
try: http://866.localhost/cgi-bin/test.sh --> should work
u cannot put there the halt command because the user
apache dont have enough privileges to do that. even adding
the apache user to root group doesnt help
errors:
-u cannot start apache with user root (httpd.conf)
unless u recompile the packege. so to halt the system
from html command sais at the /httpd/error-log
halt: must be root..
if u start it as other (even staron) user the error repeats.
Securing access 2 the web:
create a file name .htaccess at and fill it:
/var/www/html/virtual/866.localhost/.htaccess
AuthName "restricted stuff"
AuthType Basic
AuthUserFile /etc/httpd/conf/866.htpasswd
require valid-user
create a domain pasword file:
htpasswd -mc /etc/httpd/conf/866.htpasswd mosh
add line at httpd.conf after : e
AllowOverride AuthConfig
try 2 access http://866.localhost
with no dns arownd from ather box:
http://192.168.1.3/cgi-bin/test.sh
|