[Samba] samba-tool cannot add or remove group members

Rowland Penny rpenny at samba.org
Tue May 30 08:22:59 UTC 2017


On Tue, 30 May 2017 10:01:35 +0200 (CEST)
Sébastien QUESSON via samba <samba at lists.samba.org> wrote:

> 
> > Do you have users in /etc/passwd ?
> I only have original debian system users
> > If so, are you trying to add one of these users to an AD group ?
> no
> 

Then I don't understand why you cannot add a user to a group with
samba-tool. The only way I can get it to fail is if I use
"DOMAIN\username" instead of just 'username'

This is the code that searches for the username:

for member in members:
    targetmember = self.search(base=self.domain_dn(), scope=ldb.SCOPE_SUBTREE,
                        expression="(|(sAMAccountName=%s)(CN=%s))" % (
        ldb.binary_encode(member), ldb.binary_encode(member)), attrs=[])

    if len(targetmember) != 1:
        raise Exception('Unable to find "%s". Operation cancelled.' % member)

All I can think of is, you have a user with 'sAMAccountName=username'
and another with 'CN=username', this could lead to 'len(targetmember)'
being 2

Rowland



More information about the samba mailing list