Add the solution to the user after the user group has not been set permissions

To reproduce the problem:

1, see the general user identity information

[test1@localhost ~]$ id
uid=1005(test1) gid=1009(test1) groups=1009(test1) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

2, root root ordinary users add Group

[root@localhost ~]# gpasswd -a test1 root
Adding user test1 to group root

3, see the general user identity information

[test1@localhost ~]$ id
uid=1005(test1) gid=1009(test1) groups=1009(test1) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

Here you can see the user belongs to the group has not changed, naturally, it will not have the corresponding authority

Problem Solution:

The first way: newgrp root command execution

[test1@localhost ~]$ newgrp root
[test1@localhost ~]$ id
uid=1005(test1) gid=0(root) groups=0(root),1009(test1) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

You can see the user belongs to the group changed much, where it has been set permissions

The second way: to reproduce the login after logout

Guess you like

Origin www.cnblogs.com/tianyingz/p/11959935.html