Fixing File Permissions

January 09, 2026 49 views

Fixing File Permissions

Incorrect file permissions can cause errors like "Permission denied" or "403 Forbidden". CloudWeb hosting provides simple commands to fix permissions.

The fix_permissions Command

This command fixes permissions for all files and folders in your web directory:

fix_permissions

The command performs:

  • Sets ownership to your user and www-data group
  • Directories get 2775 permissions (read, write, execute + setgid)
  • Files get 664 permissions (read and write for owner and group)

The fix_storage Command (for Laravel)

If you're using Laravel and only have issues with the storage directory, use the faster command:

fix_storage

This command only fixes permissions for /var/www/html/storage, which is faster than fixing the entire site.

Manual Fix

If you need to fix permissions manually, you can use these commands:

# Change ownership (replace USERNAME with your username)
sudo chown -R USERNAME:www-data /var/www/html

# Directory permissions
sudo find /var/www/html -type d -exec chmod 2775 {} \;

# File permissions
sudo find /var/www/html -type f -exec chmod 664 {} \;

When to Use These Commands?

  • After uploading files via FTP
  • After cloning a Git repository
  • When "Permission denied" errors appear
  • When Laravel can't write to storage or cache

Was this article helpful?

Your feedback helps us improve our documentation

Still need help?

If this article didn't answer your question, our support team is here to help.

Contact Support