# How to umask nginx to make it write files in 770 (cache/logs)

**URL:** <https://www.ruby-forum.com/t/how-to-umask-nginx-to-make-it-write-files-in-770-cache-logs/219067>\
**Category:** NGINX\
**Created:** [April 19, 2012, 9:19pm UTC](https://www.ruby-forum.com/t/how-to-umask-nginx-to-make-it-write-files-in-770-cache-logs/219067 "2012-04-19T21:19:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [April 19, 2012, 9:19pm UTC](https://www.ruby-forum.com/t/how-to-umask-nginx-to-make-it-write-files-in-770-cache-logs/219067/1 "2012-04-19T21:19:25Z")

</div>

Hello,

Iam thinking of setting a umask in nginx… so that it writes files  
(logs ans cache) in 770 . Anybody know how to do this, or done it?

I need this because my environment needs access to all files produced by  
nginx and some are 700 .

Regards,  
Mike

---

<div class="post-metadata">

**Author:** ![Micheal\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@Micheal\_W](https://www.ruby-forum.com/u/Micheal_W)\
**Post date:** [April 20, 2012, 1:56pm UTC](https://www.ruby-forum.com/t/how-to-umask-nginx-to-make-it-write-files-in-770-cache-logs/219067/2 "2012-04-20T13:56:07Z")

</div>

From: Micheal W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> Iam thinking of setting a umask in nginx… so that it writes files (logs ans  
> cache) in 770 . Anybody know how to do this, or done it?  
> I need this because my environment needs access to all files produced by nginx  
> and some are 700 .

Never tried but maybe set the umask at the beginning of the init.d  
script (but that would apply to all files creation)…  
Or a quick/dirty way to do it would be to chmod 770 the log files every  
x hour or once a day from a cron job…

JD

---

<div class="post-metadata">

**Author:** ![Micheal\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@Micheal\_W](https://www.ruby-forum.com/u/Micheal_W)\
**Post date:** [April 21, 2012, 4:10am UTC](https://www.ruby-forum.com/t/how-to-umask-nginx-to-make-it-write-files-in-770-cache-logs/219067/3 "2012-04-21T04:10:10Z")

</div>

I tried this in the init script:

su - nginx -c “umask 002”;  
umask 002;

None of them work… new cache files/dir still get 700 permissions…

What could i be doing wrong=?
