How do file permissions in Linux work?


File permissions are an essential part of web hosting, as they prevent your site from being compromised and private data being accessed.

Certain files, such as CGI scripts, require particular permissions to be set up in order to run.

Linux uses a specific model to define permissions, with three user categories that have their own permissions.

The user categories are:

And each category can have one of the following permissions:

These permissions are required for files on the Internet, and anything that should be directly accessible by the public will need at least a Read permission.

There are two ways that Linux permissions are typically denoted – either by a three digit code, or by specifying each available permission for each user. In both ways, the user categories are organised by Owner, then Group, then All Users.

Three Digit Code

On Linux, each permission is assigned a number:

Each user category is given a number, with the permissions for each category added up.

So, for example, if you were to assign a file the permission 755, this would mean:

Each Permission Specification

You can also list each permission by a single letter:

You then include each permission you want each user category to have, with dashes (-) representing where you don’t assign a permission to a user category.

So, for example, if you were to assign a file the permission rwxr-xr-x, this would mean:

For security reasons, this permission level (755 or rwxr-xr-x) is the highest permission we allow.

It is important to set your permissions to the minimum needed in order for your site to function correctly.

The eXtend Control Panel has ‘Check Site Permission’, a feature which will let you check the files you have on your site to ensure they have the right permissions or would possibly result in security issues.

You can also change file permissions within the eXtend Control Panel’s File Manager, through your FTP client, or directly via SSH.



Article ID: 54
Created On: Tue, Mar 3, 2015 at 4:00 PM
Last Updated On: Thu, Apr 23, 2015 at 11:04 AM

Online URL: https://www.heartinternet.uk/support/article/how-do-file-permissions-in-linux-work.html