How to set default file permissions for all folders/files in a directory?

Chris

I 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.

Chris

I found it: Applying default permissions

From the article:

  1. Set the setgid bit, so that files/folder under <directory> will be created with the same group as <directory>

    chmod g+s <directory>
    
  2. Set the default ACLs for the group and other

    setfacl -d -m g::rwx /<directory>
    setfacl -d -m o::rx /<directory>
    

Next we can verify:

getfacl /<directory>

Output:

# file: ../<directory>/
# owner: <user>
# group: media
# flags: -s-
user::rwx
group::rwx
other::r-x
default:user::rwx
default:group::rwx
default:other::r-x

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Ansible: How to recursively set directory and file permissions

How to set default file permissions for Java

How to set default core file permissions

How to set permissions for directory

How to set default file for "directory" route

Set permissions with rsync for all files but the root directory

Set File Permissions to Default from Umask

How to change permissions on all files in a directory, and when new files are added, to default values?

How to set default major mode in directory-local file?

How to set file permissions in GitHub

How to set secure permissions in webserver directory

how set read and write permissions for a directory

Ansible - how do I set directory permissions

Default permissions for /opt directory?

How to give directory and file permissions to a web server

KDE settings + locale - Cannot set LC_ALL to default locale: No such file or directory

What's wrong with my directory file permissions and how to copy directory's file permissions to another directory?

PHP include file to all directory files by default

Set permissions of the installation directory

How to list all acl permissions set in the system?

Permissions from file and sub directory for all users inherit permanet

Can I set permissions when creating a file or directory?

Why a file copied with cp not have permissions set according to default ACLs?

File write of unpickled byte array has no permissions set by default

How to make a directory with permanent permissions different from default

permissions to create file in directory

Changing directory and file permissions

Vim set working directory fto first opened directory/file by default

Default directory permissions over NFS