linux权限不会快速更新

时间:2022-09-16 07:34:23

i am using linux. a want a group only can access to a folder. i create a group and set group of that folder to new created folder. ( by chgrp command ). and change the access to folder by chmod 070( only group can read-write-execute). in last, i add my user to new created folder. in this case i must can change directory to that folder, because i am a member of that group. i can not access to that file but if i log-out from system and login again, i can use that folder. why this problem occurs? i must run which command to update user groups?

我正在使用linux。想要一个组只能访问一个文件夹。我创建一个组并将该文件夹的组设置为新创建的文件夹。 (通过chgrp命令)。并通过chmod 070更改对文件夹的访问权限(只有组可以读写 - 执行)。最后,我将我的用户添加到新创建的文件夹中。在这种情况下,我必须可以将目录更改为该文件夹,因为我是该组的成员。我无法访问该文件,但如果我从系统注销并再次登录,我可以使用该文件夹。为什么会出现这个问题我必须运行哪个命令来更新用户组?

2 个解决方案

#1


1  

It's because things like which groups a user belongs to are read only on login. Once a user has logged in, you can change the users groups all you want, but it will not be reloaded automatically.

这是因为用户所属的组只能在登录时读取。用户登录后,您可以根据需要更改用户组,但不会自动重新加载。

#2


0  

Try:

尝试:

exec su -l $USER

I think it makes you re authenticate but should work

我认为它会让你重新认证,但应该工作

#1


1  

It's because things like which groups a user belongs to are read only on login. Once a user has logged in, you can change the users groups all you want, but it will not be reloaded automatically.

这是因为用户所属的组只能在登录时读取。用户登录后,您可以根据需要更改用户组,但不会自动重新加载。

#2


0  

Try:

尝试:

exec su -l $USER

I think it makes you re authenticate but should work

我认为它会让你重新认证,但应该工作