Delete a file from a CGI

Gerardo Herzig gherzig at fmed.uba.ar
Fri Jun 1 07:55:22 EDT 2007


When you execute a cgi, the program runs under the "apache user" 
(ussualy www or wwwrun or so), so THAT user needs permissions for 
deleting the file. Other approach could be suid'ing the cgi program.

Gerardo

>HI!
>
>I want to delete a file from a CGI, but I always get a Permission denied
>error.
>
>I've tryed this after creating the file (from a normal script):
>
>os.chmod(".lock",stat.S_IMODE(stat.S_IRWXU | stat.S_IRWXO | stat.S_IRWXG))
>os.chown(".lock",pwd.getpwnam("nobody")[2],pwd.getpwnam("nobody")[3])
>
>but the CGI still can't delete the file.
>
>I will appreciate very much your help.
>
>Thanks a lot.
>
>
>  
>




More information about the Python-list mailing list