How can I change leading zero in umask 0022? Can it be changed?
I searched the usual methods for information and my local system was of little help.
$ man umask
No manual entry for umask
$ umask --help
bash: umask: --: invalid option
umask: usage: umask [-p] [-S] [mode]
I found an online umask man page with the following:
umask [-p] [-S] [mode]
mode ... File creation mask
-S ........ Print the mask in symbolic format
-p ........ Output in a form that can be reused as input
Based on this, I tried a few basic umask
commands:
$ umask
0022
$ umask -p
umask 0022
$ umask -S
u=rwx,g=rx,o=rx
I was surprised to find that I could not run umask with sudo
$ sudo umask
[sudo] password :
sudo: umask: command not found
I changed the regular umask as follows:
$ umask 021
$ umask
0021
$ umask 0022
$ umask
0022
Finally, I hit an error while trying to change the leading zero
$ umask 1022
-sh: umask: 1022: octal number out of range
So, back to my original question, how does one change the leading zero (0)? Is it for the super user (root)? Can it be updated, and if so, to what?
I reviewed a similar question how-is-umask-calculated-in-linux and found:
I don't know that you would unmask the first bit with
umask
, but technically you could ...
and
I don't believe you can actually set the
umask
to allow you to enable any of these extra bits by default
So, these uncertain and contradictory statements do not answer this question.
umask
on your system because it has noumask
binary; only a shell built-in. Search forumask
in the manual page for your shell. – user4556274 Mar 24 '17 at 15:28