Forum Moderators: coopster & phranque

Message Too Old, No Replies

Grant a CGI program write permission in a directory

         

tntpower

2:04 am on Dec 31, 2007 (gmt 0)

10+ Year Member



Hi there,

I want to allow a CGI program to be able to write (add/edit/delete) in a directory. So the permission for the directory is still 755. But when my website visitors run the CGI program through browser, they can write to the directory (in other words, the permission for the directory to the CGI program is 777).

Can I do it?

Thanks,

perl_diver

2:57 am on Dec 31, 2007 (gmt 0)

10+ Year Member



Your question does not make much sense, but the directory should only need from 600 to 644 permissions for your CGI scripts to read and write to it, not 755 or 777. You should always use the lowest permissions possible.

phranque

10:05 am on Dec 31, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



the execute bit must be set for it to work as a directory, so 755 is ok.
in order for the cgi program to write to a 755 directory, the owner of the directory must match the user running the web server process.

Dabrowski

1:26 pm on Dec 31, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not fully understanding *NIX permissions as I'm a Windows guy, when a CGI program is run on a Windows box the web server software uses a different username to execute the script, so permissions would be applied to that user. It sounds like you need to do the same sort of thing.

perl_diver

6:57 pm on Dec 31, 2007 (gmt 0)

10+ Year Member



oops, my bad. The folder does need execute permissions, the files can be set to 600 or 644, you can experiment and see which works on your server.