- 論壇徽章:
- 0
|
回復(fù) #7 cuci 的帖子
以前曾碰到過(guò)這個(gè)問(wèn)題,也是裝oracle時(shí)碰到的,一個(gè)普通用戶(hù)被usermod -G 后其他groups丟失,比如bin,audio.結(jié)果就是這個(gè)用戶(hù)工作不正常了。
今天更具體的測(cè)試了下,以下在CentOS5.2上的測(cè)試(不同版本可能結(jié)果不同)
[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
開(kāi)了SELinux,后面的可以不管,加-a的效果還是不一樣的.
man usermod
-a, --append
Add the user to the supplemental group(s). Use only with -G option.
[ 本帖最后由 可可火山 于 2008-7-30 16:59 編輯 ] |
|