Is there a way to run a command as root (using
sudo perhaps) but have the files created by that command be owned by someone else?
Some context: I have a web server that I run as root in order to have access to port 80. That web server creates files, which are then owned by root. But, when I do a make (using Maven actually) as my normal user, I get a bunch of errors because it can't remove some of the root-owned files. So, it would be nice if I could run the web server as root, but the files it created were owned by me.
I made a script to "clean out" the files that interfere with the make, so I'm not really interested in solutions to that problem ... I'm just curious if there's a way to run as root but create files as someone else.