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