Nginx Perl / Cgi Permission Problem

steve steve at greengecko.co.nz
Tue Sep 20 05:18:26 UTC 2016


Hi,

On 09/19/2016 10:41 PM, basti wrote:
> Hello,
> I have a perl/ gci script that creates a dir and within that an subdir
> with permission 0750. The owner of the dirs are www-data.
>
> nginx can't delete the dirs because this is run as user nginx.
> is there a way to set the user for perl/cgi to nginx? only for this
> location?
>
> best regards
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
Not as such. However, as it sounds like you're running on linux, you can 
fool around a bit and sort of do it backwards...

Set the perms on the parent directory to 2770, and the group ownership 
to nginx. What this does is to enforce the old BSD file ownership 
method, in that every file - be it flat or a directory - created in this 
directory will have the group ownership of nginx ( it's parent ), and 
that this functionality will be transferred to any subdirectories that 
are created. That's half of the battle won.

The second thing that needs to be done it to add group write permissions 
to these files. Basically, the UMASK of the environment that the perl 
script is running needs to be set to 0002 from 0022.

This does mean that all files generated by the script will have group 
write permissions, so it's not perfect, but it's a start. Hopefully 
group write permissions to www-data aren't too bad.

hth,

Steve

-- 
Steve Holdoway BSc(Hons) MIITP
http://www.greengecko.co.nz
Linkedin: http://www.linkedin.com/in/steveholdoway
Skype: sholdowa



More information about the nginx mailing list