← 返回命令列表

Linux command

mkgroup 命令

文本

涉及管道、覆盖或删除,执行前请先确认路径和参数。

常用示例

Write local groups to /etc/group

mkgroup -l > /etc/group

Print groups from the current domain

mkgroup -d

Print groups from a specific domain

mkgroup -d [DOMAIN]

Print local groups from another machine

mkgroup -l [MACHINE]

Exclude Windows BUILTIN groups

mkgroup -l -b

Only look up a single group

mkgroup -g [GROUPNAME]

说明

mkgroup is a Cygwin helper that prints group information in the format used by Unix `/etc/group` (name:passwd:gid:members), derived from Windows user/group databases (SAM for local accounts, Active Directory for domain accounts). Modern Cygwin reads group information directly from Windows via the `nsswitch.conf` mechanism, so a static `/etc/group` file is usually unnecessary. Generating one with mkgroup is still useful when the machine is frequently disconnected from its domain controller, when you need deterministic GIDs, or when integrating with Samba.

参数

-l, --local _machine_
Print local group accounts (of the current machine or a named one).
-L, --Local _machine_
Like -l, but prefix each groupname with the machine name.
-d, --domain _domain_
Print domain groups (current domain, or the one specified).
-c, --current
Print the current (primary) group of the user.
-S, --separator _CHAR_
Use _CHAR_ instead of '+' as domain\group separator in groupname.
-o, --id-offset _OFFSET_
Change the default offset (0x10000) added to GIDs from non-local domains.
-g, --group _GROUPNAME_
Only return information for the specified group.
-b, --no-builtin
Don't print the BUILTIN groups.
-U, --unix _GROUPLIST_
Print UNIX groups when using -l on a UNIX Samba server.
-h, --help
Display help.
-v, --version
Print version information.

FAQ

What is the mkgroup command used for?

mkgroup is a Cygwin helper that prints group information in the format used by Unix `/etc/group` (name:passwd:gid:members), derived from Windows user/group databases (SAM for local accounts, Active Directory for domain accounts). Modern Cygwin reads group information directly from Windows via the `nsswitch.conf` mechanism, so a static `/etc/group` file is usually unnecessary. Generating one with mkgroup is still useful when the machine is frequently disconnected from its domain controller, when you need deterministic GIDs, or when integrating with Samba.

How do I run a basic mkgroup example?

Run `mkgroup -l > /etc/group` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -l, --local _machine_ do in mkgroup?

Print local group accounts (of the current machine or a named one).