Umask in linux

Source: Internet
Author: User
Umask in linux-general Linux technology-Linux programming and kernel information. For details, refer to the following section. During the linux lab this week, many people asked me how to use umask. Here I will explain it.

A permission mask umask
Umask is supported by chmod. It has a total of four bits (gid/uid, owner, group permission, and permissions of other users), but the last three are usually used, for example, if you use chmod 755 file (the permission for this file is Master read (4) + write (2) + execute (1), the same group and other users have read and write permissions)

Role of binary umask
By default, the umask value is 022 (which can be viewed using the umask command). The default permission for the created file is 644 (6---2 ), the default permission for the Created directory is 755 (7---2). You can use ls-l to verify it. Now you should know the usage of umask, it is used to control the default permissions. Do not assign full permissions to the default files and directories.

3. Modify umask value
After learning about the role of umask, you can modify the value of umask. For example, umask 024 will grant the default permission to files and directories created later to 642,753.

Iv. Save the umask value to the Environment File
To change the umask value for a long time, you can write it into/etc/profile or ~ /. Profile or ~ /. Bash_profile, you should know what these files are.
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: 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.