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