Linux – How to Set Up Default Group Permissions in a Folder

linuxpermissions

I have website folder called

/home/john/public_html

Now i want that what ever files are copied to that public_html or new files created inside that folder then those files should have default read /write permission by john , no matter who is the owner of that file.

Also i will be copying /creating files /directories by FTP , will that system work there as well or file with ftp won't have group read /write permission

i mean will umask work only files created / copied within shell or even outside shell aswell

Best Answer

You can achieve this using ACL. Look at the man page of setfacl/getfacl for details.

Unfortunately the syntax is a bit complex. Try something like:

setfacl -s u::rwx,g::r-x,o::r-x,m:rwx,u:john:rwx,d:u:john:rwx /home/john/public_html

Well, umask will still aply to newly created files, but you can "override" umask as well using ACL:

setfacl -s u::rwx,g::r-x,o::r-x,m:rwx,u:john:rwx,d:u:john:rwx,d:u::rwx,d:g::r-x,d:o::r-x,d:m:rwx /home/john/public_html