# samba - smbpasswd problem

## BrianNJ

i'm trying to add some functionality to my gentoo home router.   i can use cups and whatnot fine with my pc's using gentoo, but when i boot into windows, i haven't gotten it to work just right yet (trying to use the howto on samba, cups, and windows).

i keep getting the following error when i try to add a user to the samba database.  i can't put my finger on what's going on. 

```

CRM114 samba # smbpasswd -a printeruser

New SMB password:

Retype new SMB password:

Failed to open group mapping database

failed to initialize group mapping

Failed to open account policy database

Failed to open account policy database

Failed to open account policy database

Added user printeruser.

```

i can't make heads or tails of it.

i've also noticed whtn i try try stop or restart samba, this shows up (but doesn't really stop anything)

```

 * samba -> stop: smbd ...           [ !! ]

```

----------

## KermitTheFragger

Can you post some log files ? Like when you try to shutdown samba, or try to add a user.

Also try running "smbpasswd -D 10 -a printeruser" (or -D 5) this sets it to high debug and post the output please.

----------

## BrianNJ

i noticed the following error in the smdb log file

[2004/10/07 20:59:04, 0] lib/messages.c:message_init(106)

  ERROR: Failed to initialise messages database

ah... ok when i added the -D 10 i noticed the following...

tdb(unnamed): tdb_open_ex: could not open file /usr/local/samba/var/lock/account_policy.tdb: No such file or directory

how can i get this in there?  i just re-emerged samba?  thanks for any advice.

also, i've added a directory to be shared in samba, and it isn't even viewable on my network.  it should be, but it isn't.

what's the easiest way to totally remove samba and all the current config files?   i'm hopeinthis would help.h

----------

## mglauche

Which authentication mechanism are you using ? I think the default in the smb.conf looks like this:

passdb backend = tdbsam

samba build from the gentoo ebuild should never write something to /usr/local .. which version of samba do you use ? IIRC the default location for the *.tdb files should be /var/cache/samba.

----------

## BrianNJ

i dont' have access to the box at the moment, but it was a gentoo ebuild, i'm thinking 3.06.  i had sync'd earlier in the week, and reemerged samba, so it's a very recent version in there.

i had tried with and without the passwd backend statement in my config file, and same results.

i don't mind blowing samba away and reemerging if it would help.  the more i think about it, i should do that...   clean the samba package, locate any samba directories and purge them.

----------

## drawsmcgraw

I don't know what the status of this post is, seeing as it's a bit dated. But I'm having exactly the same problem. Same output when -D 10 is used, same  thing with the [!!] when stopping Samba. I'm using version 3.0.8. Has any progress been made on this?

----------

## crys0000

I have the same problem too, this is the output of:

```
smbpasswd -D 10 -a root
```

:

```
Netbios name list:-

my_netbios_names[0]="GENTOO"

Trying to load: tdbsam

Attempting to register passdb backend smbpasswd

Successfully added passdb backend 'smbpasswd'

Attempting to register passdb backend tdbsam

Successfully added passdb backend 'tdbsam'

Attempting to register passdb backend guest

Successfully added passdb backend 'guest'

Attempting to find an passdb backend to match tdbsam (tdbsam)

Found pdb backend tdbsam

pdb backend tdbsam has a valid init

Attempting to find an passdb backend to match guest (guest)

Found pdb backend guest

pdb backend guest has a valid init

New SMB password:

Retype new SMB password:

pdb_set_username: setting username root, was

pdb_set_domain: setting domain GENTOO, was

pdb_set_nt_username: setting nt username , was

pdb_set_full_name: setting full name root, was

Home server: gentoo

pdb_set_homedir: setting home dir \\gentoo\root, was

pdb_set_dir_drive: setting dir drive , was NULL

pdb_set_logon_script: setting logon script , was

Home server: gentoo

pdb_set_profile_path: setting profile path \\gentoo\root\profile, was

pdb_set_workstations: setting workstations , was

tdb(unnamed): tdb_open_ex: could not open file /usr/local/samba/var/lock/account_policy.tdb: No such file or directory

Failed to open account policy database

pdb_set_user_sid: setting user sid S-1-5-21-2734963502-2857973443-1566445612-1000

pdb_set_user_sid_from_rid:

        setting user sid S-1-5-21-2734963502-2857973443-1566445612-1000 from rid 1000

pdb_set_group_sid: setting group sid S-1-5-21-2734963502-2857973443-1566445612-1001

pdb_set_group_sid_from_rid:

        setting group sid S-1-5-21-2734963502-2857973443-1566445612-1001 from rid 1001

tdb(unnamed): tdb_open_ex: could not open file /usr/local/samba/var/lock/account_policy.tdb: No such file or directory

Failed to open account policy database

pdb_set_username: setting username root, was

pdb_set_domain: setting domain GENTOO, was

pdb_set_nt_username: setting nt username , was

pdb_set_full_name: setting full name root, was

Home server: gentoo

pdb_set_homedir: setting home dir \\gentoo\root, was

pdb_set_dir_drive: setting dir drive , was NULL

pdb_set_logon_script: setting logon script , was

Home server: gentoo

pdb_set_profile_path: setting profile path \\gentoo\root\profile, was

pdb_set_workstations: setting workstations , was

tdb(unnamed): tdb_open_ex: could not open file /usr/local/samba/var/lock/account_policy.tdb: No such file or directory

Failed to open account policy database

pdb_set_user_sid: setting user sid S-1-5-21-2734963502-2857973443-1566445612-1000

pdb_set_user_sid_from_rid:

        setting user sid S-1-5-21-2734963502-2857973443-1566445612-1000 from rid 1000

pdb_set_group_sid: setting group sid S-1-5-21-2734963502-2857973443-1566445612-1001

pdb_set_group_sid_from_rid:

        setting group sid S-1-5-21-2734963502-2857973443-1566445612-1001 from rid 1001

tdb(unnamed): tdb_open_ex: could not open file /usr/local/samba/var/lock/account_policy.tdb: No such file or directory

Failed to open account policy database

tdb(unnamed): tdb_open_ex: could not open file /usr/local/samba/var/lock/account_policy.tdb: No such file or directory

Failed to open account policy database

tdb(unnamed): tdb_open_ex: could not open file /usr/local/samba/var/lock/account_policy.tdb: No such file or directory

Failed to open account policy database

tdb(unnamed): tdb_open_ex: could not open file /usr/local/samba/var/lock/account_policy.tdb: No such file or directory

Failed to open account policy database

Storing account root with RID 1000
```

Where is the problem? 

Thanks

----------

## crys0000

Problem solved, I just had to create the /usr/local/samba/var/lock directory.

 :Cool: 

----------

## herda0505

I recieve the same error and I just added the /usr/local/samba/var/lock directory and it didn't solve the problem. Anyone else see this error?

----------

## herda0505

Ok, what smbpasswd is trying to do is open the file pointed at in the error, in my case the error was (I've only grabbed the last 5 lines of the smbpasswd -D 10 for brevity's sake):

```

startsmbfilepwent_internal: opening file /etc/samba/private/smbpasswd

startsmbfilepwent_internal: file /etc/samba/private/smbpasswd did not exist. Couldn't create new one. Error was: No such file or directorystartsmbfilepwent_internal: too many race conditions creating file /etc/samba/private/smbpasswd

add_smbfilepwd_entry: unable to open file.

Failed to add entry for user root.

Failed to modify password entry for user root

```

and the file it was looking for was:

```

/etc/samba/private/smbpasswd

```

So I just created the /etc/samba/private directory and touched the smbpasswd file:

```

localhost ~ # mkdir /etc/samba/private

localhost ~ # touch /etc/samba/private/smbpasswd

```

Voila

----------

