Ubuntu – Defaulting new child files and folders to the parent folder ownership

chmodchowndirectoryfilespermissions

I have created a directory and used chown to make my user and group the owner. If I create a new folder inside the parent folder then the permissions for 'others' under the permissions tab is set to 'access files' not 'create and delete files'.

How can I ensure all sub folders and files of my parent folder all default to the parent permissions?

Ubuntu 16.04LTS

/opt/lampp/htdocs directory

Best Answer

Using the setfacl tool you can set this with:

sudo setfacl -R -d -m o::rwx /opt/lampp/htdocs
sudo setfacl -R -m o::rwx /opt/lampp/htdocs

The first line sets this to default, while the second just modifies and leaves the acl ( access control list ) values. The first line is what your looking for.

Info:

  1. -d: default for future subfolders
  2. -m: modify existing acl
  3. -R: make changes recursively
  4. o: set acl for folder others

See man setfacl