Configure umask 033 for all user, users root and Student1 must have their own 022 umaks.
how do you write this answer?
@Ksahil That's what I mentioned in my answer. For default user setting : it is /etc/profile.
After that if you need to have a different umask setting for some user , you can edit their respective shell profile files ( .bashrc or bash_profile).
For some 50 users scenario , you would need to have a shell script and use a loop which can change the umask for those 50 users : use for loop to do this : echo "umask umask_value" >> home_dir/.bashrc" for all users in the list.
Hello @Ksahil !
Thanks for reaching out!
System wide default umask is set in /etc/profile directory. That will be effective for all users including root user. ( We also use /etc/login.defs file for setting a default umask value for all new users , however the umask value specified in /etc/profile applies to all users' shell sessions, including existing users.)
If you want to change that for a particular user : edit the respective shell profiles ~/.bashrc or ~/.bash_profile file in their home directory path.
You just have to add the line : "umask 033" in those files.
Hello @Chetan_Tiwary_, Thank you for giving your valuable time to answer it.
I understand your points but how can I answer the question ... solution?
Because "root and Student1 must have their own 022 umaks" and the rest users have "033" permission.
Suppose this I have to do on bulk users in the ratio of 50:50 how can we perform the steps?
(For 50 users we have to keep 022 and other 50 we have to do 033.)
Thank you !!
@Ksahil That's what I mentioned in my answer. For default user setting : it is /etc/profile.
After that if you need to have a different umask setting for some user , you can edit their respective shell profile files ( .bashrc or bash_profile).
For some 50 users scenario , you would need to have a shell script and use a loop which can change the umask for those 50 users : use for loop to do this : echo "umask umask_value" >> home_dir/.bashrc" for all users in the list.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.