0

How can I create a symlink that works kinda like this:

There is a symlink in /home/user/ called "www"

I want to make it so, "user" can go into the symlink, and everything be owned by "user" but in the real directory, everything be owned by "www-data"

I know I am explaining bindfs, but it's horrible for scale-ability to use bindfs. Just by using bindfs to allow 2 developers to access customer websites, It's become very clear to me, that once I have customers that want FTP access, it won't be easy to do this automatically, and still have maintainability.

  • Why not do it via a group? Option 1 - Add each user to the www-data group. Option 2 add all user groups to www-data. Option 3 create a new group that is added www-data user and to each user. – rovr138 Apr 8 '17 at 4:40
  • Enable the support of ACL of your filesystem and use setfacl of package acl for this rule. – ingopingo Apr 8 '17 at 5:05
2

You are explaining bindfs. What you want to do can't be done with anything substantially simpler. Symbolic links have no impact on permissions, they won't solve your problem.

The assertion that “it's horrible for scale-ability” doesn't rest on any fact that I can think of. Bindfs is pretty easy to use — just call the bindfs command to create a filesystem view, and call fusermount -u when you're tired of that view. If there's something you can't figure out, feel free to ask a question here.

However, bindfs may not be what you need, because the requirement you gave is not a good idea in most scenarios. It is usually a bad idea to have a file that is both owned by www-data, i.e. meant to be managed by a web application, and accessed directly by other users. If the file needs to be read by the application and managed by other users, then what you need is to set an ACL that allows the www-data user to read the files. See Why don't I have read access to files with modified ACL?

If what you need is for developers to be able to modify a website, then the developers should never touch files in production, you should have a deployment system instead.

  • It's horrible for scale-ability because I have to open /etc/fstab everytime i want to create a new link. And I drop something like this into that file, except with modified for what directory they can access, their username/group, etc. bindfs#/var/www/johndoe /home/developer/www fuse force-user=developer,force-group=developer,create-for-user=www-data,create-for-group=www-data,create-with-perms=0770,chgrp-ignore,chown-ignore,chmod-ignore 0 0 – Not_Lazy Apr 11 '17 at 3:06
  • @Not_Lazy You have to put this information somewhere. Either /etc/fstab, or some other file that's read during startup. There's nothing here that's remotely hard to scale. – Gilles Apr 13 '17 at 0:51
  • @Not_Lazy Again, not remotely hard to scale. If you're worried about messing up /etc/fstab, do your mounts from a separate startup job that reads a separate file. The level of difficulty is low compared to the difficulty of the requested feature. – Gilles Apr 14 '17 at 7:21
  • What I had in mind wasn't. I was hoping for something like link -s /var/www/website1 /home/dev/www -p 0770 -f dev -t www-data -Mo and then it be a permanent link with seperate permissions depending on if you were in the real directory or the symlink. But whatever, Thanks for the help. – Not_Lazy Apr 14 '17 at 18:11

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.