initialGroupConfig=WITH_INITIAL_OWNER: Either
?initialGroupConfig=WITH_INITIAL_OWNER or empty. Any empty
group can only be created by organization admins.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-29 UTC."],[[["\u003cp\u003ePOSIX groups are deprecated and will no longer be available for creation after September 26, 2024.\u003c/p\u003e\n"],["\u003cp\u003eThis document outlines the steps to create a POSIX group from an existing or new Google group using gcloud, REST, or Python.\u003c/p\u003e\n"],["\u003cp\u003eYou must use the beta version of the Cloud Identity Groups API to create and delete POSIX groups and have Cloud Identity setup before doing so.\u003c/p\u003e\n"],["\u003cp\u003eDeleting a POSIX group only removes the POSIX information from a Google group, but does not delete the underlying Google group.\u003c/p\u003e\n"],["\u003cp\u003eThe document also covers how to remove POSIX group information from a google group, using gcloud, REST, and Python.\u003c/p\u003e\n"]]],[],null,["# Creating and deleting POSIX groups\n==================================\n\n| **Caution:** POSIX groups are [deprecated](/identity/docs/deprecations). As of September 26, 2024, you can no longer create new POSIX groups. For more information, see [POSIX groups deprecation](/identity/docs/deprecations/posix-groups).\n\nThis document explains how to create and delete a POSIX group.\n|\n| **Preview**\n|\n|\n| This product is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n| **Note:** You must use the beta version of the Cloud Identity Groups API to create and delete POSIX groups.\n\nBefore you begin\n----------------\n\n| **Note:** Before you use any of the Cloud Identity APIs, you must set up Cloud Identity. See [Setting up Cloud Identity](/identity/docs/setup) for instructions.\n\nPerform the following tasks before proceeding with the information on this page:\n\n- Read the [Groups API overview](/identity/docs/groups).\n\n- [Set up the Groups API](/identity/docs/how-to/setup).\n\nCreating a POSIX group\n----------------------\n\nYou can create a POSIX group from an existing Google group, or by creating a new\nGoogle group and adding POSIX information.\n\n### Creating a POSIX group from an existing Google group\n\nThe following examples show how to create a POSIX group from an existing\nGoogle group: \n\n### gcloud\n\n\nUse the\n[`gcloud beta identity groups update` command](/sdk/gcloud/reference/beta/identity/groups/update)\nto update an existing Google group to a POSIX group: \n\n```\ngcloud beta identity groups update EMAIL \\\n --add-posix-group=gid=GROUP_ID,name=POSIX_NAME\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eEMAIL\u003c/var\u003e: the email address of the group to update\n- \u003cvar translate=\"no\"\u003eGROUP_ID\u003c/var\u003e: the group ID (GID) you want to assign to the POSIX group\n- \u003cvar translate=\"no\"\u003ePOSIX_NAME\u003c/var\u003e: the name you want to assign to the POSIX group\n\n### REST\n\nTo update a Google Group to a POSIX group, call the\n[`groups.patch()` method](/identity/docs/reference/rest/v1beta1/groups/patch)\nwith the POSIX groups field specified. \n\n```\nPATCH 'https://cloudidentity.googleapis.com/v1beta1/groups/GROUP_RESOURCE_NAME?updateMask=posix_group\n\n{\n \"posixGroups\": [\n {\n \"name\": \"POSIX_NAME\",\n \"gid\": GROUP_ID\n }\n ]\n}\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eGROUP_RESOURCE_NAME\u003c/var\u003e: the resource name of the Google group. To find a group's resource name, run the [`gcloud identity groups describe` command](/sdk/gcloud/reference/identity/groups/describe)\n- \u003cvar translate=\"no\"\u003ePOSIX_NAME\u003c/var\u003e: the name you want to assign to the POSIX group\n- \u003cvar translate=\"no\"\u003eGROUP_ID\u003c/var\u003e: the group ID (GID) you want to assign to the POSIX group\n\n### Python\n\nThe following example shows a helper function to update a Google Group to a\nPOSIX group using the Python client library: \n\n def add_posix_group_data_to_group(service, group_name, posix_name, posix_gid):\n group = {\n \"posix_groups\": [\n {\n \"name\": posix_name,\n \"gid\": posix_gid,\n }\n ]\n }\n try:\n request = service.groups().patch(name=group_name, body=group)\n request.uri = request.uri + '&updateMask=posix_groups'\n response = request.execute()\n print(response)\n except Exception as e:\n print(e)\n\n### Creating a POSIX group from a new Google group\n\nThe following examples show how to create a POSIX group from a new Google group: \n\n### gcloud\n\nUse the\n[`gcloud beta identity groups create` command](/sdk/gcloud/reference/beta/identity/groups/create)\nto create a POSIX group: \n\n```\ngcloud beta identity groups create EMAIL \\\n --organization=ORGANIZATION_ID \\\n --labels=cloudidentity.googleapis.com/groups.discussion_forum \\\n --posix-group=gid=GROUP_ID,name=POSIX_NAME\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eEMAIL\u003c/var\u003e: the email address of the group to be created\n- \u003cvar translate=\"no\"\u003eORGANIZATION_ID\u003c/var\u003e: the organization the group belongs to. Either an ID (\"123456789\") or the associated domain (\"example.com\").\n- \u003cvar translate=\"no\"\u003eGROUP_ID\u003c/var\u003e: the group ID (GID) you set for the group\n- \u003cvar translate=\"no\"\u003ePOSIX_NAME\u003c/var\u003e: the name you set for the group\n\n### REST\n\nTo create a group, call the\n[`groups.create()` method](/identity/docs/reference/rest/v1beta1/groups/create)\nwith the email address, organization ID, POSIX groups, and labels for the new\ngroup. \n\n```\nPOST 'https://cloudidentity.googleapis.com/v1beta1/groups?initialGroupConfig=WITH_INITIAL_OWNER\n\n{\n\"parent\": \"customers/CUSTOMER_ID\",\n\"groupKey\": {\"id\": \"EMAIL\"},\n\"labels\": {\"cloudidentity.googleapis.com/groups.discussion_forum\": \"\"},\n\"posixGroups\": [\n {\n \"name\": \"POSIX_NAME\",\n \"gid\": GROUP_ID,\n }\n]\n}\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003einitialGroupConfig=WITH_INITIAL_OWNER\u003c/var\u003e: Either `?initialGroupConfig=WITH_INITIAL_OWNER` or empty. Any empty group can only be created by organization admins.\n- \u003cvar translate=\"no\"\u003eCUSTOMER_ID\u003c/var\u003e: the customer ID for your organization. To find the customer ID run the [`gcloud organizations list` command](/sdk/gcloud/reference/organizations/list)\n- \u003cvar translate=\"no\"\u003eEMAIL\u003c/var\u003e: the email address of the group to be created\n- \u003cvar translate=\"no\"\u003ePOSIX_NAME\u003c/var\u003e: the name you want to assign to the POSIX group\n- \u003cvar translate=\"no\"\u003eGROUP_ID\u003c/var\u003e: the group ID (GID) you want to assign to the POSIX group\n\n### Python\n\nThe following example shows a helper function to create a POSIX group using\nthe Python client library: \n\n def create_posix_group(customer_id, email, query, posix_name, posix_gid):\n service = build_service()\n groupDef = {\n \"parent\": \"customerId/{}\".format(customer_id),\n \"groupKey\": {\"id\": email},\n \"labels\": {\"cloudidentity.googleapis.com/groups.discussion_forum\": \"\"},\n \"posixGroups\": [\n {\n \"name\": posix_name,\n \"gid\": posix_gid,\n }\n ]\n }\n request = service.groups().create(body=groupDef)\n request.uri += \"&initialGroupConfig=WITH_INITIAL_OWNER\"\n response = request.execute()\n return response\n\nDeleting a POSIX group\n----------------------\n\nThe following examples show how to remove POSIX information from a Google\ngroup.\n**Note:** When you remove POSIX information from a Google group, the Google group isn't deleted. \n\n### gcloud\n\nUse the\n[`gcloud beta identity groups update` command](/sdk/gcloud/reference/beta/identity/groups/update)\nand specify the `--remove-posix-groups` flag with the\n\u003cvar translate=\"no\"\u003eGROUP_ID\u003c/var\u003e or \u003cvar translate=\"no\"\u003ePOSIX_NAME\u003c/var\u003e value: \n\n```\ngcloud beta identity groups update \\\n EMAIL \\\n --remove-posix-groups=GROUP_ID_or_POSIX_NAME\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eEMAIL\u003c/var\u003e: the email address of the group to be deleted\n- \u003cvar translate=\"no\"\u003eGROUP_ID_or_POSIX_NAME\u003c/var\u003e: the group ID or POSIX group name of the group to be deleted\n\n### REST\n\nTo update a Google Group to a POSIX group, call the\n[`groups.patch()` method](/identity/docs/reference/rest/tt1/groups/patch) with\nthe POSIX groups field specified. \n\n```\nPATCH 'https://cloudidentity.googleapis.com/v1beta1/groups/GROUP_RESOURCE_NAME?updateMask=posix_group\n\n{\n \"posixGroups\": []\n}\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eGROUP_RESOURCE_NAME\u003c/var\u003e: the resource name of the Google group. To find a group's resource name, run the [`gcloud identity groups describe` command](/sdk/gcloud/reference/identity/groups/describe)\n\n### Python\n\nThe following example shows a helper function to update a Google Group to a\nPOSIX group using the Python client library: \n\n def remove_posix_data_from_group(service, group_name, posix_name, posix_gid):\n group = {\n \"posix_groups\": []\n }\n try:\n request = service.groups().patch(name=group_name, body=group)\n request.uri = request.uri + '&updateMask=posix_groups'\n response = request.execute()\n print(response)\n except Exception as e:\n print(e)\n\nWhat's next\n-----------\n\nAfter the POSIX group exists, you can retrieve it and list its memberships.\nFor more information, see\n[Retrieving and listing POSIX groups](/identity/docs/how-to/retrieve-list-posix-groups)."]]