Permissions (Basics)

I’ve been unable to find a plain and simple answer to that (if there even is one). What should I set the file permissions to on a simple and static website? I only have HTML, CSS, JS and image files, plus folders.

There must be recommended default permissions I should have on files of a simple site like that. What are they?

Many thanks.

I still get a bit confused by the numbers.

Read is 4, Write is 2, and Execute is 1

And combinations add up to 3, 5, 6 or 7

Then I think about it and then test the most restrictive setting that I think will still work.

In my experience I’ve never had to have a “Group” greater than 0

The “User” usually gets the most lenient permissions, but only what it needs, same with “World”

If a file doesn’t need to be written to, don’t give it Write
If a file isn’t meant to be read don’t give it Read
and if it isn’t a script that needs to run, don’t give it Execute

Sounds obvious, but it still requires some thought.

For folders it’s almost the same logic.

*Note, you almost never want to give World Write, and NEVER give World Write and Execute, though Read and Execute is common.

IMHO 705, 505 should probably be your most common settings - but test to be certain!

Read is all you need so 444 should suffice. If you want to give the owner full rights then 744.

Basically the webserver needs to be able to read the files.

Are we talking about a Unix or Windows machine?

What webserver are you using (Apache or IIS) ?

And this applies to both files and folders, right?

Unix.