Did you know that you can navigate the posts by swiping left and right?
Sometimes, we want to set a folder such that anything created within it (directories, files) inherit default permissions and group.
Lets call the group “media”. And also, the folders/files created within the directory should have g+rw automatically.
To archive this, we will use two tools: GID By setting the GID on the directory, files created within this directory will have the same group.
chmod g+s directory //set gid
ACL (man acl) We can now use ACL to create default permissions for newly created files in the directory
setfacl -d -m g::rwx /directory //set group to rwx default
setfacl -d -m o::rx /directory //set other
Check the new permission:
getfacl /directory
Output:
# file: ..//
# owner:
# group: media
# flags: -s-
user::rwx
group::rwx
other::r-x
default:user::rwx
default:group::rwx
default:other::r-x
</code></pre>