Webmastersite.net

Search    Register    Log In   

Details

umask headaches
By
Jul 08, 2015 pm31 12:14 PM (Edited )

A few days ago, all of my WSN installations stopped being able to update themselves. At first I thought something was wrong with the tar extraction code as it was only extracting the folder and not any of the files in it. After a few hours of testing I discovered that the problem was wider than that, and in fact any script-created directory was being created with 600 permissions which make it impossible to write any files to it. Worse yet, script-created files were also created as 600 which causes them to show up as 403 forbidden errors on the web. This included the javascriptheader.js file, so all javascript was broken, impairing functionality considerably.

My web host, Liquid Web, is oblivious to the fact that things never worked this way before and suggests setting a umask in the script. For the sake of anyone else on a web host with bad defaults (so far I've only seen it happen on liquid web), I've set a umask(022) in the latest release of the four active series. This umask value causes the default permissions to be 755 for directories and 644 for files. Since the PHP manual entry for umask warns that it's not reliable on multithreaded webservers, I've also added CHMODs after file and directory creation to be extra sure the right permissions are set in all server configurations.

Unfortunately, if you're on Liquid Web and already affected by this (not sure if it affects all their clients), you'll have to manually open includes/prestart.php and add umask(022); right after the <?php at the top in order to be able to run an automatic update. There's nothing I can do to help that, except to offer to make that change for you manually if you contact me, since it's the old version that has to download and extract the tar.




Tags ,
Views 276 views. Averaging 276 views per day.

Sorry, you don't have permission to post. Log in, or register if you haven't yet.

Please login or register.