问题
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:
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 ~]#
来源:https://stackoverflow.com/questions/30752103/how-to-set-umask-default-for-an-user