如何为用户设置umask默认值? [英] How to set umask default for an user?

查看:70
本文介绍了如何为用户设置umask默认值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道我如何默认为用户设置umask并强迫他们使用它吗?

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

例如,我认为将 umask 0002 放在他的〜/.bashrc文件中,但是如果我这样做,他们可以更改umask.

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

谢谢;)

推荐答案

您可以使用/etc/profile 文件来解决此问题.我在/etc/profile 的末尾添加了以下几行.设置所需的值后,它将覆盖实际的umask命令

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 ~]#

这篇关于如何为用户设置umask默认值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆