如何设置系统范围的umask? [英] How to set system wide umask?

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

问题描述

我正在一个正在运行Linux(Debian和Ubuntu)的实验室中工作.用户名和组名由NIS和yp处理.我们有一些普通用户,每个人都可以访问该用户来运行实验,然后我们每个人都有自己的用户,此外还有一个共同的组,我们都是该组的成员.

I am working in a lab where we are running Linux (Debian and Ubuntu). Usernames and group names are handled by NIS and yp. We have some common users that everybody has access to that run the experiments and then we each have our own users in addition there is a common group that we are all a member of.

如何使用户/组读取/写入(/可执行)共享/home/驱动器(NFS)上的所有文件和目录?基本上我想要的是

How can I make such that all files and directories on the shared /home/ drive (NFS) is read/write(/executable) by user/group? Basically what I want is

chmod -R 664 /home
chgrp -R commongroup /home

或等效的umask 0002.

但是运行以上命令只能修复文件夹中的当前文件,而umask仅适用于单个用户,并且必须在每次用户登录时都运行.在.bashrc文件中(这是否可以通过gnome用于更改模式?).是否可以使用系统范围的命令或设置来确保我们的公共组对公共文件具有写访问权?

But running the above commands only fixes the current files in the folders and umask only works for single users and has to be run every time a user logs in ie. in the .bashrc file (and will this work for changes mode via gnome?). Is there a system wide command or setting that I could use to make sure that our commongroup has write access to the common files?

推荐答案

Debian和Ubuntu均随附

Both Debian and Ubuntu ship with pam_umask. This allows you to configure umask in /etc/login.defs and have them apply system-wide, regardless of how a user logs in.

要启用它,您可能需要在/etc/pam.d/common-session阅读内容中添加一行

To enable it, you may need to add a line to /etc/pam.d/common-session reading

session optional pam_umask.so

,或者它可能已经启用.然后编辑/etc/login.defs并将UMASK行更改为

or it may already be enabled. Then edit /etc/login.defs and change the UMASK line to

UMASK           002

(默认为022).

请注意,用户仍然可以在自己的~/.profile~/.bashrc或类似版本中覆盖umask,但是(至少在新的Debian和Ubuntu安装中)在/etc/profile. (如果有,只需将其删除.)

Note that users may still override umask in their own ~/.profile or ~/.bashrc or similar, but (at least on new Debian and Ubuntu installations) there shouldn't be any overriding of umask in /etc/profile or /etc/bash.bashrc. (If there are, just remove them.)

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

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