How to configure file permissions in File Manager

This article describes how to use cPanel's File Manager to set permissions for your web site's files and directories.

About file permissions

All files and directories on Linux computers have access permissions that tell the operating system how to handle access requests. There are three basic access permissions:

  • Read: Files with read access enabled can be viewed by the user. The read permission is represented by the letter r or the number 4.
  • Write: Files with write access enabled can be modified by the user. The write permission is represented  by the letter w or the number 2.
  • Execute: Files with execute access enabled can be run as programs by the user, and directories with execute access enabled can be accessed by the user. The execute permission is represented  by the letter x or the number 1.

These three access permissions are then set for three types of user groups:

  • User: The owner of the file.
  • Group: Other users who are in the same group as the group to which the file belongs.
  • World: This access type is for everyone else; that is, those who are not the user or who are not in the same group.

You can determine the full permission settings for a file or directory by combining access permissions and access types. For example, a file with read and write permissions for the user has a permissions value of 6. (The read value of 4 plus the write value of 2 equals 6.) If that file also has read permissions for the group and the world, those permissions values are 4. So the file's total permissions value is represented numerically as 644.

File permission settings for your web site

A web server must be able to access your site's files in order to send them to a user's web browser. Therefore, your files must have the correct file permissions set for your web site to work properly.

None of your files or directories should be writable by anyone else. If other users can write to your files or directories, then they can also erase them.

The following tables show the correct permission settings for various file types on your web site:

  • All HTML files and image files must be readable by others (the world). The correct file permissions setting is 644, and it is set automatically when you upload files to your site. The following table shows these permission settings:
      User Group World
    Read Set Set Set
    Write Set - -
    Execute - - -
    Permissions 6 4 4
  • All directories must be executable by others (the world). The correct file permissions setting is 755, and it is set automatically when you create a directory on your site. The following table shows these permission settings:

      User Group World
    Read Set Set Set
    Write Set - -
    Execute Set Set Set
    Permissions 7 5 5
  • All CGI files (that is, all files in your cgi-bin directory) must be executable by others (the world). The correct file permissions setting is 755, but it is not set automatically when you upload CGI files to your site. You must change the file permissions for CGI files manually. The following table shows these permission settings:

      User Group World
    Read Set Set Set
    Write Set - -
    Execute Set Set Set
    Permissions 7 5 5

Changing permissions for a file or directory

To change the permissions for a file or directory, follow these steps:

  1. Log in to cPanel.
    If you do not know how to log in to your cPanel account, please see this article.
  2. Open the File Manager:
    • If you are using the Jupiter theme, on the Tools page, in the Files section, click File Manager:

      cPanel - File Manager icon (Jupiter theme)

    • If you are using the Paper Lantern theme, in the FILES section of the cPanel home page, click File Manager:

      cPanel - File Manager icon

  3. In the File Manager main window, select the file or directory that you want to change.
  4. Click the Permissions icon:

    cPanel - File Manager - Permissions icon

  5. Click the check boxes to set the correct permissions.

    The numerical permission values underneath the check boxes update automatically as you add and remove permissions.
  6. Click Change Permissions.

More Information

For more information about file permissions, please visit http://en.wikipedia.org/wiki/Filesystem_permissions#Traditional_Unix_permissions.

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.