[sf-lug] What purpose is served by the first two parts? (cd / && umask 022 ...

Michael Paoli Michael.Paoli at cal.berkeley.edu
Sun Jan 1 16:37:04 PST 2017


> From: "Daniel Gimpelevich" <daniel at gimpelevich.san-francisco.ca.us>
> Subject: Re: [sf-lug] What purpose is served by the first two parts?  
> (cd / && umask 022	...
> Date: Sun, 01 Jan 2017 13:08:58 -0800

> On Sun, 2017-01-01 at 13:03 -0800, Michael Paoli wrote:

>> umask 022
>> mostly precautionary - typically sufficiently but not excessive
>> default
>> security for superuser (root) performing an operation such as
>> shutdown,
>> software installation, etc.
>
> This only has any effect on creation of files (and directories, since
> they are also files) which normally, a shutdown does not do.

If it, or descendant process happens to create a new file (e.g. log
file or whatever), without it otherwise having explicitly set umask
or mode, then it may be useful.

>> ()
>> do it in subshell, so it dosen't alter those outside of subshell
>
> Well, this _completely_ defeats the purpose of the "cd /" above.

Hardly.

# (cd / && umask 022 && echo 'shutdown [some specified time hour(s)  
hence ...]' | batch)
# [do other useful stuff and still from same directory and with same  
umask value ...] ...




More information about the sf-lug mailing list