I'm having some permissions issues on a Fuse mounted directory and I'm a bit confused about how to set the owner. I have a media directory on a server that apache uses to create and serve some user generated files (it's a Django user media directory). On this server everything from the directory to the files is owned by www-data which is correct. On a secondary server which is a clone of the first one I use Fuse to mount the directory with autofs but everything is owned by the user of this server, not by www-data which is problematic since apache can't write there. In my auto.sshfs I use this:
mountpoint -fstype=fuse,rw,nodev,nonempty,allow_other,reconnect,uid=1000,gid=1000,max_read=65536,compression=yes,auto_cache,no_check_root,kernel_cache :sshfs\#server1@server1:/home/server1/user_media
I use uid and gid of the remote user. I've read that idmap would allow both sides to read write but may be I should use uid of www-data. Anyway on the second server the files should belong to www-data just like on the first server but I'm not sure how to do that and I can't really fool around with the production servers. Any light is welcome!
EDIT: I changed the user uid and gid to apache and indeed the new files / directories are created by this user now but what is even stranger is that if I log as apache and go to the directory and try to create files / directories I get a permission denied. Anybody knows what is going on?