Hello guys
I have been running a LAMP stack for awhile now but have never really explored the server side end of things. What I am trying to do is have a python script on a website run a bash command. This will accomplish a system so someone can create an account for proxy access via a webpage. I am running Ubuntu server edition 8.04.1
Here is my python script to do so:
Code:
import os
def main():
username = "Test1"
password = "Enter new password"
os.system("htpasswd -b /etc/squid/passwd '%s' '%s'" % (username.replace("'"$
return apache.OK
if __name__ == '__main__': main()
Now I read a bit on the net and from what I gathered I would need to run this as a CGI script. So I placed it in my /usr/lib/cgi-bin/ directory as a .py file.
Then when I go to my site (mysite.com/cgi-bin/program.py)
I get a 500 internal server error. So Once again I looked around and I figured out that I had bad handlers in my site configuration so I tried various different things and nothing seemed to work so I reset my site configuration to as follows:
Code:
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot /home/carter/public_html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/carter/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
Could someone please revise what I have to get this to work. It has been causing me a headache for over a month.
Thanks!
-Carter Hansen