How to make new file permission inherit from the parent directory?

Posted by Wai Yip Tung on Stack Overflow See other posts from Stack Overflow or by Wai Yip Tung
Published on 2010-06-12T04:06:50Z Indexed on 2010/06/12 4:12 UTC
Read the original article Hit count: 387

Filed under:
|
|
|

I have a directory called data. Then I am running a script under the user id 'robot'. robot writes to the data directory and update files inside. The idea is data is open for both me and robot to update.

So I setup the permission and owner group like this

drwxrwxr-x  2 me robot-grp 4096 Jun 11 20:50 data

where both me and robot belongs to the 'robot-grp'. I change the permission and the owner group recursively like the parent directory.

I regularly upload new files into the data directory using rsync. Unfortunately, new files uploaded does not inherit the parent directory's permission as I hope. Instead it looks like this

-rw-r--r-- 1 me users       6 Jun 11 20:50 new-file.txt

When robot tries to update new-file.txt, it fails due to lack of file permission.

I'm not sure if setting umask helps. In anycase the new files does not really follow it.

$ umask -S
u=rwx,g=rx,o=rx

I'm often confounded by Unix file permission. Do I even have a right plan? I'm using Debian lenny.

© Stack Overflow or respective owner

Related posts about linux

Related posts about unix