[Samba] Get last uidNumber

basti mailinglist at unix-solution.de
Tue Nov 3 18:46:32 UTC 2020

Am 03.11.20 um 17:46 schrieb Rowland penny via samba:
> On 03/11/2020 16:24, basti via samba wrote:
>> Hello,
>> is there a way to get the last uidNumber from ldap.
>> I can do a ldapsearch like:
>> ldapsearch -h samdom.example.com -D "administrator at samdom.example.com"
>> -w "changeit"  -b "DC=samdom,DC=example,DC=com" -x -LLL
>> "(uidNumber=*)" uidNumber | grep -Po "(?<=uidNumber: )([0-9]{4})" |
>> sort | tail -n1
>> But there is no guarantee that the last returned numer is the last
>> uidNumber in LDAP.
>> Is there a limit set by samba how many lines are returned by a query?
>> Is there a attribute where the last number is stored?
>> Best Regards
> OK, I never told told you this, so keep it to your self 😂
> How do you think the Unix attributes tabs worked in ADUC ?
> You had to to install IDMU with ADUC which installed an ldif that Samba
> calls ypServ30.ldif. Amongst the objects that are installed in AD is one
> with the DN:
> CN=<workgroup>,CN=ypservers,CN=ypServ30,CN=RpcServices,CN=System,DC=X
> Where <workgroup> is your Netbios domain name (aka workgroup) and DC=X
> is the ldap default naming context e.g. DC=samdom,DC=example,DC=com
> Now what isn't there are the two attributes you need to store the next
> uidNumber & gidNumber:
> msSFU30MaxUidNumber
> msSFU30MaxGidNumber
> Just store the last *idNumber + 1 in each and then write a script around
> 'samba-tool user add' which obtains the required ID number, uses this
> and then updates it upon successful user creation.
> Rowland
IDMU seems not in server 2012R2.
the ypServ30 LDAP tree exists.

I have no idea in which attribute i should store my UID.

objectClass: top
objectClass: attributeSchema
cn: msSFU-30-Max-Uid-Number
instanceType: 4
whenCreated: 20170217130152.0Z
whenChanged: 20170217130152.0Z
uSNCreated: 808
attributeID: 1.2.840.113556.
isSingleValued: TRUE
uSNChanged: 808
showInAdvancedViewOnly: TRUE
adminDisplayName: msSFU-30-Max-Uid-Number
adminDescription: msSFU-30-Max-Uid-Number
oMSyntax: 2
searchFlags: 1
lDAPDisplayName: msSFU30MaxUidNumber
name: msSFU-30-Max-Uid-Number
objectGUID:: 13njAfdDGU25KDiuNCVkCg==
systemOnly: FALSE

More information about the samba mailing list