Fixing file permissions: fix_permissions, fix_storage and File manager
Fixing file permissions
Wrong permissions are the most common cause of "Permission denied" errors, or of Laravel being unable to write to storage or bootstrap/cache. CloudWeb hosting offers three ways to fix them: one click in the panel, a command in SSH/the web terminal, or manually through the File manager.
One click in the panel
On a hosting's detail page, open Development → Deployments, expand a repository, and in the Quick actions sub-tab find the Permissions section with two buttons:
- Fix permissions – runs
fix_permissionson the whole repository - Fix storage – runs
fix_storage, a faster fix limited to thestoragedirectory
The fix_permissions command
If you connect via SSH or the web terminal, the same command is available directly in the shell:
fix_permissions
Without an argument it fixes /var/www/html if it exists, otherwise the current directory. You can also pass a specific path: fix_permissions /var/www/html/my-project. The command:
- sets the owner to
your_user:www-data, - sets directories to
2775(read/write/execute for owner and group, plus setgid so new files inherit thewww-datagroup), - sets files to
664(read and write for owner and group), - if it finds a
storageorbootstrap/cachedirectory, fixes those the same way.
The fix_storage command (for Laravel)
fix_storage
It first tries ./storage (relative to wherever you currently are in the shell), and if that does not exist, /var/www/html/storage. As with fix_permissions, you can pass a specific path: fix_storage /var/www/html/my-project/storage. It is faster because it does not walk the whole site, only this one directory.
Permissions through the File manager
For a single file or folder you can also change permissions in the File manager: right-click it and choose Permissions. In the dialog you enter a three- or four-digit octal number (e.g. 755), and for a folder you can check "Apply to everything inside the folder" to apply the change recursively to its whole contents.
Fixing permissions manually
If you need finer control, you can achieve the same result as fix_permissions by hand (replace USERNAME with your SSH username):
sudo chown -R USERNAME:www-data /var/www/html
sudo find /var/www/html -type d -exec chmod 2775 {} \;
sudo find /var/www/html -type f -exec chmod 664 {} \;
When to use these commands
- after uploading files via FTP,
- after cloning or pulling from Git outside the panel (e.g. directly via SSH),
- when you see "Permission denied" errors,
- when Laravel cannot write to
storageorbootstrap/cache.
After a clone, pull or Quick action run directly in the panel, the panel already fixes permissions and restarts PHP on its own – you mainly need these commands after changes made outside the panel.
Related articles
Was this article helpful?
Your feedback helps us improve our documentation