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