Default default permissions for Linux under Umask

Source: Internet
Author: User

Linux has default file, folder permissions umask. Default 777-xxx (folder) 666-xxx (file)

11. View Current User Umask

R (4)--w (2)--x (1)

[Email protected] ~]# umask #查看
[Email protected] ~]#
[Email protected] ~]#
[Email protected] ~]# umask-s #对应umask的权限


Pre-set permissions (permission masks), when we create a directory or archive, it will have a default permission:

If the user is created as ' archive ' then the default ' no executable (x) item ', that is, only the RW two items, denoted by a number is 666 or letter


If the user is created as a ' directory ', the preset is open for all permissions, that is, 777 or letter, because X is related to whether it can enter this directory

Umask is related to this default permission. Umask is the "default value of the current user's permission to create a file or directory ."


We can view the umask default values like this,

# view
$umask # number Form 002 # Some machines may show 4 numbers, we generally use the latter three $umask-s # character forms U=rwx,g=rwx,o=rx

Note that the Um:ask score refers to the permission that the default value needs to be dropped, and the default permissions

Therefore, the above 002 is actually removed the other user's write permission, for the file, that is, the actual permission is 664, namely:


For the catalog, the actual is 773, namely:


2. Settings

Umask 002

Umask after 3 numbers can be set. To modify the value of the umask for a long time, you can write it into /etc/profile or ~/.profile or ~/.bash_profile .


Assuming that your umask is 003, what is the Umask case that establishes the file and directory permissions for?
A: Umask is 003, so the permission to take off is--------W, so:

File: (-rw-rw-r-)-(--------wx) =-rw-rw-r--

Catalog: (drwxrwxrwx)-(--------wx) = drwxrwxr--



Default default permissions for Linux under Umask

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.