To run a Concrete CMS web site, the web server must have access to read and write the files used for Concrete CMS.

On most web servers, the web server will own these files and the file permissions will be 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 the web server. The Group is a bit like a Concrete CMS 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, the Owner can read and write them, but anyone else can only read them.

Occasionally you will encounter a host where the FTP user used to upload files is not the same as the web server user. But maybe they are in the same group. In this case the slightly relaxed permissions 0775 or 0664 may be better. Or you may need to change the owner of uploaded files to the web server user.

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!

In most cases, the standard installation of Concrete CMS confirms all this during installation. 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. Typically 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 use cPanel to sort out the permission for just one file or directory. 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 on a command line 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 example is for directories and the second example 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!

If you actually need to fix the user who owns the files and directories:

$ find . -exec chown new_owner_username {} ';'

Where new_owner_username is the username of the web server.

Topics and Tags
Discussion

If you would like to discuss any of these thoughts, please start or continue a thread on the Concrete CMS Forums.