- 论坛徽章:
- 0
|
回复 #7 cuci 的帖子
以前曾碰到过这个问题,也是装oracle时碰到的,一个普通用户被usermod -G 后其他groups丢失,比如bin,audio.结果就是这个用户工作不正常了。
今天更具体的测试了下,以下在CentOS5.2上的测试(不同版本可能结果不同)
[root@CentOS5 ~]# groupadd grp1
[root@CentOS5 ~]# groupadd grp2
[root@CentOS5 ~]# useradd test1
[root@CentOS5 ~]# id test1
uid=501(test1) gid=503(test1) groups=503(test1) context=user_u:system_r:unconfined_t
[root@CentOS5 ~]# usermod -G grp1 test1
[root@CentOS5 ~]# id test1
uid=501(test1) gid=503(test1) groups=503(test1),501(grp1) context=user_u:system_r:unconfined_t
[root@CentOS5 ~]# usermod -G grp2 test1
[root@CentOS5 ~]# id test1
uid=501(test1) gid=503(test1) groups=503(test1),502(grp2) context=user_u:system_r:unconfined_t
[root@CentOS5 ~]# useradd test2
[root@CentOS5 ~]# id test2
uid=502(test2) gid=504(test2) groups=504(test2) context=user_u:system_r:unconfined_t
[root@CentOS5 ~]# usermod -a -G grp1 test2
[root@CentOS5 ~]# id test2
uid=502(test2) gid=504(test2) groups=504(test2),501(grp1) context=user_u:system_r:unconfined_t
[root@CentOS5 ~]# usermod -a -G grp2 test2
[root@CentOS5 ~]# id test2
uid=502(test2) gid=504(test2) groups=504(test2),501(grp1),502(grp2) context=user_u:system_r:unconfined_t
开了SELinux,后面的可以不管,加-a的效果还是不一样的.
man usermod
-a, --append
Add the user to the supplemental group(s). Use only with -G option.
[ 本帖最后由 可可火山 于 2008-7-30 16:59 编辑 ] |
|