Web lists-archives.com

Re: [Samba] Scripting the next UID/GID number to use




On Wed, 30 May 2018 16:19:11 +0200
Prunk Dump via samba <samba@xxxxxxxxxxxxxxx> 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