24
8
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 chmod
and 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".
1I think it's safe to assume that there is no dedicated support for what you're asking for. Only the super user can
chown
files to a different user, and setting a default like this has the potential of user mistakes, giving other users permissions without theroot
user realizing. – Daniel Beck – 2012-02-07T09:38:45.173