You can use the object class posixGroup in LDAP.
This object class allows you to create groups that correspond to Unix groups on each client computer.
You can then add users to these groups by using the memberUid attribute, which specifies the user's UID. On client machines, you can configure the nss_base_group filter in the /etc/ldap.conf file to retrieve posixGroup objects from the LDAP server.
This allows the client computer to use the group membership information from the LDAP server to determine users' Unix group membership when they log on.
Another thing that I might suggest is to use the pam_ldap module to authenticate users and set their group membership based on the LDAP server settings when they log in.
Edit 1 (check comments for refference): Yes, you can use the posixGroup object class and the nss_base_group filter to achieve the objective of having different Unix group memberships for different users on different client machines.
To do this, you can create posixGroup objects in the LDAP server for each group that you want to use on the client machines. You can then use the memberUid attribute to specify the UIDs of the users who are members of each group.
On the client machines, you can configure the nss_base_group filter in the /etc/ldap.conf file to retrieve the posixGroup objects from the LDAP server. For example, you can add the following line to the /etc/ldap.conf file on the client machine:
nss_base_group ou=Groups,dc=example,dc=com?one
This will cause the client machine to search the Groups OU in the LDAP server for posixGroup objects and use the information from those objects to set the Unix group membership for the users when they login.
As for using the pam_ldap module to authenticate users and set their group membership based on the LDAP server settings when they log in, it is possible to do this. The pam_ldap module can be configured to use the LDAP server to authenticate users and set their group membership when they log in to the client machine.
To use the pam_ldap module, you can add the following line to the /etc/pam.d/common-auth file on the client machine:
auth sufficient pam_ldap.so
This will cause the pam_ldap module to authenticate the users using the LDAP server and set their group membership based on the information in the LDAP server.