標籤:des os io 使用 ar for 檔案 2014 art
GROUPADD(8) 系統管理命令 GROUPADD(8)
名稱
groupadd - 建立一個新組
大綱
groupadd [選項] group
描述
The groupadd command creates a new group account using the values specified on the command line plus the default values from the system. The
new group will be entered into the system files as needed.
選項
groupadd 命令可以接受的選項有:
-f, --force
This option causes the command to simply exit with success status if the specified group already exists. When used with -g, and the
specified GID already exists, another (unique) GID is chosen (i.e. -g is turned off).
#############
-g, --gidGID
The numerical value of the group‘s ID. This value must be unique, unless the -o option is used. The value must be non-negative. The
default is to use the smallest ID value greater than or equal to GID_MIN and greater than every other group.
See also the -r option and the GID_MAX description.
-o, --non-unique
此選項允許添加一個使用非唯一 GID 的組。
-r, --system
建立一個系統組。
The numeric identifiers of new system groups are chosen in the SYS_GID_MIN-SYS_GID_MAX range, defined in login.defs, instead of
GID_MIN-GID_MAX.
###############
-K, --keyKEY=VALUE
Overrides /etc/login.defs defaults (GID_MIN, GID_MAX and others). Multiple -K options can be specified.
樣本:-K GID_MIN=100-K GID_MAX=499
注意:-K GID_MIN=10,GID_MAX=499 尚不能工作。
-p, --passwordPASSWORD
加密了的密碼,就像 crypt(3) 的傳回值。預設為禁用密碼。
-R, --rootCHROOT_DIR
Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory.
-h, --help
現實協助資訊並退出。
設定檔
在 /etc/login.defs 中有如下組態變數,可以用來更改此工具的行為:
GID_MAX (number), GID_MIN (number)
useradd,groupadd 或 newusers 建立的常規組的組 ID 的範圍。
GID_MIN 和 GID_MAX 的預設值分別是 1000 和 60000。
MAX_MEMBERS_PER_GROUP (number)
每個組條目的最大成員數。達到最大值時,在 /etc/group 開始一個新條目(行)(使用同樣的名稱,同樣的密碼,同樣的 GID)。
預設值是 0,意味著組中的成員數沒有限制。
此功能(分割組)允許限制組檔案中的行長度。這對於確保 NIS 組的行比長於 1024 字元。
如果要強制這個限制,可以使用 25。
注意:分割組可能不受所有工具的支援(甚至在 Shadow 工具集中)。您不應該使用這個變數,除非真的需要。
SYS_GID_MAX (number), SYS_GID_MIN (number)
useradd、groupadd 或 newusers 建立的系統組的組 ID 的範圍。
SYS_GID_MIN 和 SYS_GID_MAX 的預設值分別是 101 和 GID_MIN-1。
檔案
/etc/group
組賬戶資訊。
/etc/gshadow
安全性群組賬戶資訊。
/etc/login.defs
Shadow 密碼套件配置。
CAVEATS
It is usually recommended to only use groupnames that begin with a lower case letter or an underscore, followed by lower case letters,
digits, underscores, or dashes. They can end with a dollar sign. In regular expression terms: [a-z_][a-z0-9_-]*[$]?
On Debian, the only constraints are that groupnames must neither start with a dash (‘-‘) nor plus (‘+‘) nor tilde (‘~‘) nor contain a colon
(‘:‘), a comma (‘,‘), or a whitespace (space:‘ ‘, end of line: ‘\n‘, tabulation: ‘\t‘, etc.).
組名最長為 32 個字元。
You may not add a NIS or LDAP group. This must be performed on the corresponding server.
If the groupname already exists in an external group database such as NIS or LDAP, groupadd will deny the group creation request.
退出值
groupadd 可能以如下值退出:
0
成功
2
無效的命令文法
3
給了選項一個無效的參數
4
GID 不唯一 (沒有使用 -o)
9
組名不唯一
10
無法更新群組檔案
參見
chfn(1), chsh(1), passwd(1), gpasswd(8), groupdel(8), groupmod(8), login.defs(5), useradd(8), userdel(8), usermod(8).
shadow-utils 4.1.5.1 2014-02-17 GROUPADD(8)
Linux -- groupadd