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

Daniel Gimpelevich daniel at gimpelevich.san-francisco.ca.us
Sun Jan 1 13:08:58 PST 2017


On Sun, 2017-01-01 at 13:03 -0800, Michael Paoli wrote:
> cd /
> at least many versions of shutdown will typically umount non-root
> filesystems (at least before eventually dealing with root filesystem)
> in order to umount those filesystems, they can't have any processes on
> them with open files or current directories there - that's generally
> dealt with by shutdown using fuser or the like to terminate/kill such
> offending processes ... and if your shutdown itself didn't chdir(2) to
> avoid that, then it may terminate itself.
> 
> 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.

> ()
> do it in subshell, so it dosen't alter those outside of subshell

Well, this _completely_ defeats the purpose of the "cd /" above.




More information about the sf-lug mailing list