I'm trying to configure a Samba share on my Dell Poweredge 860 running server 14.04 LTS. Samba came uninstalled (when I chose it), so I just need to configure it. I'm trying to connect it to my Windows machine.

My config file (listed below) seems to be valid. I don't get any errors with it. It's a modified version of something I found on a tutorial online.

        workgroup = HOME
        server string = Samba Ubuntu Server
        map to guest = Bad User
        log file = /var/log/samba/log.%m
        max log size = 50
        socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
        local master = No
        dns proxy = No
        idmap config * : backend = tdb

        comment = "A small folder to move files from/to the server. For use by server admin."
        path = /serv/samba/queue
        valid users = penguin
        read only = No
        create mask = 0777
        directory mask = 0777

That's all fine there. (I should note that I have an account named penguin, too, but I want all the users to be configured using samba-tool because penguin is the only user account that will be on it, and there will be more users than there is now).

penguin@Ubuntu-Server-1:~/serv/samba$ sudo samba-tool user add penguin
New Password:
Retype Password:
ERROR(<type 'exceptions.ValueError'>): Failed to add user 'penguin':  - unable to parse dn string
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/user.py", line 176, in run
    uid=uid, uidnumber=uid_number, gidnumber=gid_number, gecos=gecos, loginshell=login_shell)
  File "/usr/lib/python2.7/dist-packages/samba/samdb.py", line 343, in newuser
    dnsdomain = ldb.Dn(self, self.domain_dn()).canonical_str().replace("/", "")

I've tried it also with another username that's not on the system. It doesn't work.

I can't even accomplish a simple sudo samba-tool user list without errors!

ERROR(ldb): uncaught exception - ldb_search: invalid basedn '(null)'
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/__init__.py", line 175, in _run
    return self.run(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/user.py", line 271, in run

What am I doing wrong?


As far as I know the samba-tool is for Active Directory (AC) provisioning only. So if you haven't setup your Samba as AC server, samba-tool user add will not work.

You should ask yourself if you need an Active Directory Server in your Network or do you only need a simple Samba-Server only with it's own users.

I the case that you need an AC Server you should follow the guide which is provided by the samba project itself ( https://wiki.samba.org/index.php/Samba_AD_DC_HOWTO ). But be warned, this documentation does not suite to ubuntu directly and you need to understand the stuff that is depending on it (namely DNS, Kerberos, LDAP).

If you only need a simple server that has some Accounts for it's own purpose and provides access to some shared folders you should follow the guides for samba3. Samba4 is compatible with these setups to samba3 and though you need smbpasswd to create user in samba. The "General Samba Guides" of the Ubuntu Server Documentation should give you all the information you need.


Just write this instead in the terminal:

smbpasswd -a penguin

And the user you're adding needs to be added in the Ubuntu system, like a new user.

That can be done using

sudo useradd penguin


sudo adduser penguin

I'm concerned that this 'bug' may be miscategorized, because its showing up in so many different forms. I just found a bug-report going back to 2014, reporting exactly the same thing I encountered:

samba-tool user list ...fails repeatedly. But then, so do all the other commands involving samba-tool, except: samba-tool -V (which reports the version number correctly)

Here's the tip (or I should say 'a tip') of the iceberg:

acel:/mnt/nsd# samba-tool user list Unknown parameter encountered: "acl xattr update mtime" Ignoring unknown parameter "acl xattr update mtime" ERROR(ldb): uncaught exception - ldb_search: invalid basedn '(null)' File "/usr/lib/python2.7/dist-packages/samba/netcmd/init.py", line 175, in _run return self.run(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/samba/netcmd/user.py", line 292, in run attrs=["samaccountname"]) acel:/mnt/nsd# samba-tool user list ERROR(ldb): uncaught exception - ldb_search: invalid basedn '(null)'
File "/usr/lib/python2.7/dist-packages/samba/netcmd/init.py", line 175, in _run return self.run(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/samba/netcmd/user.py", line 292, in run attrs=["samaccountname"]) acel:/mnt/nsd# which ldb ldb: Command not found.

The problem? After encountering this on one system, I checked samba-tool on three other independent systems (all Ubuntu), and samba-tool was broken on them too. I've found a few isolated references to similar manifestations in bug reports, some going back 4-6 years. I've also found several reports of the bug having been 'fixed'...(this variation is not fixed).

All I wanted to do was make sure the samba user/password database was clean, by removing an orphan, and I couldn't. Clearly, if samba-tool isn't working (and in my case, I have 4 servers running Samba, and its not working on any of them) it needs to be fixed.

The only other clue I can offer: one reference I read mentioned the synchronization of passwords feature in Samba as a possible cause. I encountered this when samba encountered an orphan samba userid, which I had created by renaming its original twin in the /etc/passwd file. I was just trying to use samba-tool to remove the orphan. But I suppose its possible that when samba tried to synchronize its user database with the system, and found the original user missing, some damage was done.(?)

This isn't an answer. Its just a suggestion that the bug is probably still out there, and the best place to start checking to see if you're affected, is to run samba-tool simple functions, to see if its working properly:

'samba-tool user list' or 'samba-tool dbcheck' for example.

All of mine (1 V4.7 & 3 V4.3) are broken. (Hope this helps.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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