A detailed explanation of the usage settings of Linux umask commands

Source: Internet
Author: User

Security mechanism of the system: Umask (Filter code)

Use the Umask command to view the value of the current user
For the average user speaking umask:0002
For administrators umask:0022

So when

When the administrator creates the folder, it is 777-umask = 755
666-umask = 644 When the administrator creates the file
So:

The administrator establishes the file by default 644 permissions
The Administrator establishes the folder by default 755 permissions
The user establishes the file by default 664 permissions
The user creates a folder by default 775 permissions
------------------------------------------------------------
Umask can be changed.
Umask N:
For example: Umask 027

Suppose we let the user set 754 permissions: 777-754 = 023 So, umask =023
When you create a file, 666-023 = 643. However, the default permissions for the file do not have X permissions, so 643 automatically turns it into 642
The Umask settings are not persistent. Failure after re-landing
Commands set using the Umask command are valid only for the current user's shell.
----------------------------------------------------------------------
If you want him to work forever: you need to define the Umask in the startup configuration file

Global:/etc/profile,/etc/profile.d/*/etc/bashre
User: ~/.bash_profile, ~/.BASHRC
Profile class, applied to the interactive login shell
BASHRC class, non-interactive login.

Interactive logon: Read order: (Higher precedence)
/etc/profile-->/etc/profile.d/*--> ~/.bash_profile--> ~/.BASHRC-->/ETC/BASHRC
Non-interactive shell: When a script system is able to boot automatically run the shell run order
~/.BASHRC-->/ETC/BASHRC-->/etc/profile.d/*
------------------------------------------------------------------------
So, want to change umask, edit/ETC/BASHRC

If you want to modify the user individually, you only need to define that user's ~/.BASHRC

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.