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 ?


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
  • 3
    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 clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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