Default file permission: umask

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.