首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法更改umask模式

无法更改umask模式
EN

Unix & Linux用户
提问于 2017-10-25 22:22:05
回答 1查看 1.2K关注 0票数 2

我试图使用login.defs配置文件更改umask模式,但由于某些原因,它不会影响系统。

我就是这么做的:sudo nano /etc/login.defs

代码语言:javascript
复制
# The ERASECHAR and KILLCHAR are used only on System V machines.
# The ULIMIT is used only if the system supports it.
# (now it works with setrlimit too; ulimit is in 512-byte units)
#
# Prefix these values with "0" to get octal, "0x" to get hexadecimal.
#
ERASECHAR       0177
KILLCHAR        025
UMASK           027

试图将UMASK 027更改为UMASK 007,它就会发生变化。

下一步:

代码语言:javascript
复制
# Enable setting of the umask group bits to be the same as owner bits
# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is
# the same as gid, and username is the same as the primary group name.
#
# This also enables userdel to remove user groups if no members exist.
#
USERGROUPS_ENAB yes

然后将USERGROUPS_ENAB yes更改为USERGROUPS_ENAB no,然后保存文件并进行注销和登录,并尝试创建一个文件,例如:

代码语言:javascript
复制
touch file ~/

和文件的输出

代码语言:javascript
复制
stat -c %a ~/file

644,而不是预期的640。我记得我在一段时间前就做过这件事,而且效果很好。

还有其他的解决办法或解释吗?

这是我的核心信息:

代码语言:javascript
复制
Linux 4.13.8-1-ARCH #1 SMP PREEMPT Wed Oct 18 12:11:48 CEST 2017 i686 GNU/Linux
EN

回答 1

Unix & Linux用户

回答已采纳

发布于 2017-10-31 19:06:59

谢谢你的评论谁曾经试图帮助我。因此,我碰巧通过更改umask 027文件使~/bashrc模式永久化。事实上,该文件中没有任何umask集,因此我在文本末尾添加了以下几行:

代码语言:javascript
复制
#umask mode
umask 027

在系统注销和登录后,它似乎覆盖了整个系统的这条规则,现在新创建的文件具有640权限。

票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/400475

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档