[Samba] Samba 4 problems

Rowland Penny rowlandpenny at googlemail.com
Sun Dec 21 14:54:47 MST 2014

On 21/12/14 20:05, Brett Wynkoop wrote:
> On Fri, 19 Dec 2014 11:35:58 +0100
> steve <steve at steve-ss.com> wrote:
>> On 19/12/14 10:06, Brett Wynkoop wrote:
>>> So is there a way to force a particular UID, meaning can I create
>>> account smith with UID 553 in a Samba DC?
>> Yes. Simply add:
>> uidNumber: 553
>> to the user's entry. That gets it into the database. You can use sssd
>> or winbind to get it out.
>> HTH
> Steve,
> Thanks for the above, but I found nothing in the pdbedit man page that
> I recognize as a way to "Simply add".  A pointer would be appreciated.
> -Brett

Hi, its not quite as easy as that, you need to use ldbmodify (or 
similar) to add the ID number.

First create an ldif i.e. /tmp/user.ldif

dn: CN=John Doe,CN=Users,DC=example,DC=com
changetype: modify
add: uidNumber
uidNumber: IDNUMBER

Replace 'John Doe' with your users name
Replace 'CN=Users' with where your users are stored in AD, if they are 
not stored in the default container
Replace 'DC=example,DC=com' with your rootdse
Replace 'IDNUMBER' with whatever number (it must be a number) you want 
to give the user.

Now add the info to the users AD object:

ldbmodify --url=/var/lib/samba/private/sam.ldb /tmp/user.ldif

The above relies on 'sam.ldb' being at the given path.

Your user on Unix should now have the given ID number.

Only problem, you have to remember what ID numbers you have used.


More information about the samba mailing list