I'm using Cloud9IDE's SSH workspaces, and for a variety of reasons, we are required to create that SSH tunnel as root. This is not really an issue, however the files and directories we are creating with it actually live under a user folder (in this case let's say the user is "foobar", so the files are being created in /home/foobar/public_html/dev).
The problem is that since the user "root" is actually creating the files, navigating to those files in the browser returns a 404, since the server uses the user "foobar" to serve pages.
I need a way to ensure that even though files have been created by the root user, the user foobar should be able to read and execute them as though that user created them.
I have tried using setfacl -Rdm with a group that includes root and foobar, and that wound up making it so foobar could no longer serve any files in it's directory.
-rw-r--r-- 1 foobar foobar 125 May 15 11:26 die.html -rw-r--r-- 1 root root 127 May 15 12:20 dies.html
In this case, the file "die.html" is served properly, but "dies.html" results in a 404 due to the owner and group.
Any thoughts on how to resolve this? To reiterate: I would need this to happen for all future files, not simply files which presently exist.