Suddenly sent to gallery updater page, g2data not found, chmod doesn't work...

deltaf508

Joined: 2013-06-23
Posts: 7
Posted: Sun, 2013-06-23 08:33

Ok, first off I'm not the person who built the site, but I'm now responsible for it. About a month ago we noticed that our gallery page went to the "gallery Updater" page and nothing (that we know of had changed). So I'm now getting around to working on it and I cannot figure out what is happening, what changed, and why "it can't find the g2data" folder. Our structure is as follows:

<root directory>
g2data
public_html
>>>gallery2
>>>all other site files

the message I'm getting is this:
Storage Directory Permissions Failed
+ Inaccessible or missing files (1)
Error: Some files and or directories in your storage directory are not writeable by the webserver user. Run chown -R webserverUser /server_info_here/g2data/ OR run chmod -R 777 /server_info_here/g2data/.

I have engaged my host and asked them to do the chmod commands as shown. There response was this: "Since the 'g2data' folder was located outside of the root directory '/public_html', you were getting the error 'Inaccessible or missing files'. However, I've moved the 'g2data' folder into root directory '/public_html' and granted the permission as you mentioned. Now, you should be able to manage/update Gallery2 application without any issue......However, you may not be able to access Gallery2 application if you set the permission to 777 as folder/filer permission require to set 755 & 644 respectively. Therefore, please contact Gallery2 application vendor for further instruction regarding this or else, please set the permission back to 755 & 644 thorugh FileManager."

So, their solution was to "MOVE" my g2data folder in my "public_html" directory along side the gallery2 folder. I have not tried re-running the updater because I want to ask you all a few questions first.

1. Is it ok to have the g2data folder there? I know in the config.php file it states "For security purposes, it's better if the directory is not accessible via your webserver (ie, it should not be in your DocumentRoot). If you *do* make it available via your web server then you probably won't have any security for your data files." ***Isn't putting it in your public_html folder making it available for your webserver...what are the repercussions of this?

2. How come it worked for the past few years with it "above" the public_html folder and shouldn't I be able to keep it that way (what would have changed to make it inaccessible). Wouldn't the way we had it be the "preferred" setup?

Any advice is very welcome for our situation. Obviously I want it working, but I also want the best possible security while doing it.

Thanks in advance.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2013-06-23 10:59

It is better to leave the g2data outside of the public_html, but many service providers don't allow it so inside will also work.
just edit the data.gallery.base in config.php to point to the new location.
As for the directory permissions, as long as the webserver user owns the directory, then gallery will be able to read/write to it. Gallery sets default file permissions to 755 & 644 by default.(changeable in gallery admin)

If it worked from outside public_html before then your host did change something.

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
deltaf508

Joined: 2013-06-23
Posts: 7
Posted: Sun, 2013-06-23 16:42

Thank you kindly for the explanation. I think I'll ask them one more time why it can't be outside the Public folder and if they can't do it I'll try to make it work as it is. I'll let you know if I have any more issues and we'll go from there.

Really appreciate the response.

Thanks.

 
deltaf508

Joined: 2013-06-23
Posts: 7
Posted: Sun, 2013-06-23 22:41

Ok, I've been going back and forth with my Hosting company and I am going to have to leave the g2data folder within public_html despite my wish that it could remain where it was (one level below that). The last thing they mentioned is that they DID make the chmod changes (777) in the location where it now resides (public_html/g2data), but I am still not able to write to that directory when I get to step 2 of the updater page(s).

Quote:
Storage Directory Permissions Failed
+ Inaccessible or missing files (1)
Error: Some files and or directories in your storage directory are not writeable by the webserver user. Run chown -R webserverUser /hermes/bosweb/removed/for/ipw.privacy/public_html/g2data/ OR run chmod -R 777 /hermes/bosweb/removed/for/ipw.privacy/public_html/g2data/

Can someone please comment on what might be going on?

PS. I have tried using all of these different statements in my config.php file thinking somehow that I don't have the right one. Am I missing how it should go in there?

$gallery->setConfig('data.gallery.base', '/hermes/bosweb/removed/for/ipw.privacy/public_html/g2data/');
$gallery->setConfig('data.gallery.base', '/public_html/g2data/');
$gallery->setConfig('data.gallery.base', '/g2data/');

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2013-06-23 23:21

$gallery->setConfig('data.gallery.base', '/full/system/path/to/g2data/');

The chmod must be recursive chmod -R 777 /hermes/bosweb/removed/for/ipw.privacy/public_html/g2data/ and the directory must belong to the webserver user recursively chown -R webserverUser /hermes/bosweb/removed/for/ipw.privacy/public_html/g2data/

I have a script that may let you run these commands yourself.

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
deltaf508

Joined: 2013-06-23
Posts: 7
Posted: Mon, 2013-06-24 05:10

Thank you. I will try that script out and see what I can do. One question though. When running the command chown -R webserverUser /hermes/bosweb/removed/for/ipw.privacy/public_html/g2data/

What is the webserverUser?

Is it my username that I login with - FTP, telnet, etc?

Thanks in advance for your help. Hopefully this will solve it.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2013-06-24 11:53
Quote:
What is the webserverUser?

I might be your username, best way to check is to look at who owns public_html or ask your host.

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
deltaf508

Joined: 2013-06-23
Posts: 7
Posted: Mon, 2013-06-24 20:56

Ok, your script would not run on my host. However, I'm using winSCP as my ftp client so it has some degree of checking permissions/assigning, etc. Anyway, according to what it tells me it seems my owner is set to me (my login name). I've also looked at the main g2data folder as well as some of the inner folder and files and all the ones I saw were set to 777. So, one would think that this would work. So before I go to my host again and see if there is another command they can run let me ask you. The error below is what I'm getting. I've tried using all sorts of variants in the data.gallery.base statement, but I want to make sure I have the correct syntax in there. I've tried /public_html/g2data/, /g2data/, /hermes/bosweb/removed/for/ipw.privacy/public_html/g2data/, and others. Which would be best practice to put in there? The whole server string?

Quote:
Storage Directory Permissions Failed
+ Inaccessible or missing files (1)
Error: Some files and or directories in your storage directory are not writeable by the webserver user. Run chown -R webserverUser /public_html/g2data/ OR run chmod -R 777 /public_html/g2data/.

Again, thank you in advance.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2013-06-24 21:47

does config.php contain the full path to your g2data ie. /usr/home/username/public_html/g2data

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
deltaf508

Joined: 2013-06-23
Posts: 7
Posted: Mon, 2013-06-24 22:07

Ok, I figured it out. As it turns out my host changed the path on us from what it used to be. All this time i've been trying to figure out why it's not working and find out that is why. Nice huh. Did some digging on my hosts control panel looking into server paths and found it is completely different. Since our gallery used to work and didn't that was probably the whole reason.

Anyway, I ran step 2 and it checked out ok and it got me thinking if I really even need to do the setup. So it corrected the path to the right one and put the g2data folder above public html. Took it out of maintenance mode and the gallery popped up just like we left it off!

So just one last follow up question. Since I never went through the upgrader, do I really need to? Everything is working just like we left it. I believe we are on 2.3, but how do you check?

Thank you very much for the help suprsidr! You got my brain thinking in the right direction and I know a lot more about Gallery2 now because of you so thank you!

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2013-06-24 22:37

updater only takes a second, and it will record the codebase version to the proper places.

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
deltaf508

Joined: 2013-06-23
Posts: 7
Posted: Tue, 2013-06-25 04:18

Perfect! I ran the updater and all went well!

Thanks again for all your help!