Question

Default file permission for web root (and new files)

Posted September 23, 2015 5.6k views
Linux BasicsUbuntuCentOSDebianSystem ToolsLinux Commands

What would be the best file permission to set to a web root folder (and all its content files / folders) and its new files? 755 is what suggesetd in this documentation (end of step one). But how to set it as a default permission for new files?

I have to execute this instruction to unsure my website and its static content can be delivered through http

chmod -R 755 /home/somsite/public_www

Everytime I create a new file (as a linux user or via FTP), I always need to execute this line once again because new files never have “read” permission for http requests.

Is there a way to tell server : “hey, all files in here, and all future files created can be read by anyone”?

I’m on ubuntu.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi,

You can use the setfacl command with the d flag to set future file permissions.

sudo setfacl -Rdm g:groupnamehere:rex /path/to/your/files

Submit an Answer