命令介紹
命令:groupadd 添加羣組
用法:groupadd [options] GROUP groupadd 羣組
命令選項
[root@fp-21 ~]# groupadd --help
-f, --force # 如果組已經存在,則成功退出,如果GID已被使用,則取消-G
-g, --gid GID # 指定羣組GID
-h, --help # 幫助文檔
-K, --key KEY=VALUE # 覆蓋/etc/login.defs默認值
-o, --non-unique # 允許創建具有重複(非唯一)GID的組
-p, --password PASSWORD # 爲新組使用此加密密碼
-r, --system # 創建系統帳戶
命令實例
# 如果組已經存在,則成功退出,如果GID已被使用,則取消-G
[root@fp-21 ~]# grep "tom" /etc/passwd
tom:x:1000:1000::/home/tom:/bin/bash
[root@fp-21 ~]# groupadd -f tom
# 指定羣組GID
[root@fp-21 ~]# groupadd -g 1222 test11
[root@fp-21 ~]# tail -1 /etc/group
test11:x:1222: