Server Fault is a question and answer site for system and network administrators. 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

While trying to setup samba on an NFS server I deleted (don't ask) the /var/lib/samba/ contents and now when I try to start samba, this messages appears :

[2012/07/06 08:19:07.528973,  0] passdb/secrets.c:73(secrets_init)
  Failed to open /var/lib/samba/private/secrets.tdb
[2012/07/06 08:19:07.689735,  0] passdb/secrets.c:73(secrets_init)
  Failed to open /var/lib/samba/private/secrets.tdb
[2012/07/06 08:19:07.690078,  0] smbd/server.c:1240(main)
  ERROR: smbd can not open secrets.tdb

So how do I recreate the secrets.tdb file and the rest of the needed files if any ?

share|improve this question
up vote 7 down vote accepted

Use smbpasswd which will create the file if it doesn't exist when you add a new user

ls -l /var/lib/samba/private/secrets.tdb
ls: cannot access /var/lib/samba/private/secrets.tdb: No such file or directory

smbbpasswd iain
New SMB password:
Retype new SMB password:

ls -l /var/lib/samba/private/secrets.tdb
-rw-------. 1 root root 45056 Jul  6 07:54 /var/lib/samba/private/secrets.tdb
share|improve this answer
This only works is the directory /var/lib/samba/private exists. If it doesn't just make it via mkdir then execute the smbpasswd -a user – Karl Morrison Jun 24 '14 at 17:40

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.