[prev in list] [next in list] [prev in thread] [next in thread] 

List:       samba
Subject:    Re: [Samba] Scripting the next UID/GID number to use
From:       Rowland Penny via samba <samba () lists ! samba ! org>
Date:       2018-05-30 14:53:09
Message-ID: 20180530155309.009f5050 () devstation ! samdom ! example ! com
[Download RAW message or body]

On Wed, 30 May 2018 16:19:11 +0200
Prunk Dump via samba <samba@lists.samba.org> wrote:

> #######################################
> # set primarySID corresponding to gid #
> #######################################
> 
> #get the group sid from the gid
> strsid=$(wbinfo --gid-to-sid=$userGid)
> primarygid=$(echo $strsid | cut -d "-" -f 8)
> 
> 
> # set the user primarySID
> echo "dn: CN=$userName,$userClassDN,$baseDN
> changetype: modify
> replace: primarygroupid
> primarygroupid: $primarygid" > /tmp/$userName
> 
> ldbmodify --url=$samDatabase -b $baseDN /tmp/$userName
> rm /tmp/$userName
> 

I wouldn't do the above, Windows expects every user to be a member of
'Domain Users' and if you change a users 'primarygroupid', you will
break this. If you want your Unix users to have a different Unix
primary group, then use a version of Samba >= 4.6.0 and use the
winbind 'ad' backend and set (in smb.conf):

 idmap config <DOMAIN> : unix_primary_group = yes

Give your user a gidNumber containing the ID of the required group.

Rowland

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic