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?

  • while googling I found that /etc/auto.master has uid and gid too, and that might be the one of the user that owns the files.
    – Bastian
    May 7 '12 at 10:47

I had the same problem. In my case, encrypted data container at /home/.mysql was owned by root:root. It was mounted with mysql uid and gid, so technically, owner of mounted directory was mysql user, but behind it was encrypted container owned by root. That's why encfs complained about permission denied.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.