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:

permissions

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:

permissions2

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

permissions3

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!

Did you find this article helpful?

Comments

2012-01-17 3:52 pm
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,
Halyn
Staff
13,688 Points
2012-01-17 6:24 pm
Hi Halyn,

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:

http://webhostinggeeks.com/blog/2009/12/23/understanding-permission-types-for-website-security/

http://www.thewebhostinghero.com/tutorials/linux-file-permissions.html

http://www.cyberciti.biz/faq/how-linux-file-permissions-work/

Hope this helps to clarify file permissions. Please let us know if you have any additional questions or need further assistance.

Regards,

Christi N.
n/a Points
2014-07-16 10:40 pm
great article, very helpful and very clear
n/a Points
2014-10-12 3:45 am

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.

Inside a php function I have a line:  

$Text = shell_exec("http://www.hieratix.net/public_html/cgi-bin/Findit.sh $f2Data");

Findit.sh simply says:

echo we are in Findit script > ScriptOut.txtls -l > listing.txt

Yet I find no file ScriptOut.txt and no file called listing.txt as I would expect.

So what's wrong? Should this be a shell script? a perl script?

There doesn't seem to be syntax error - no error messages - so what's wrong?

I will welcome any assistance on this matter.

 

Staff
2,342 Points
2014-10-13 6:19 pm
It appears that your file path is incorrect. It should be something like the following:


$Text = shell_exec("/home/userna5/public_html/cgi-bin/Findit.sh $f2Data");


Of course, replace userna5 with your cPanel username.
n/a Points
2014-12-09 8:41 pm

Guys this is great but you're assuming I know WHERE to find the cPanel File Manager or FTP Client in the first place. I have NO IDEA where this is in my Wordpress files. Please help!

Staff
2,342 Points
2014-12-09 8:51 pm
To access the cPanel file manager, you may follow our guide on using the cPanel file manager.

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.
}