How to make new file permission inherit from the parent directory?
- by Wai Yip Tung
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.