You need to modify the php BaseDir setting for the ibay (or in the template). This restricts the php interpreter/webserver to specific directories. You also need to add any directories you want to read files from.
I set up Joomla (/opt/joomla), added gallery2 into a subdir (/opt/joomla/gallery2), then modified the /etc/httpd/conf/httpd.conf fragment to include a basedir directive giving access to /ibays/photos/files, so I can directly import photos (via symlink to full res versions) into Gallery2.
It all works a charm - if you have an ibay you can add basedir entries via the e-smith db as well - I just can't quite remember the syntax at the moment.
Si