Linux-folder, file default properties: Umask use

Source: Internet
Author: User

A permission Mask umask

Umask is a chmod package. A total of 4 bits (Gid/uid, owner. Group rights, other users ' rights), only the most commonly used is the latter 3. For example, you use chmod 755 file (at this time the permissions of the files are the main read (4) + write (2) + run (1), the same group and other users have read and write permissions)

The role of two umask

By default, the Umask value is 022 (can be viewed with the umask command). At this point you set up the default permissions of the file is 644 (6-0,6-2,6-2), set the default permissions of the folder is 755 (7-0,7-2,7-2), can be used to verify with ls-l oh now you should know the purpose of umask. It is to control the default permissions, do not make the default files and folders have a full set of

Three changes umask value

After knowing the effect of the umask. You can change the value of Umask, for example: Umask 024 The default permissions for files and folders that are created later are 642,753.

Four Save the Umask value to the environment file

To change the value of umask for a long time, you can write it into/etc/profile or ~/.profile or ~/.bash_profile.

Do you know what the default attributes will be when you create a new file or folder? Oh!

It's about the umask! So what's umask doing? Basically, umask is specifying "the user's default value when creating files or folders," So how do you know or set umask? His specified condition is specified in the following way: syntax:

Description: View umask value for direct input umask can, and set it? That's right!

is umask after three numbers. So how to specify it? It is mainly related to the file attributes of Linux (that nine properties, R, W, X), and is the example of the relationship with fractions, and the following rules are supplemented:

If the user is set up as "file" then the preset "no operational (x) item" is available. That is, only the RW two items, which is the maximum of 666 points


If the user is set up as a "folder", the default is open for all permissions, which is 777 points, because X is related to the ability to enter the folder.


Linux-folder, file default properties: Umask use

Related Article

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: 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.