Linux-usermod:增加已建立用戶的用戶組


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的用戶組。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM