How do you use Umask in Linux for special permissions like setuid, setgid, and sticky bits?
-
For what practical purpose?– grawity_u1686Commented Feb 16, 2021 at 13:31
-
No practical purpose , just wanna learn , How we use it.– vikram singhCommented Feb 16, 2021 at 13:33
-
You don’t. See facl ignoring the “x” permission but only on files; also where do default file permissions before umask come from?.– Scott - Слава УкраїніCommented Feb 16, 2021 at 16:11
1 Answer
Umask has nothing to do with granting permissions.
When you create a file or directory, it has a default set of permissions. These default permissions are modified by the umask setting in the /etc/profile
file, or in your .cshrc
or .login
file. By default, the system sets the permissions on a text file to 666, which grants read and write permission to user, group, and others, and to 777 on a directory or executable file.
The value assigned by the umask command is subtracted from the default. This process has the effect of denying permissions in the same way that the chmod command grants them. For example, while the chmod 022 command grants write permission to group and others, the umask 022 command denies write permission for group and others.