what is umask.
When we log on to the system and create a file that always has a default permission, then how does this permission come from? That's what Umask did. Umask Set the user to create the default permissions of the file, it and chmod effect just the opposite, Umask set is the permission "complement", and chmod set is the file permission code.
Here are two points to note:
1, for the directory X permission representative can enter the directory, so that the initial assignment of this permission is no problem;
2, for the file X permission representative execution, this risk is too high, so the general permissions initial assignment must remove X;
How to view File/directory permissions?
What does the result of running mean?
------------------------------> below.
how to calculate the Umask value.
The Umask command allows you to set the default mode at the time the file was created, and there is a number in the corresponding Umask value for each type of user (file owner, same group user, other user). For a file, the maximum value for this number is 6. The system does not allow you to give permission to execute a text file when it is created, and you must use the chmod command to add this permission after creation. The directory allows you to set execution permissions so that the number of umask can be up to 7 for the directory.
The general form of the command is:
Umask nnn
Among them nnn is Umask 000-777.
calculation : To analyze the results of the above operation,
The first 0 represents Suid's discarded permissions;
The second 0 represents the file/directory owner who has not been discarded (if it is a file, except for x permissions);
The third 2 represents the user group for this file/directory to discard the W permission (if it is a file, then its x permissions are discarded);
The fourth 2 represents the permissions that other users of this file/directory can use only R and X (Files only drop x).
The above, if you create a new file, then its permissions are:-rw--r--r--is: 644;
If you create a new directory, then its permissions are: Drwxr-xr-x is: 755
So, here's the question: How to modify the permission values.
Just use the umask command to set a new value:
Input: Umask 002
To see if the modification was successful, you can enter umask to view directly
Be sure to figure out what file/Directory creation default permissions you want to have before using the Umask command. Otherwise, you might get some very strange results; For example, if you set the Umask value to 6 0 0, then the file/mesh created
The default permission for recording is 0 6 6.
Reference:
Http://www.jb51.net/LINUXjishu/94383.html
http://blog.csdn.net/lmh12506/article/details/7281910