61-umask Concise Notes

Source: Internet
Author: User

Set the permission mask when creating a file

umask [Mask]

Parameters

Mask can be a 3-bit octal number or a symbol value as used in chmod ,mask Specifies the disallowed permission (the actual permission of the file is 777 minus the umask value)

If there are no parameters, then umask will display the permission mask when the file is created

Options

-S gives the permission mask when creating the file in the form of a symbol

Exampleumask
$ umask0022

Displays the permissions that are not allowed by default when creating a file, regardless of the 1th bit

Group users and other users are not allowed to have write permissions here

umask-s
$ umask-su=rwx,g=rx,o=rx

Show default Permissions

umask Setting Masks
$ umask u=rw,g=r,o=r$ umask0133$ umask-su=rw,g=r,o=r

Set a mask as a character

umask Setting Masks
$ umask 022$ umask0022$ Umask-su=rwx,g=rx,o=rx

Set a mask numerically

Tips

1. Regardless of the mask value, most programs do not attempt to create a file with Execute permissions (this is a unspoken rule) because they do not consider it necessary to create an executable file

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

2.mkdir is a special case, it assumes that the user does need to set executable permissions, so that the directory can be executed (into the directory)

61-umask Concise Notes

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.