Change default permissions for new files and folders

4

1

Every time I create a new file or folder in Linux, it is accessible for r/w by myself, not the group. I want to change my system setting such that every new file or folder will be automatically accessible by the group. Is there anyway?

Ali

Posted 2014-09-07T07:46:52.777

Reputation: 391

Answers

6

From the article:

chmod g+s <directory>  //set gid 
setfacl -d -m g::rwx /<directory>  //set group to rwx default 
setfacl -d -m o::rx /<directory>   //set other

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

More info : http://www.linuxquestions.org/questions/linux-desktop-74/applying-default-permissions-for-newly-created-files-within-a-specific-folder-605129/

Alejandra Moreno

Posted 2014-09-07T07:46:52.777

Reputation: 682

3

Looks like a copy pasta answer from: https://unix.stackexchange.com/a/1315

– Timber – 2017-07-20T20:45:57.997

-1

This can be done using the umask utility. What is Umask and How To Setup Default umask Under Linux?

You can setup a script that starts automatically on boot which executes the command

umask 777

to give everyone read/write and execute permission, for example.

ap0

Posted 2014-09-07T07:46:52.777

Reputation: 1 180

7This is inaccurate, umask works the other way around than chmod. Setting an umask of 777 would give nobody permission to do anything (the permissions set would be 000). – Oldskool – 2016-02-08T14:30:20.337