Originally Posted by zxq9
On CentOS the Apache server is guarded by a pretty huge set of SELinux protections. These are almost certainly denying access to stuff in /home from scripts run by Apache.
suexec is an Apache plugin that lets the part of Apache that executes scripts run another program as a user other than "apache". In this case it is trying to execute your .py script as your username.
I hate to sound paternal here, but you should read the Apache and RHEL/CentOS/SL docs to understand what you're getting into.
That said, what problem are you actually trying to solve? What is the overall thing you are trying to do or effect you are trying to achieve?
I have created a python 3 script to actually try to set up a cooki, nothign special or somethign that need some extra access. here is the code:
Code:
#!/usr/bin/python3
# coding=utf-8
import cgitb; cgitb.enable()
import cgi, os, sys
from http import cookies
# initialize cookie
cookie = cookies.SimpleCookie( os.environ.get('HTTP_COOKIE') )
cookie.load( cookie )
nikos = cookie.get('nikos')
# if visitor cookie does exist
if nikos:
msg = "ΑΠΟ ΤΗΝ ΕΠΟΜΕΝΗ ΕΠΙΣΚΕΨΗ ΣΟΥ ΘΑ ΣΕ ΥΠΟΛΟΓΙΖΩ ΩΣ ΕΠΙΣΚΕΠΤΗ ΑΥΞΑΝΟΝΤΑΣ ΤΟΝ ΜΕΤΡΗΤΗ!"
cookie['nikos'] = 'admin'
cookie['nikos']['path'] = '/'
cookie['nikos']['expires'] = -1 #this cookie will expire now
else:
msg = "ΑΠΟ ΔΩ ΚΑΙ ΣΤΟ ΕΞΗΣ ΔΕΝ ΣΕ ΕΙΔΑ, ΔΕΝ ΣΕ ΞΕΡΩ, ΔΕΝ ΣΕ ΑΚΟΥΣΑ! ΘΑ ΕΙΣΑΙ ΠΛΕΟΝ Ο ΑΟΡΑΤΟΣ ΕΠΙΣΚΕΠΤΗΣ!!"
cookie['nikos'] = 'admin'
cookie['nikos']['path'] = '/'
cookie['nikos']['expires'] = 60*60*24*30*12 #this cookie will expire in a year
#needed line, script does *not* work without it
sys.stdout = os.fdopen(1, 'w', encoding='utf-8')
print( cookie )
print ( "Content-type: text/html; charset=utf-8\n" )
print( msg )
sys.exit(0)
is till wonder how the other scripts which they do more stuff dont provide me this suecec error.