I have a folder which permission is set to 777 but when I add any files or folder unziping in that folder. Extracted files or folder permission never change. Destination folder permission is 777 and I want what I will add in that folder will automatically get permission of 777.
When I add any files or folder by extracting .zip in that folder, extracted folder/files permission won't change automatically. I always have to chmod for newly add file/folder!
Best Answer
What you want is called ACL - Access Control Lists.
acl
package should be already installed, to check it run:dpkg -s acl
.To use ACL's you should enable it for your filesystem. But it can be already enabled. To check it use
tune2fs -l
. Substitute/dev/sda6
for your system:If you see acl word - it is already enabled for device
/dev/sda6
.If you don't see acl word - run
tune2fs -o acl /dev/sda6
to enable it.To set permission for user:
This will set
rwx
ACL, for userusername
to /path/to/folder. This means that all files created in this folder will haverwx
permission forusername
.To set permission for group:
This will set
rwx
ACL, for groupgroupname
to /path/to/folder. This means that all files created in this folder will haverwx
permission for groupgroupname
.To set permission for other:
This will set
rwx
ACL, for other to /path/to/folder. This means that all files created in this folder will haverwx
permission for other.To check permission:
To combine acl
Default ACL
So if you set default ACL, it would be preferred ACL. That means if set ACL for
user
orgroup
, new created file would inherit default acl anyway. Be carefully with default ACL.To set default acl use
-d
key,or use
default
wordBe carefully with setting default ACL. For example if set like this:
and now fetch this ACL
default ACL for group and user will be
rwx
automatically!Remove ACL
This will remove all ACL's from folder
Finally
If you are only user in system, I recommend use default ACL.
This will do what you want for /path/to/folder
Sources
archlinux - https://wiki.archlinux.org/index.php/Access_Control_Lists
help.ubuntu - https://help.ubuntu.com/community/FilePermissionsACLs