How to set umask default for an user?

风流意气都作罢 提交于 2019-12-11 09:17:12

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!