0

How do you use Umask in Linux for special permissions like setuid, setgid, and sticky bits?

3

1 Answer 1

0

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.

2
  • for changing default permission ? Commented Feb 16, 2021 at 13:56
  • The default is always 666. The only way to change that is to assign permissions to the containing folder, so that new contained files/folders can inherit them. See post.
    – harrymc
    Commented Feb 16, 2021 at 14:00

You must log in to answer this question.

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