Jump to content
News
    LiquidFractal has upgraded its site software! If you have any questions, please contact an Administrator.
  • Using CHMOD to change permissions recursively


    Gord Barentsen

    Sometimes, when installing PHP apps on one's server they will inexplicably crap out with the dreaded Error 500.  In your server's error logs, you may see a SoftException error - something like this:

    [Sun Apr 02 07:27:11.537901 2016] [:error] [pid 31742] [client xx.xxx.xxx.xxx:xxxxx] SoftException in Application.cpp:261: File "[...]/install/index.php" is writeable by group

    This is likely because of permissions errors which could potentially make your files vulnerable.  As a general rule, all files on your server (at least all PHP files) should have permissions set to 644 and all folders should be set to 755.  Now wouldn't it be nice to be able to do this (nearly) all at once?

    To do this, enter the following two commands on your server's command line (using PuTTY or some equivalent):

    find /path/to/folder -type d -exec chmod 755 {} \;
    find /path/to/folder -type f -exec chmod 644 {} \;

    The first line finds all folders (directories) including, and beneath, /path/to/folder (obviously the folder you want to change) and executes a CHMOD on them (in this example, to 755).  The next line does the same for files (although it changes all files, not just PHP files).

    This is the quickest option if you have command-line access.




    Comments & Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...

Important Information

Hello guest! In using this site you agree to LiquidFractal's Terms of Use and Privacy Policy