我有一个这样的用户:
uid=501(ironsand) gid=500(foo) groups=500(foo),10(wheel),497(git),501(ironsand)
Run Code Online (Sandbox Code Playgroud)
并将主要组更改为 Ironsand like gid=501(ironsand),我输入了以下命令:
sudo usermod -g ironsand ironsand
Run Code Online (Sandbox Code Playgroud)
它改变了组的顺序,但没有改变主组,如:
uid=501(ironsand) gid=500(foo) groups=501(ironsand),10(wheel),497(git),500(foo)
Run Code Online (Sandbox Code Playgroud)
我以为有人已经问过这样的问题,但我找不到。
如何更改主要组?
Adi*_*sak 140
通常你会像下面那样做。
将主要组分配给用户:
$ usermod -g primarygroupname username
Run Code Online (Sandbox Code Playgroud)
将次要组分配给用户(-a保持现有的次要组完好无损,否则它们将被删除):
$ usermod -a -G secondarygroupname username
Run Code Online (Sandbox Code Playgroud)
从手册页:
...
-g (primary group assigned to the users)
-G (Other groups the user belongs to)
-a (Add the user to the supplementary group(s))
...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
372407 次 |
| 最近记录: |