Skip to content

Add chown (set user, set user:group) and chgrp (set group) commands #12660

Open

Description

@mlwege

Add chown (set user, set user:group) and chgrp (set group) commands, please.

Windows has this capability, as demonstrated by SFU, Cygwin, MSYS2.

Example:

Group owner of a file can be changed with this API:

DWORD dwResult = SetSecurityInfo(
        hFile,                       // Handle to the object
        SE_FILE_OBJECT,              // Type of object (File)
        GROUP_SECURITY_INFORMATION,  // Information type to set (Primary Group)
        NULL,                        // Owner SID (NULL = don't change)
        pSidGroup,                   // Group SID (The new group SID)
        NULL,                        // DACL (NULL = don't change)
        NULL                         // SACL (NULL = don't change)
    );

Activity

  1. oech3 commented on Jun 6, 2026

    @oech3
    Contributor

    Does not cause any issue if Windows native (non-Cygwin) binary was used on MSYS2 shell?

  2. mlwege commented on Jun 7, 2026

    @mlwege
    Author

    Does not cause any issue if Windows native (non-Cygwin) binary was used on MSYS2 shell?

    No, why? Cygwin/MSYS2 all use the SetSecurityInfo(...,GROUP_SECURITY_INFORMATION,...) API.

  3. mlwege commented on Jun 7, 2026

    @mlwege
    Author

    Old Services For UNIX also used SetSecurityInfo(...,GROUP_SECURITY_INFORMATION,...) API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions