How to correctly SSHFS mount a www-data directory?
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The directory is not group writable, so being a member of the group doesn’t help.
In my experience, files in/under the DocumentRoot should be owned by the user with which you are connecting. I think it is not a good practice for them to be owned by www-data.
So what would you recommend? Should I make the User and Users group the owner of that directory and add www-data to the users group? I dont know if this works, since this directory is usually for serving files via webinterface.
The group www-data should not ever have any other member than www-data itself, except in some unusual edge cases. I'd second the recommendation of having the directory owned by the user that is doing the uploading.
Sorry, I forgot that adding SSHFS complcates things.
If the account mounting the remote directory via SSHFS is a member of the ssh-fs group, then it can assign the mount to that group. You'll need to know the numeric group id for the ssh-fs group and put that where it says 1105 below:
The allow_other is needed for others to have the potential even be able to read the directory at all. Then the group on the client system has to be set up using gid= so that the number is the GID of the shared group. Then on the server that [font=courier]sshfs[/courier] is connecting to, do the group settings for a shared group.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.