Installing Gallery2 on a site thet enforces SUID bit on directories

mikha

Joined: 2009-03-04
Posts: 1
Posted: Wed, 2009-03-04 16:18

Hi!

I'm trying to install Gallery 2 and couldn't get beyond "Storage Setup" step. Whatever I do, installation script complains "There was an error creating the directory structure within the storage directory."

I gave "g2data" proper access rights. Here is what I see after first failed attempt to populate "g2data":

ls -la g2data/
total 8
drwsrwx---   3 mikha104  8080  512 Mar  4 18:56 .
drwsrwx---  11 mikha104  8080  512 Mar  4 17:36 ..
-rw-rw----   1 mikha104  8080  166 Mar  4 18:56 .htaccess
drwsr-xr-x   2 mikha104  8080  512 Mar  4 18:56 albums

Look at permission of "albums" directory! So i did chmod -R g+w g2data and repeated the step again, and this time it has created "cache" sub-directory and failed again. Just for curiosity, I repeated this over and over until "Storage Setup" succeeded, but then installation failed on "Install Gallery Core".

The problem, as I see it, is that my provider has a peculiar setup, which enforces SUID bit on directories, making every created file/directory to belong to real user, not the one HTTP server is running under. This works fine with other PHP scripts, though, because umask is set to 0007 and all created directories are group-writable by default. I've even created small PHP script to test it:

<?php
mkdir("test_dir");
?>

And it creates directory PHP can write into:

drwsrwx---  2 mikha104  8080   512 Mar  4 18:39 test_dir

However, it looks like Gallery2 chmod-s created directories to 755. In my environment this makes it unable to write to the directory it has just created.

Any ideas on how to solve it? (Apart from changing my provider - I'm contemplating this, but the amount of work involved makes me really sick).

Here are additional details:

Gallery version (not just "2"): 2.3 typical
PHP version (e.g. 5.1.6): 4.3.10
PHPInfo Link (see FAQ): http://www.mikha.ru/phpinfo.php
Webserver (e.g. Apache 1.3.33): Apache/1.3.33 (Unix) mod_fastcgi/2.4.0 FrontPage/5.0.2.2623 PHP/4.3.10 mod_gzip/1.3.19.1a mod_ssl/2.8.22 OpenSSL/0.9.7b rus/PL30.20
Database (e.g. MySql 5.0.32): 4.0.13
Activated toolkits (e.g. NetPbm, GD): '--with-freetype-dir=/usr/local' '--with-gd=/usr/local' '--enable-gd-native-ttf' '--with-ttf' '--with-zlib' '--with-pdflib=/usr/local' '--with-zlib-dir=/usr' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-tiff-dir=/usr/local' '--with-mysql=/usr/local/mysql' '--with-dbase' '--with-ldap=/usr/local' '--with-openssl=/usr/local' '--with-xml' '--with-dom=/usr/local' '--with-zlib-dir=/usr/local' '--with-dom-xslt=/usr/local' '--with-dom-exslt=/usr/local' '--enable-xslt' '--with-xslt-sablot' '--with-expat-dir=/usr/local' '--with-t1lib=/usr/local' '--with-gettext=/usr/local' '--with-iconv=/usr/local' '--with-mcrypt=/usr/local' '--enable-sysvsem' '--enable-sysvshm' '--enable-trans-sid' '--enable-sockets' '--with-imap=/usr/local' '--enable-ftp' '--enable-exif' '--enable-mbstring' '--enable-mbregexp' '--enable-bcmath' '--with-mcal=/usr/local' '--with-imap-ssl=/usr/local' '--with-layout=GNU' '--with-curl=../curl-7.10.5' '--with-gmp' '--with-mod_charset'
Operating system (e.g. Linux): FreeBSD 4.8-STABLE
Browser (e.g. Firefox 2.0): Firefox 3.0.6