LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

mkgroup

Generate /etc/group from Windows group information (Cygwin)

TLDR

Write local groups to /etc/group
$ mkgroup -l > /etc/group
copy
Print groups from the current domain
$ mkgroup -d
copy
Print groups from a specific domain
$ mkgroup -d [DOMAIN]
copy
Print local groups from another machine
$ mkgroup -l [MACHINE]
copy
Exclude Windows BUILTIN groups
$ mkgroup -l -b
copy
Only look up a single group
$ mkgroup -g [GROUPNAME]
copy

SYNOPSIS

mkgroup [options] [machine | domain]

DESCRIPTION

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.

PARAMETERS

-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.

CAVEATS

Cygwin-only; has no effect on native Linux systems (use `getent group` or edit `/etc/group` directly there). Since Cygwin 1.7.34, a static `/etc/group` is optional and in most cases not recommended. Generated GIDs for non-local accounts are offset by 0x10000 by default to avoid collisions.

HISTORY

mkgroup is part of the Cygwin base-files package, alongside mkpasswd. It dates back to the early days of Cygwin when `/etc/passwd` and `/etc/group` were mandatory for POSIX compatibility on Windows. As of Cygwin 1.7.34 (2014), direct lookup via the Windows API became the default, making the tool optional.

SEE ALSO

Copied to clipboard
Kai