Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running Lucid. I have setup openldap and samba a while ago, this problem existed since then and I still don't know how to fix it. I use webmin's LDAP client to create a "testuser" account, and get following error:

failed to save user : /usr/bin/pdbedit failed :
pdb_set_user_sid_from_string: -21020 isn't a valid SID!
init_sam_from_ldap: no sambaSID or sambaSID attribute found for this user atest
ldapsam_getsampwnam: init_sam_from_ldap failed for user 'testuser'!
ldapsam_add_sam_account: User 'testuser' already in the base, with samba attributes 

I think SAMBA and OpenLDAP integration is not working corectly. Even with above error, "testuser" account is created. I can login with this account via SSH, but I can't login to Samba server on the same server. The last line of the error indicates some configuration is overlapped, but I don't know where and how to fix it.


Here is SAMBA setting section in LDAP users and groups configuration page of Webmin:

Samba setting


Samba version 3.4.7 LDAP protocol version 3

Update 2:

The error disappeared after I copied and pasted the sambaID for the samba server from "LDAP client -> LDAP Browser". So the input for "Domain SID for Samba3" looks something like:


Now samba user is created, but I still can't login to the samba server. The problem now is with password sync.

share|improve this question
up vote 1 down vote accepted

I tried following command to add a testuser account with group ID of 10000:

sudo smbldap-useradd -a -P testuser

got error:

Can't call method "get_value" on an undefined value at /usr/sbin/smbldap-useradd line 231, <DATA> line 466.

Looking at the script /usr/sbin/smbldap-useradd I found that I have to specify a group ID for this new user. So next command:

sudo smbldap-useradd -a -P -g 10000 testuser

Where 10000 is the group id of intended LDAP group. I got this error:

Error: SID not set for unix group 10000
check if your unix group is mapped to an NT group

I went a head and sync the usergroup by going to "Samba Windows File Sharing" module of webmin, and added a samba group which also connected to the Unix/LDAP group that has id of 10000. A screenshot in case someone is still confused: Setting for Samba group

And the problem solved :-)

I also went ahead and setup users and group sync in "Samba Windows File Sharing" to prevent future manual handling of the SAMBA groups and users.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.