View previous topic :: View next topic |
Author |
Message |
chunderbunny Veteran
Joined: 31 May 2004 Posts: 1281 Location: 51°24'27" N, 0°57'15" W
|
Posted: Tue Dec 05, 2006 8:41 pm Post subject: Giving PHP apps access to different partitions |
|
|
Hey all.
I'm trying to torrentflux (a PHP based web frontend to bittorrent) to work on my server, but I'm only having partial success. Torrentflux itself is installed in /var/www/localhost//htdocs/torrentflux/ and for the most part it works fine. However, it needs access to a directory to download the files to, which is where the problems start. If I tell it to use /share, then everything works. Unfortunately /share is on my root partition which is only 10GB. I want it to use /home/share, since my /home partition is much larger. When I tell it to use /home/share it complains that the "path is invalid", as if it is not seeing the directory at all.
I've been fiddling with the value of open_basedir in my php.ini but nothing I do seems to allow torrentflux to see the download directory.
I'm a total newbie when it comes to apache and PHP so I don't really know where to start with this problem. Any help would be greatly appreciated. |
|
Back to top |
|
|
xoomix Guru
Joined: 02 Jan 2003 Posts: 489
|
Posted: Tue Dec 05, 2006 8:47 pm Post subject: |
|
|
A workaround could be to just make a symlink for like /share/torrents that points to /home/share, and tell torrentflux to use /share/torrents . |
|
Back to top |
|
|
chunderbunny Veteran
Joined: 31 May 2004 Posts: 1281 Location: 51°24'27" N, 0°57'15" W
|
Posted: Tue Dec 05, 2006 8:57 pm Post subject: |
|
|
That doesn't work, I tried. PHP resolves the symlinks when determining permissions so it knows that the /share symlink is pointing to a different partition. |
|
Back to top |
|
|
xoomix Guru
Joined: 02 Jan 2003 Posts: 489
|
Posted: Tue Dec 05, 2006 9:00 pm Post subject: |
|
|
So is it not possible to just chown the directory you want access to? |
|
Back to top |
|
|
martin20450 Tux's lil' helper
Joined: 30 Sep 2005 Posts: 91
|
Posted: Tue Dec 05, 2006 9:05 pm Post subject: |
|
|
Or you could chgrp the symlinked directory to apache and enable write access to it. |
|
Back to top |
|
|
chunderbunny Veteran
Joined: 31 May 2004 Posts: 1281 Location: 51°24'27" N, 0°57'15" W
|
Posted: Tue Dec 05, 2006 9:20 pm Post subject: |
|
|
martin20450 wrote: | Or you could chgrp the symlinked directory to apache and enable write access to it. |
I tried this, no effect. I seriously think it has something to do with PHPs internal security functions not allowing access to stuff on a different partition. |
|
Back to top |
|
|
xoomix Guru
Joined: 02 Jan 2003 Posts: 489
|
Posted: Tue Dec 05, 2006 9:29 pm Post subject: |
|
|
Does chmod'ing the download dir to 777 fix it? |
|
Back to top |
|
|
chunderbunny Veteran
Joined: 31 May 2004 Posts: 1281 Location: 51°24'27" N, 0°57'15" W
|
Posted: Tue Dec 05, 2006 9:35 pm Post subject: |
|
|
It's already 777. |
|
Back to top |
|
|
xoomix Guru
Joined: 02 Jan 2003 Posts: 489
|
Posted: Tue Dec 05, 2006 9:41 pm Post subject: |
|
|
So, when you install torrentflux all permissions of scripts, dirs etc are all checked. Did you get green flags on the final check config step during the install? |
|
Back to top |
|
|
erik258 Advocate
Joined: 12 Apr 2005 Posts: 2650 Location: Twin Cities, Minnesota, USA
|
Posted: Tue Dec 05, 2006 9:45 pm Post subject: |
|
|
maybe mount -o bind could function as a workaround for a symlink. _________________ Configuring a Firewall? Try my iptables configuration
LinuxCommando.com is my blog for linux-related scraps and tidbits. Stop by for a visit! |
|
Back to top |
|
|
chunderbunny Veteran
Joined: 31 May 2004 Posts: 1281 Location: 51°24'27" N, 0°57'15" W
|
Posted: Tue Dec 05, 2006 9:47 pm Post subject: |
|
|
Yes, it installed without any errors. Like i said earlier, everything works fine if I set the download path to one on the same partition as /var/www, but setting it to something on a different partition fails. |
|
Back to top |
|
|
erik258 Advocate
Joined: 12 Apr 2005 Posts: 2650 Location: Twin Cities, Minnesota, USA
|
Posted: Tue Dec 05, 2006 9:58 pm Post subject: |
|
|
instead of
ln -s /home/share /share/torrents
use bind-mounting
mount -o bind /home/share /share/torrents _________________ Configuring a Firewall? Try my iptables configuration
LinuxCommando.com is my blog for linux-related scraps and tidbits. Stop by for a visit! |
|
Back to top |
|
|
chunderbunny Veteran
Joined: 31 May 2004 Posts: 1281 Location: 51°24'27" N, 0°57'15" W
|
Posted: Wed Dec 06, 2006 12:20 am Post subject: |
|
|
erik258 wrote: | instead of
ln -s /home/share /share/torrents
use bind-mounting
mount -o bind /home/share /share/torrents |
I just tried it, no joy. It would have been a dirty hack anyway. I'd much prefer to know if there was some sort of config for PHP I could try. |
|
Back to top |
|
|
erik258 Advocate
Joined: 12 Apr 2005 Posts: 2650 Location: Twin Cities, Minnesota, USA
|
Posted: Wed Dec 06, 2006 3:33 am Post subject: |
|
|
you are using php as an apache module, right? good. it sounds like that's a lot better.
here is an interesting article about php security that is talking about exactly what your problem is. (btw it says apache runs as nobody. but my apache runs as apache. anyway ... )
i have looked into that a little, and have come to the conclusion that PHP itself isn't to blame. Here's why: the access control PHP implements is based indeed on the open_basedir ; but if that were preventing you, it would also prevent /share, since /share and /home are at the same place in the filesystem.
i find your consideration of my binding option to be a 'dirty hack' rather interesting, since as far as i know mount is the authority on where what is in the filesystem. perhaps a little disorganized ... anyway, you are certainly correct in saying it didn't help, and it isn't ever going to : (. sorry.
there is a config i would have suggested, had you not already tried it. but that isn't your problem i think. at any rate, it's disabled by default, so you might as well turn it off if you want to believe that beyond a shadow of a doubt.
the whole point of the filesystem is that it doesn't matter what it is, just where it's mounted, and that is what i am so confused about here ... so i wonder, is this problem by chance related to something about either the torrent manager you're using, or else maybe the options with which you've mounted /home ...
well, you've certainly got me stumped on this one ; ) _________________ Configuring a Firewall? Try my iptables configuration
LinuxCommando.com is my blog for linux-related scraps and tidbits. Stop by for a visit! |
|
Back to top |
|
|
|