Linux system UMASK usage details

  

umask is generally used to give them permission when you initially create a directory or file.

There are two points to explain here:

1. For the directory, the x permission can enter the directory, so there is no problem with the initial assignment of this permission;

2, for the file's x permissions represent execution, this risk is too high, so the general authority initial assignment must remove x;

[root@www ~]# umask

0022

What do these four letters stand for?

First of all, the above four numbers represent the permissions that the assignment initialization is ready to discard. (For the corresponding file, the x privilege must be discarded by default if it is not discarded.)

The first 0 represents the suud drop permission;

The second 0 represents this file/directory The owner does not discard any permissions (if it is a file, except x permissions, why look at the above explanation);

The third 2 user group representing this file/directory discards the w permission (if it is a file) Its x permissions are also discarded);

The third 2 represents the permissions of other users of this file/directory that can only be used with r and x (except files).

In summary, if you create a new file, its permissions are: -wr-w--w-- That is: 644

If you create a new directory then it The permissions are: dwrxw-xw-x is: 755

If you want to modify unask familiar directly:

[root@www ~]# umask 002

Understand Let's go!

Copyright © Windows knowledge All Rights Reserved