Override domain users primary group in samba
I have a linux (red hat) machine joined to a windows 2003 domain controller for user authentication.
The problem is that when a user connects to the linux machine either by ssh or samba the files they create have the default group of "domain users". I know this can be changed by changing their primary group on the domain controller however since we have several users, I was wondering if there is anyway to override this on the linux side with a login script or by some other automated way.
I am aware of the force group option in the smb.conf file but I would prefer to set this dynamically with a script so I can run the "net ads user info username" command and see what groups they are in and then set their primary group accordingly.
Any help would be appreciated. Thanks.