Linux default permissions Super Simple calculation method

Source: Internet
Author: User

For Umask value 002, what are the corresponding file and directory default creation permissions?

The Umask command allows you to set the default mode for file creation, with a corresponding number of umask values for each type of user (file owner, same group of users, other user).

For a file, the maximum value for this number is 6, respectively. The system does not allow you to give permission to execute a text file when you create it.

This permission must be added with the chmod command after creation. The directory allows you to set execution permissions, so that for the directory, the number of umask can be up to 7.

Umask for a file, when the cardinality is included, the highest permission 666-unmak the value +1, including the even-numbered 666-umask

Umask for folders, maximum permissions 777-umask


[Email protected] app]# umask 023

[email protected] app]# Touch file1

[Email protected] app]# ls-ltr

-rw-r--r--. 1 root root 0 Jan 6 03:20 file1

[Email protected] app]# Umask 025

[email protected] app]# Touch file2

[Email protected] app]# ls-ltr

-rw-r--r--. 1 root root 0 Jan 6 03:20 file1

-rw-r---W. 1 root root 0 Jan 6 03:21 file2

[Email protected] app]# umask 035

[email protected] app]# Touch file3

[Email protected] app]# ls-ltr

-rw-r--r--. 1 root root 0 Jan 6 03:20 file1

-rw-r---W. 1 root root 0 Jan 6 03:21 file2

-rw-r---W. 1 root root 0 Jan 6 03:22 file3

[Email protected] app]# mkdir dir3

[Email protected] app]# ls-ltr

-rw-r--r--. 1 root root 0 Jan 6 03:20 file1

-rw-r---W. 1 root root 0 Jan 6 03:21 file2

-rw-r---W. 1 root root 0 Jan 6 03:22 file3

DRWXR---W. 2 root root 4096 Jan 6 03:26 dir3


Linux default permissions Super Simple calculation method

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.