File and folder permission errors can be very inconvenient while uploading and modifying files, decompressing archives, and running scripts. Your Cloudways server hosts your web application (website) files, but you need the correct permissions to apply any changes. Without these, you can not do anything on your website and may see errors preventing you from making changes in your files and directories. Setting up the correct permissions can avoid these errors and security breaches.
There are many variations in error messages such as:
403 forbidden error.
Upload of the file was successful, but an error occurred when setting permissions and/or timestamp.
Could not copy the file.
Unable to create a server folder. An error occurred. Please contact your administrator, etc.
It is good practice to diagnose whether permissions are correctly set for your user before diving in deep and checking other aspects. There are multiple ways of fixing permissions, but in the Cloudways Platform, it’s just a matter of a few clicks.
How to Reset File & Folder Permissions
You can easily reset file and folder permissions using the Cloudways Platform if you are the account owner or a team member with the necessary rights to the application.
Learn more about managing your team members, such as creating a new team member, updating permissions, etc.
Please note that this reset permission operation is only applicable to the webroot, which is the public_html directory of your application and all the files and directories residing there. After resetting permissions, the following operations will happen:
Directories’ permission will be reset to 775. This is also the default permission for directories.
Files’ permissions will be reset to 664. This is also the default permission for files.
The ownership of the files and folders will change to the application user or master user based on your preference.
Here, 775 translates to drwxrwxr-x, which means that the owner and group member can read, write, and execute, while all others can read and execute. On the other hand, 664 translates to -rw-rw-r–, which means that the owner and group member can read and write a file, while all others can only read the file.
If you connect to your server using SSH, you can easily verify the set permissions and see the user and the group name. The master user name typically starts with master_XXXXX unless you have changed it, and the application user name is the same as your application folder name.
Step #1 — Navigate to Application Settings
Log in to your Cloudways Platform using your email address and password.
From the top menu bar, open Servers.
Then, choose the server where your target application is deployed.
3. Next, click www.
4. Choose the application’s name.
5. Select Application Settings from the navigation bar.
6. Then, you should land in the General tab.
Step #2 — Resetting the Permissions
Once you scroll down, you will see the Reset File/Folders Permissions option.
From the dropdown, choose the desired user, e.g., the master user or an application user who should have the permissions, and click refresh. We recommend you choose an application user usually and only choose a master user when you properly know how to operate it.
Step #3 — Verifying the Permissions [Optional]
Here is how you can verify if the permissions are successfully reset.
First, connect to your server using SSH.
Navigate to your target application folder and run ls -l command to see it all.
Now your desired user should have all the required permissions. If you still see permission-related errors while accessing specific directories or files, then make sure you don’t have any rules in the .htaccess file causing conflict.
That’s it! We hope this tutorial was helpful. If you need any help, then feel free to search your query on Cloudways Support Center or contact us via chat (Need a Hand > Send us a Message). Alternatively, you can also create a support ticket.