1. Default File Permissions
In linux, when we create a file and directory, what are the default permissions for this file and directory? Run the umask command to view the information:
$ Umask0002 $ umask-Su = rwx, g = rwx, o = rx
Permission we know there are three types of permissions: r, w, and x. umask returns four digits. The first one is special permission. First, the last three digits are checked. 002 permission indicates that -------- w-is displayed as a symbol by using the-S parameter.
2. file and directory permissions
File: The file is generally a data record and does not require the (x) permission, that is,-rw-. The maximum value is 666. directory: The x permission of the Directory indicates whether the user can access the directory. By default, all permissions should be enabled, that is, drwxrwxrwx, which is the 777 permission.
3. User default permission Calculation
File Permission: The maximum permission minus umask permission 666-002 = (-rw-)-(-------- w-) =-rw-r -- = 664
Directory permission: 777-002 = (drwxrwxrwx)-(d ------- w-) = drwxrwxr-x = 775
$ Touch a $ mkdir B $ ll-rw-r -- 1 work 0 Jun 15 adrwxrwxr-x 2 work 4096 Jun 15 B
Generally, the root account umask is 022, and the general user is 002. The write permission of the same group of users is retained.
Address: http://blog.csdn.net/yonggang7/article/details/31025973