0

I have a Django application that access a remote directory mounted with sshfs to upload files. The Django application has to read those files as well. The setup is running fine with the Django server (runserver). I suppose that this is because the Django server runs as the current user and therefore it has access to the remote mount. However, when the same application runs on Apache server I cannot access the remote mounted directory. I assume that this could be because Apache daemon tries to access the folder as www-data user which will not have access to the remote folder since it is not the user which created the mount.

So the question is, how can I overcome this? I've added the directive:

WSGIDaemonProcess my.server.com user=myuser group=mygroup

to the current-site.conf file in a hope that if the python process runs as myuser then the access should be the same as with the Django server, but it doesn't help.

Any ideas?

  • It may be of relevance which OS and which version you are running. Which error do you get when trying to access that mount point? Are there any clues in the kernel log (run dmesg and look for related error messages)? – kasperd Dec 12 '18 at 16:20
  • Thanks @kasperd. The OS is Ubuntu 16.04 LTS. I cannot see anything in dmesg but in Apache logs I can see Permission denied errors when trying to read the files. The mounted directory is in another server without Apache user defined. – user2641103 Dec 13 '18 at 7:53
0

I've found a solution. I had to mount the remote folder with the option allow_other:

> sudo sshfs -o allow_other myuser@remote.server.com:/remote_folder/ ~/local/mount/folder/

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.