How do I change my File Permissions?

Every file on your account has a setting that controls who can read, write, and execute the file. For the average user, these will never need to be changed. When a file is created, it will already have its default permissions. However for a more advanced user there may be times that the permissions need changing.

What are File Permissions?

There are three types of permissions:

Read

Write

Execute

You can view your file permissions in your cPanel File Manager or FTP Client. They will display not with the letters, but with numbers. The numbers used are:

7 = read, write, execute

6 = read, write

5 = read, execute

4 = read only

3 = write, execute

2 = write only

1 = execute only

0 = Access Denied

The File Permissions will show as three numbers. The numbers always go in the same order:

User

Group

World

For an example on how this works, let's use this account:

As you can see on the right, the permissions for each file is listed. The primary thing to remember is that certain file types use different permissions:

public_html - 750

Folders - 755

CGI and Perl scripts - 755

.html .php and other Document Types - 644

What if my permissions are wrong?

If your permissions aren't set up correctly, it can allow unauthorized users access to hack your website. Also, once your site's hacked they can change your permissions to make your site even more vulnerable. If you see any files with permissions set at 777, this means that "world" has full access. Rarely will you have a file that needs to be written to and executed by the "world." If any of your file permissions do not match the default permissions, they may need changing. Also, one of the most common needs to update permissions is to make scripts in the cgi-bin 755.

How do I change my settings?

Most FTP clients will allow you to change the permissions. You can also change them in your cPanel File Manager. First, navigate to the location of the file you want to change. We will use the same account in the picture above.

Right click on the file and choose Change Permissions:

Here you can change the permissions for the file. File Manager makes it easier by having check boxes to choose your desired permissions:

Once you have put in the new permissions, click Change Permissions. Remember that you should only do this if completely necessary! If you allow more access to your files, it can leave your website vulnerable. If you have any questions, contact our Tech Support and we'll be happy to assist you.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)

The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.

How did you find this article?

Please tell us how we can improve this article:

Email Address

Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Comments

If someone would be so kind, please clarify the differences among Read, Write, and Execute.

For a beginning developer it's not obvious, for example, what the difference is between Read and Execute. A page can be viewed on the web with World/Read checked and World/Execute unchecked but can't be viewed with World/Read unchecked and World/Execute checked. This shows that the common-sense meanings of "Read" and "Execute" don't apply, but it doesn't really show what the meanings actually are in this whole context of site developer and site user.

Thank you for your questions regarding file permissions. We completely understand that this can be a confusing topic.

Execute is the ability to execute a file (not view it). That is why when you have World Execute selected but not World Read the file cannot be viewed through the browser. Also the directory a file is in in must be set to World Read as well.

The following resources go into more details regarding Linux file permissions:

I'm having trouble running a shell script from my php file: I have set up a small file called Findit.sh in the cgi-bin directory to simply do a directory listing and output it to a file yet nothing happens.