usermod --help
-g, --gid GROUP force use GROUP as new primary group
-G, --groups GROUPS new list of supplementary GROUPS
-a, --append append the user to the supplemental GROUPS
mentioned by the -G option without removing
說明:再已有用戶想要增加用戶組時,root用戶給risk用戶增加oinstall組,risk和oinstall組均已存在的情況
參數:-g
usermod -g oinstall risk
這種情況下會直接修改risk的用戶組,覆蓋原來的組
參數: -a -G
usermod -a -G oinstall risk
這種情況下會追加修改risk的用戶組,新增oinstall用為risk的從屬用戶組,不覆蓋原有的risk的用戶組。
