chmod with group inheritance rwx only for users and groups
In order to create a shared folder for a given group of users, I need to have inherited restricted directory permissions.
The goal is that only root and user members of the specified group can read and write internal content by inheriting these permissions to future content in my directory. Something like this:
drwxrws--- 2 root terminator 6 28 mai 11:15 test
I can get it with 2 chmod calls :
chgrp terminator test chmod 770 test chmod g+s
It would be nice to do this in one command if you use a number mask. I need to use a mask because it’s a python script and should use os.chmod() to do the job. Thanks!
os.chmod is exactly the same as the chmod utility, but you need to remember that the argument
to chmod is a string representing a
bitmap in octal notation instead of decimal. This means equivalent to
chmod 2770 test
You may have used
os.chmod('test', 2770), which is octal
5322, which is consistent with the bitmask you seem to get.