In my scenario, if I change “bash” to “dash”, it clearly shows egid is not the same as gid.
1 Install Debian GNU/kFreeBSD
2 Configure LDAP
3 Add an LDAP user with primary group in LDAP to a local group
4 Change the shell of that user to “dash”
5 Log in the that user
Now, the egid is not the primary group in LDAP, but is the local group.