How to modify the umask value for a user in Linux?
To change the umask value for Linux users, you can utilize one of the following methods:
- To use the umask command: open the terminal, type in the following command, and press Enter:
- umask
- The
is the new umask value you want to set. For example, if you want to set the umask to 022, you can enter umask 022. - Change the configuration file: Open the terminal, input the following command and press the enter key:
- Open /etc/profile using the text editor nano with administrator privileges.
- The above command will open the /etc/profile configuration file for editing. Add the following line to the end of the file:
- Set a new umask value.
- Save and close the file. Log back into the user account, the new umask value will take effect.
Please note that the umask value set using the umask command is only effective for the current session and will reset to the default value after logging out or restarting the system. If you want to permanently change the umask value, please use the second method to modify the configuration file.