Default file permission for web root (and new files)

September 23, 2015 3.3k views
Linux Commands Linux Basics System Tools CentOS Debian Ubuntu
Simmoniz
By:
Simmoniz

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.

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

Have another answer? Share your knowledge.