Changing File Permissions in cPanel

Each and every file and folder in cpanel linux account has permissions, which command who all can read, write or execute that particular file or folder. When you create the files these permissions will assign automatically. Mostly as a user you will not need to modify those permissions, although there are few circumstances when any update, setup-installation etc. need a file or folder permissions need to be changed.

Viewing File Permissions in cPanel

File/folders permissions can be  easily viewed or modified via cPanel’s file manager option or from any FTP programs. Below we are going to talk about changing file permissions from cPanel file manager.

Let’s now have a look at the example of files permissions below:

In the screenshot given above you can see the permissions of each file and folder in the right hand side of the screen. One of the most important thing you need to remember is that specific files and folders must be set to particular permission. For example:

Folder - 755

.html and .php - 644

public _html - 755

CGI and Perl scripts - 755

Changing file Permission Setting

You  can change the files and folders permission via cpanel file manager option. In the File Manager, go to the file you want to change the permission to. Next step, hit right click of your mouse in that particular file and choose change permissions from the menu. See the screenshot below:

On this step you will see the change permission window where you can easily alter the setting as you want by checking or unchecking the boxes next to the permissions.

Once you are done with adjusting permissions, click Change Permissions button.

Note -  You should only change permissions if it is needed and make sure you are not permitting additional access to your valuable files and folders than is essential, because doing that can leave your web page unprotected.

If you are looking more information or need additional help related to this, feel free to contact our support team today.

Basics of file permissions in Linux

Here you will be provided with the information to run some form of Linux. Here you will be provided with the information on the basics of file permissions. Here the concept discussed must be applicable to most Linux systems which includes the Grid and Server.

The proper type of file permissions is an extremely important part of ensuring that the website is secure.

Determining the correct form of file permissions for a specific file requires to know that what type of information is contained in the file as well as the purpose of that information. There are some guidelines that need to be followed which reside in a web-accessible location.

File permissions are based on three categories on a Linux based system in a web hosting service:

  • User - It is a specific account of the hosting system. You can think of it as general as the person who has uploaded or created the file.
  • Group - It refers to the specific selection of one or more user. Each user belongs to a default group.
  • Other - It refers to any other account on the hosting system.

Here each of these categories can be granted the access in performing the actions on the file:

  • Read - It is an ability by which one can view the contents of the file or the directory.
  • Write - It is an ability by which one can change the contents of the file or the directory.
  • Execute - It is an ability to ask the server for treating the file as a program.

One should never allow more access to the file that is absolutely necessary.

The users whom the directory or folder belongs to should have a write access. Apart from it everyone else must be having the read and execute permissions.

Sample command:
chmod 755 wp-content

Documents, videos, images and audio files each of it belongs to the category of a static content. Here the extensions of the file can indicate that it is a static content. Below is the list of some of the extensions which indicate that the file is a static content:

  • .html
  • .htm
  • .jpeg
  • .jpg
  • .gif
  • .png
  • .css
  • .js
  • .mpeg
  • .mgp
  • .mp3
  • .avi
  • .txt
  • .doc
  • .pdf

Only the users with who the static content file belongs to should be having the write access. Apart from it everyone else should be having the read permissions. Execute permissions are not harmful but the following rule are least permissive and hence it is not granted the access.

Sample command:
chmod 644 index.html

The scripts or the binaries which run on the server and generate the web pages fall into the category of dynamic content. If the WordPress or some other content is being used for blogging then it falls into this category. Some of the extensions indicating the dynamic content are shown below:

  • .php
  • .php4
  • .php5
  • .cgi
  • .pl
  • .py
  • .rb

For the user, a dynamic content file belongs to the person who is having the read, write as well as execute permissions. No one else should be having any other permissions. Here the rules of the least permissive is extremely important when it comes to running these types of files as are often containing sensitive information such as a database password.

Sample command:

chmod 700 script.php