So i basically shot myself in the arm a few weeks ago... i have a laravel app in an ubuntu 14.04 lts server and last week i (accidentally?) chmod - ed the whole laravel folder to 777 recursively. my question is how do i revert and apply proper permissions to the laravel folder structure. i was thinking something like start from the top then boil down untill i secure everything.. any input would be appreciated. Thanks guys


There is no easy fix for this. You basically have two options:

  • Go through every file and folder, and set the permission for each manually
  • Reinstall

In most cases, the latter is the easiest


As most of the files in laravel use similar permissions, all you need to do is:

cd my_laravel_app
chmod -R u+rwX,go+rX,go-w .
chmod -R o+w storage bootstrap/cache

The second line will:

  • give the owner user (u) rwx permissions on directories, and rw permissions on files
  • give the group (g) and others (o) rx permissions on directories, and r permissions on files
  • remove write permissions from others (o)

The third line give write permissions to others for the relevant directories.

You will have to remember if anything else needed write permission to others, perhaps public/uploads.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.