VPS security · Practical guide

Understand website file permissions before changing them

Check ownership, identify writable folders and avoid blanket permission changes.

Archive placement: December 2024

A close view of computer keyboard keys

A 403 error or a failed upload can come from ownership, permissions or the application itself. The safest fix is to identify the exact file and the user that needs access. This guide shows how to inspect those details and correct a small example without making the entire website writable.

1. Find the failing item in File Manager

Start with one specific problem, such as an image that returns Forbidden or a folder that refuses an upload. Note its address and when the failure occurs. Changing permissions across the whole account makes the original problem harder to find.

  1. Open cPanel → Files → File Manager. Use Settings to enable Show Hidden Files if the item is a dotfile such as .htaccess.
  2. Open the folder for the affected website. For an additional domain, check its Document Root in cPanel → Domains instead of assuming it uses public_html.
  3. Select the affected file or folder and look at the Permissions column. Record its current value before changing it.

File Manager shows access settings for the hosting account. It does not prove that ownership or a server security rule is correct. If the expected item is missing, first check the document root and upload destination.

2. Confirm the path and keep a recovery copy

A domain can point to a subfolder while another domain in the same account uses a different root. Correcting the wrong copy can appear to do nothing and can affect a separate website.

  1. In cPanel → Domains, find the exact hostname and note the document root, including any folder beneath public_html.
  2. Open that path in File Manager and compare the filename and extension with the failing browser request. Letter case matters on the hosting server.
  3. Download the configuration file you plan to change, or make a private backup outside the public website directory. Keep a note of the original permission value.

For a missing image, check that the file exists before changing access. For an upload failure, check cPanel disk usage and the application error message too. A full quota will not be fixed by allowing more write permissions.

3. Separate public files from writable data

Most website code only needs to be read by the web process. Uploads, cache and application storage may need write access. Check application documentation for the exact folders rather than granting write access to the whole site.

Keep database exports, private keys and configuration backups outside the public document root. File permissions do not prevent a publicly served backup from being downloaded if the web server exposes it. Remove old backup files from public folders.

4. Change one permission through cPanel

The right value depends on the application and the way the host runs it. Many ordinary public website folders use 755 and files use 644, but those examples are not a reason to overwrite every item in an account.

  1. Select the affected item in File Manager, then choose Permissions from the toolbar or right-click menu.
  2. Compare the User, Group and World boxes with the application or hosting guidance. Change only the permission that has been identified as incorrect.
  3. Save, reload the failed page or retry the upload, and record the result. If there is no improvement, restore the previous value before trying an unrelated change.

Avoid 777 as a general fix. Configuration files containing database credentials may need more restrictive settings than public assets. Ask support to check ownership if the correct permission still fails or File Manager will not let you save it.

5. Check application uploads without opening the whole site

A website often needs write access only to an uploads or cache folder. It should not need every script and configuration file to be writable by everyone.

  1. Find the storage or upload path in the application documentation or its error message.
  2. Check that this folder exists in the correct document root and review its permission through File Manager.
  3. Try one small, harmless test upload from the application. Confirm it opens, then remove the test file if it is no longer needed.

Do not apply a recursive permission change to the entire home directory. Email folders, private keys, backups and application configuration are different kinds of data and should not all have the same access settings.

6. Check whether permissions are the real problem

Test the affected page or upload again, then read the relevant log. A full disk, incorrect path or security policy can look like a permission problem. Fix the cause shown by the error instead of loosening access repeatedly.

Record the working owner and permissions for the folders you changed. This makes accidental changes easier to spot after a deployment and gives the next person maintaining the site something useful to work from.

7. Retest the failed action and recognise other causes

Load the affected page in a private browser window, then repeat the upload or edit that originally failed. Read the matching web-server or application log entry. For WordPress, verify an image upload and that existing media still loads. Do not settle for a homepage test when the original problem was an upload directory.

  • A 403 can also come from an access rule, missing index file or a security module. Check the actual log message before changing permissions again.
  • If normal permissions and ownership look correct on an AlmaLinux system, SELinux context may be involved. Check its audit information and use the distribution’s context tools; do not disable SELinux or make files world-writable to hide the problem.
  • A “disk full” or account-quota error is a storage problem, not a permissions problem. Check capacity before widening access.

Keep a note of the original owner, group and modes for anything you change. If the change has no effect, restore those values and investigate the next likely cause. Remove any temporary write access once the application task is complete.

Common questions

Should I set every folder to 777 to fix an upload error?

No. Identify the upload folder, check quota and use the access settings supported by your application and host. Broad write access can expose much more than the folder that needs the correction.

What if cPanel shows the right value but access still fails?

Check the exact document root and filename, then collect the error and its time for support. Ownership, a web-server rule or a security block can cause a similar error; changing permissions again may not help.

Further reading

← Back to all guidesDiscuss your hosting setup ↗