我在哪里可以为系统帐户设置umask? [英] Where can I set umask for system account?
问题描述
我创建了一个系统帐户,专门供某些进程使用.我想为它设置 umask 002
.对于普通用户帐户,我通常将这样的配置放在 .profile
中.这种方式不适用于系统账户,因为.profile
是在登录时获取的,系统账户不需要登录.
I have created a system account that's used by some process specifically. I want to set umask 002
for it. For regular user account, I usually put configuration like this in .profile
. This approach is not suitable for system account, as .profile
is sourced at login and system account doesn't require login.
在哪里可以设置系统帐号的umask 002
?
Where can I set umask 002
for system account?
推荐答案
edit /etc/profile
并试试这个:
edit /etc/profile
and try this:
if [ `id -u` -eq $user_id_to _change ]; then
umask 002
else
umask 022
fi
当然,您必须将 $user_id_to_change
更改为要更改 umask 的用户 ID.比重启.此代码片段绝对适用于普通"用户.无法想象,为什么这不适用于系统用户.
of course you have to change $user_id_to_change
to the user id of which you want to change the umask. than reboot.
this code snippet defenitly works with "normal" users. cant imagine, why this shouldnt work with system users.
这篇关于我在哪里可以为系统帐户设置umask?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!