Linux--Error: You do not have permission to access…

cPanel

Every file and directory in the Linux system is owned by a specific user and group and has permissions that allow performing particular actions on this file or folder. When one of these settings is not set up properly, the mentioned error message appears. There are several reasons why you may receive such an error.

The first one – either the owner/group or permissions are not set up properly. This is the first item that should be checked.

The second one – the .htaccess file executes the code that contains incorrect redirect settings. Probably, the redirect is set up for the file/folder with a wrong owner/group or permissions. Also, there may be the following line in the .htaccess file that causes such an error:

Options -Indexes

To resolve this issue, the line should be removed.

This is the second item that should be checked and fixed if it is found.

This issue also may occur if you delete the public_html folder accidentally and create it manually again without contacting our Hosting Technical Department. In this case, permissions for public_html and other system folders get set up incorrectly, and you receive the mentioned error.

These designations - ‘/’ and ‘/ index.html’ - in the error message associate with the direct folder or file that Apache tries to execute. This symbol ‘/’ means the public_html directory; this one ‘/ index.html’ – the file that is located in the public_html directory (the index.html file in particular). If Apache tries to refer to the file or folder whose owner or permissions are not set up properly, you will receive the same error but with the direct path which is in question. 

Error message: You do not have permission to access /index.html 

Solution: You should check the permissions of the index.html file. You may check and set them using either the command window (via Shell access) or File Manager that is located in the cPanel account. The permissions of files should be 644. 

Using Shell access:

1. Connect to your account via SSH protocol 
2. Follow the public_html folder using the cd public_html command

You may check which folder you are in now using the ‘pwd’ command. The result of this command should be ‘home/cPanel_username/public_html’. 

3.Use the ls –l | grep index.html command. 

The usage of this command will show you the permissions of the index.html file. The ideal result of this command should be: 

-rw-r--r-- number cPanel_username cPanel_username day month year time index.html 

4. If you see any differences in the permissions field (-rw-r--r-- ) , you need to perform the following command chmod 644 index.html  

This command sets up the correct permissions for the index.html file. 

Using File Manager

1. Log into cPanel 
2. Follow the File Manager icon in the Files field 
3. At the top of the window that opens, you will see the Change Permissions icon
4. Choose the index.html file > click on the Change Permissions icon
5. Set up permissions to 644 > Save. 

Error message: You do not have permission to access / 

Solution: You should check the permissions of the public_html folder. You may check them using either the command window (via Shell access) or File Manager that is located in the cPanel account. The permissions of the public_html folder should be 750. 

Using Shell access

1. Connect to your account via SSH protocol
2. Use the ls –l | grep public_html command 

The usage of this command will show you the permissions of the public_html folder. The ideal result of this command should be:

drwxr-x--- number cPanel_username nobody day month year time public_html/ 

3. If you see any differences in the permissions field (drwxr-x--- ), you need to set the correct ones. To do this, use the following command chmod 750 public_html
4. If you see any differences in the group field (nobody), you need to contact our Technical Department in order for them to set up the correct group. Unfortunately, you are not able to set the correct group yourself because you do not have the root access to the server. 

Using File Manager

1. Log into cPanel
2.Follow the File Manager icon in the Files field
3.On the left of the window that opens, you will see permissions of all files and folders 
4.If the permissions of the public_html folder are not 750, you need to set the correct ones. To do this, perform the following actions: 

  • Choose the public_html folder > click on the Change Permissions icon
  • Set up permissions to 750 > Save.
5. Clear the browser cache
6. Clear your local DNS cache
7. If you are still experiencing the same issue, contact our Technical Department to set the correct group to the public_html folder.