BuycPanel Blog

BuycPanel Blog

Latest news and updates

What You Need to Know About File Permissions

Posted by Jamison on 18 10 2016.

Each of the files and directories (or folders) in your cPanel/WHM account has preset permissions. These permissions basically control the user’s ability to read, write, revise, edit, or execute these files and folders. When you set a permission, you can choose who amongst your users can perform these actions. Once you create files, the control panel automatically assign default permissions on each of them. Most of your users do not have the need to make changes to these permissions.

 

However, there are certain times, such as with updates or installation, wherein the default file permissions change.

 

Default home directories for cPanel users

 

All cPanel users will receive a home directory by default. You will find this home directory under this: /home/{username}. It is important for you to remember that every file and directory under a particular user’s home directory should have appropriate permissions and ownership.

 

Although all files and directories play major roles, you…

Each of the files and directories (or folders) in your cPanel/WHM account has preset permissions. These permissions basically control the user’s ability to read, write, revise, edit, or execute these files and folders. When you set a permission, you can choose who amongst your users can perform these actions. Once you create files, the control panel automatically assign default permissions on each of them. Most of your users do not have the need to make changes to these permissions.

 

However, there are certain times, such as with updates or installation, wherein the default file permissions change.

 

Default home directories for cPanel users

 

All cPanel users will receive a home directory by default. You will find this home directory under this: /home/{username}. It is important for you to remember that every file and directory under a particular user’s home directory should have appropriate permissions and ownership.

 

Although all files and directories play major roles, you need to keep in mind that the most important directory you should set the correct permission and ownership for is the public_html.

 

How to view file permissions

 

You can view, alter, or revise file permissions through your cPanel File Manager. You can also do this via other FTP programs.

 

When you open your cPanel File Manager, a window will pop up, listing all of the files and directories a user has. On the right side of each file, you will see the permissions set for it. One thing to note is that certain file types and directories should have particular permission settings.

 

Here are a few examples of the required permission settings for some of the most important files and folders:

 

  • public_html: 750
  • Folders: 755
  • CGI and Perl scripts: 755
  • .html .php and other types of documents: 644

 

What you should do with errors on permission settings

 

It is critical for you to understand that improper file permission settings can cause a lot of problems. The worst thing that can happen is unauthorized access to the most sensitive areas of your cPanel account. Incorrect settings on permissions can give unauthorized users the ability and the access they need to hack your website or even launch attacks. Once this takes place, these hackers can cause even more damage, as they can change a lot of your file permission settings, leading to the increased vulnerability of your site.

 

Here is a very important thing to keep in mind: the 777 permissions means that the file or directory is readable, executable, and writeable with only the single word “world.” Although rare, since situations wherein you would have to write or execute files or folders through the use of the “world” is uncommon, this is still a fact you should remember.

 

Another thing to note is that, once you locate files and directories that have permissions different to that of the default ones, change them back to the recommended settings.

 

The bottom line

 

As a friendly, security reminder, change file and directory permissions only when necessary. This will give you the peace of mind knowing that you do not give users more access to the files and directories than what they really just need.