Simple Linux Command Line notes: umask

Source: Internet
Author: User
ArticleDirectory
    • Parameters
    • Option
    • Example
    •  
    • Tips

Set the permission mask when creating the file

Umask [Mask]

 

Parameters

MaskIt can be three octal digits orChmodSymbol value used in,MaskSpecify the disallowed permissions (the actual permission of the file is 777 minus the umask value)

If there are no parametersUmaskThe permission mask is displayed when the file is created.

 

Option

-S indicates the permission mask used to create a file.

 

Example Umask
$ Umask0022

Displays the permissions that are not allowed by default when a file is created. You can leave the 1st-bit permission blank.

The group users and other users are not allowed to have write permissions.

 

Umask-S
 
$ Umask-Su= Rwx, G = RX, O = RX

Show Default Permissions

 

Umask
 
$ Umask u = RW, G = r, O =R$ umask0133$ Umask-Su= RW, G = r, O = r

Set mask in Character Mode

 

Umask
$ Umask022$ Umask0022$ Umask-Su= Rwx, G = RX, O = RX

Set mask in numeric Mode

Tips

1. Whatever the value of the mask, mostProgramWill not try to create a file with the execution permission (this is a potential rule), because they do not think it is necessary to create an executable file

Therefore, when a utility (such as touch) creates a file, the system uses 6 minus every number in the mask.

2. mkdir is a special case. It assumes that you do need to set executable permissions to make the directory executable (enter the directory)

 

 

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.