Linux umask settings

Source: Internet
Author: User

Security mechanism of the system: Umask (Filter code)

Use the Umask command to view the values of the current user

For ordinary users umask:0002

For administrators umask:0022



So when

When the administrator creates the folder, it is 777-umask = 755

For administrators when creating files 666-umask = 644

So:

Administrator set up files by default is 644 permissions

Administrator-created folder default is 755 permissions

User-created file default is 664 permissions

User-created folder default is 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 creating a file, 666-023 = 643. However, the default permissions for a file do not have X permissions, so 643 automatically turns it into 642


The Umask setting is not persistent. Fails after re-landing

The command set with the Umask command is valid only for the current user's time shell.

----------------------------------------------------------------------

If you want him to work forever: you need to define Umask in the startup configuration file

Global:/etc/profile,/etc/profile.d/*/etc/bashre

Users: ~/.bash_profile, ~/.BASHRC

Profile class, applied to the interactive login shell

BASHRC class, non-interactive login.


Interactive logon: Read order: (higher priority)

/etc/profile--/etc/profile.d/*--and ~/.bash_profile--~/.BASHRC--/ETC/BASHRC

Non-interactive shell: The shell run sequence when a scripting system can be powered on and run automatically

~/.BASHRC--/ETC/BASHRC-/etc/profile.d/*

------------------------------------------------------------------------

So, if you want to change umask, edit/ETC/BASHRC.

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


Linux umask settings

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.