I need to
wget something (results in a compressed file in cwd), then I have to extract it, then do some copy/move/modification stuff and perhaps finally execute an script (from the downloaded archive).
Now all these task either directly (
wget, extract etc.) or indirectly (running the script) result in creating files and directories (all in the current working directory). I do all this stuff as
root (no way to do it with the final, desired user).
The problem is: Anything created in the process is owned by root or the sudo user. When I'm done (and sometimes in the mid-way), I have to issue a series of
chown commands to make things right.
Now it would be nice if could somehow tell the system that "From now on, any files or dirs that you create when I issue commands as root, you would create with such and such ownership and permissions".