This is an odd scenario, but I would like to maintain the directory structure as it is used by a python/pyramid app. It is also on Ubuntu Server 12.04.2, the file server is 12.10
I have a set of directories in .../priv_res that contain collections of symlinks to images in one of four directories .../priv_res/raw, .../priv_res/original, .../priv_res/web, and /priv_res/thumb. The idea is that the four directories will contain all of the actual images and the "other" directories will group them together into "galleries" by using symlinks. I was trying to avoid storing the images in 100's of directories. Instead I would store them into one massive directory and segregate them into galleries by using symlinks. The directory structure looks roughly like this.
.../priv_res /raw (all raw images are here) /original (all original images are here) /web (all images resized for web are here) /thumb (all images resized for thumbs are here) /L6RJHX6CWEAB /raw (stores the symlinks to .../priv_res/raw for the images in the "L6RJHX6CWEAB" gallery /web (stores the symlinks to .../priv_res/web for the images in the "L6RJHX6CWEAB" gallery /thumb (stores the symlinks to .../priv_res/thumb for the images in the "L6RJHX6CWEAB" gallery /<and more directories with more symlinks>
A little back story now. This directory structure was on the web server and everything was working. I then decided to move the images off to a file server via rsync. This worked but the symlinks broke because the location in the directory hierarchy is different. I left it as is because I didn't know what would happen after I tried to mount this new directory.
After some research I decided that sshfs was the best way to go. So I added my web server user to the fuse group, created a mount point that would take the place of where the files originally were. It turned out I could only mount the remote directory when I was the owner of the mount point, www-data. This seems successful as I get a "No identify available Install ImageMagick to browse images" when I try to look at one of the symlink images with less. However, the problem is that my application can't seem to serve the images. When I review the server logs I see permission issues. To attempt to get around that I used the idmap=user option like so
sshfs -o idmap=user firstname.lastname@example.org:/media/raid_dump_0/priv_res /apps/personal/app_files/firsttest/priv_res
I am not sure what I am missing, or even if this is a good way to go about this. It seems more complicated than it needs to be. Also, I will need to be able to write to the remote directory if possible. The most important part is that the images are on the new file server.
Any constructive input would be welcomed.
Update: I am not entirely user what I did or why it worked. I came in as www-data via su. I then ran just
sshfs email@example.com:/media/raid_dump_0/priv_res /apps/personal/app_files/firsttest/priv_res
Note that this is without the idmap option. I checked my permissions for the mount point and I was getting my original uid which isn't www-data or root. On a whim I decided to see if my web app could serve up the images, and it was. I have no idea why the app server (uwsgi) was able to access the mount point or if this is even secure. However, this is just for family photos so I don't care all that much as long as it isn't wide open to everyone on the web.