write permission for www-data

Jim Ohlstein jim at ohlste.in
Wed Jul 27 14:21:57 UTC 2011


On 7/27/11 10:12 AM, António P. P. Almeida wrote:
> On 27 Jul 2011 14h50 WEST, nginx-forum at nginx.us wrote:
> 
>> Thanks folks. Let me conclude that it is better to keep the owner of
>> my folders to be "root". Then give permission to www-data (nginx
>> user) for every writable folder like upload and images? right?
> 
> Yes. Normally a simple 775 is enough with:
> 
> chown -R sites-user.www-data /path/to/writabledirs
> 
> find /path/to/writabledirs -type d -exec chmod 775 {} \;
> 
>> My main question is about the folder ownership; which is better?
>> root or www-data?  Because when I normally create folder by SSH or
>> SSH tunnel to server, I am there as root and create folder with root
>> ownership.
> 
> Unless you have some sort of esoteric requirements you should,
> *never*, ever, run a web site under the root user. 

Don't confuse the guy or make the issue more comlplicated than it is. He
*clearly* stated that he runs nginx under user "www-data" and didn't ask
this question. He wants to know about file write permissions.

...

> 
> --- appa
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx


-- 
Jim Ohlstein



More information about the nginx mailing list