How to set umask default for an user?

5.7k views Asked by At

Does anybody know how can I set an umask by default for an user and force them to use it?

I think put umask 0002, for example, in his ~/.bashrc file but if I do that, they can change umask.

Thanks ;)

1

There are 1 answers

3
Sriharsha Kalluru On BEST ANSWER

You can make a work around for it by using /etc/profile file. I added the following lines at end of /etc/profile. It will overwrite the actual umask command by after setting it the value which you require

umask 0002
alias umask='echo umask cannot be changed'
enable -n umask


[root@client1 ~]# umask
umask cannot be changed
[root@client1 ~]# \umask
-bash: umask: command not found
[root@client1 ~]#