This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

On most web servers, the file permissions best suited for a concrete5 site are 0755 for directories and 0644 for all other files.

The leading 0 means the numbers are in octal and the 3 digits are for Owner, Group and World permissions.

The owner is you, via an FTP or system shell login, and also usually the Apache web server. The group is a bit like a concrete5 user group and depends on how your host is organised. It could be all the shared hosting accounts on that server! The World is pretty much anyone on who can login to that computer via the system shell or FTP, though on some hosts it could mean anyone on the internet who can open a connection to that computer.

The numbers are actually octal representations of binary digits. 7 is 111, or 4 + 2 + 1 = 7. The 4 digit means read, the 2 digit means write, and the 1 digit means execute.

7 translates to read, write and execute.

5 translates to read and execute.

So for directories the Owner can do anything, but others can only read them and execute them. Execute for a directory means you can list it and traverse it to subdirectories.

6 translates to read and write.

4 translates to a minimal read only.

So for files, you can read and write them, but anyone else can only read them.

Setting wider permissions like 0777 or 0666 could enable anyone on a shared host to mess with your files. On some hosts, it could enable anyone on the internet to mess with your files! Nevertheless, there are some hosts where 0777 permission is needed on some or all concrete5 directories in order for concrete5 to work.

In most cases, the standard installation of concrete5 sorts all this out for you. However, every now and then, when pulling together a site from parts moved in by various methods, you end up with some permissions that are not quite right. Usually you notice this when you try to visit a page, upload a file or install an addon and get a file permission error.

You could login by FTP or the system shell and sort out the permission for just one file or subfolder. But with one permission a bit skew, you never know how many other files or directories could be a bit off. Checking through them all individually would be a bit of a tedious chore. So here is a quick way to just set everything to what it should be from the system shell command line.

You need to be logged in and in the root directory of your site. That is the directory where index.php and sitemap.xml are located. From there, you can carefully enter a pair of shell commands ( ">" is the command prompt):

> find . -type d -exec chmod 0755 {} ';'

> find . -type f -exec chmod 0644 {} ';'

This changes all directories or files from the current directory down. The first line is for directories and the second line is for files. In each command, the "." first argument provides the starting path as the current directory and the "{}" near the end is substituted with the file or directory path names found.

To check which files it would modify you can run:

> find . -type d

> find . -type f

The list will be long!

Read more How-tos by JohntheFish.

Loading Conversation