0

I understand we use "umask" for setting different security levels:

umask value Security level Effective permission (directory)
022 Permissive 755
026 Moderate 751
027 Moderate 750
077 Severe 700

Can we set umask to 028 or any other value so that it includes a number greater than "7"?

2
  • Umask bits correspond to r w x bits so going above makes no sense. Commented Jan 25, 2022 at 20:06
  • 1
    Where did you copy that table from? The "Security level" column makes no sense at all.
    – Kusalananda
    Commented Jan 25, 2022 at 20:48

1 Answer 1

5

The shell's umask command takes the permission mask as an octal number, in base 8. Base 8 only has the eight digits 0 to 7, unlike decimal (ten digits) or hexadecimal (sixteen).

So, no, you can't use umask 028 in the shell, it doesn't mean anything. Of course the umask is just a pile of bits, a number, and it could be represented in decimal or hex too. E.g. in C code, 022 (octal) is the same number as 18 (decimal), so the system call to set umask to 022 could be written as umask(18).

But given there's three permission bits (rwx), and three bits can represent eight different values, octal is a rather useful way to represent permission bits.

Also, it may be useful to consider umask values for what they mean with regard to permissions granted to other users, instead of single-word descriptions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .