2

I have a debian server with samba. I can no longer manage users accounts. I can't add, modify or remove them.

This is Debian wheezy with samba 3.6.6. There is no ldap and the database backend is tdb. I usually managed users with smbpasswd, but it no longer works.

When I try to create a new user:

smbpasswd -a blabla
New SMB password: ****
Retype new SMB password: ****
Failed to add entry for user blabla.

Trying to remove users with pdbedit or smbpasswd isn't working also, returning the same error:

# pdbedit -L olduser
olduser:1314:OldName

# smbpasswd -x olduser
Failed to delete entry for user olduser.

I tried using tdbtool

# tdbtool /var/lib/samba/passdb.tdb check
Database integrity is OK and has 570 records.

I checked the keys length, I made a tiny perl script that checked all the output of tdbtool keys to see if one entry had different keys thant it should, but I see no mistakes there:

key 9 bytes: USER_old

I'm stuck, any hint would be appreciated, thank you.

2

Finally I got an answer in the samba mailing list:

https://lists.samba.org/archive/samba/2015-March/189740.html

This happens if samba runs in PDC mode and the user is not in /etc/passwd.

I saw the user I was trying to delete was not in passwd, so I added it, then I removed it again with smbpasswd -x and I also removed it from passwd.

Problem solved.

0

I was also unable to delete a user from samba using tdbsam as the backend. Using 'sudo pdbedit -L' showed all users in the database. I am using lubuntu 18.04, so you may have to look for the location for the passdb.tdb file.

The following steps show how to manually remove the user and alternately to re-enter the user, which I had to do because I was unable to change the user's password. In the following example, the offending user is 'xxxx'.

Open a terminal window and prepare to run a series of commands/tools as su sudo -s cd tdbdump /var/lib/samba/private/passdb.tdb > xx.txt

Use leafpad, gedit, or your favorite editor to open xx.txt and look for all entries of 'xxxx' (substitute the user in your situation). What you will be looking for is the Key() entry for all records with your user referenced. Stop Samba: service nmbd stop service smbd stop then: tdbtool #you will get a 'tdb>' prompt

Commands to use in tdbtool in preparation for deleting a user(s): check repack

From the results of the 'tdbdump' above, I found the following entries for 'xxxx', but they will usually not be next to each other: { key(13) = "RID_00000540\00" data(5) = "xxxx\00" } .. .. { key(10) = "USER_xxxx\00" }

To delete the user, in 'tdbtool', use the 'delete {key}' command like this: delete USER_xxxx delete RID_00000584\00

When completed, restart samba service smbd start service nmbd start

The user should now be removed from samba, you may also have to remove the user from linux using 'userdel'

-1

In this case I use

pdbedit -x user_name
  • 1
    Can you give some information on how that is different from what the OP tried? What does this command do and why does it work? – jornane Jul 24 '15 at 6:47
  • pdbedit is a newer alternative to smbpasswd. – George Sovetov Apr 9 '20 at 17:09

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.