How to set umask default for an user?

2019-08-10 21:15发布

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 ;)

标签: linux bash umask
1条回答
Evening l夕情丶
2楼-- · 2019-08-10 22:00

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 ~]#
查看更多
登录 后发表回答