LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Samba smbpasswd file missing (https://www.linuxquestions.org/questions/linux-newbie-8/samba-smbpasswd-file-missing-750367/)

Amy84 08-26-2009 07:16 AM

Samba smbpasswd file missing
 
Hey all,

For backing up a server I wanted to set up my Samba. Having done this before I started with changing my smb.conf
After doing so I didn't look any further and stated this command right away:

smbpasswd -a user

This gave me a bunch of errors (which unfortunately I'm not able to reproduce), but at the end it stated my user was added. Of course I didn't thick so and wanted to checkout my smbpasswd file. I was very surprised to find out there was no smbpasswd file there! (/etc/samba/smbpasswd)

So I search google. There was someone saying you can just make your own with the following command:

touch smbpasswd

I have absolutely no idea what that does, but it tried it anyway. It did create smbpasswd. I tried to add my user again. It came up like this:

[root@dowiki01 samba]# smbpasswd -a twadmin
New SMB password:
Retype new SMB password:

Which looks like there is something already there. Looking in my newly created file it was empty.

Now I ended up having two questions:

1.) What did I actually create using touch?
2.) How can solve my smbpasswd issue?

(I using CentOS 5.3 btw)

Thanks in advance.

jschiwal 08-26-2009 07:37 AM

Check your smb.conf file for what your password backend is. (passdb backend =). If it isn't listed, the smbpasswd file is the default.

The touch command will update the timestamp on an existing file, and create a new file if it doesn't exist. You might try restarting samba.
Also make sure that the user you are trying to add exists in /etc/passwd. Otherwise smbpasswd will fail and not add the new user.

Amy84 08-26-2009 08:03 AM

Thanks for replying.

In my conf:
passdb backend = tdbsam

I checked my user in /etc/passwd and it does existed. Then I restarted my smb. Didn't work though.

centosboy 08-26-2009 08:12 AM

Quote:

Originally Posted by Amy84 (Post 3658179)
Thanks for replying.

In my conf:
passdb backend = tdbsam

I checked my user in /etc/passwd and it does existed. Then I restarted my smb. Didn't work though.

in this case, the smbpasswd file should be
Code:

/etc/samba/passdb.tdb


Code:

file passdb.tdb
passdb.tdb: TDB database version 6, little-endian hash size 131 bytes

because of that format, you cannot just create it using touch and expect it to work.

taken from
Code:

/usr/share/doc/samba-3.0.28/htmldocs/Samba3-HOWTO/passdb.html

In a strict sense, there are three supported account storage and access systems. One of these is considered
obsolete (smbpasswd). It is recommended to use the <code class="literal">tdbsam</code> method for all simple systems. Use
<code class="literal">ldapsam</code> for larger and more complex networks.


check content of this passdb file

Code:

strings passdb.tdb

jschiwal 08-26-2009 08:18 AM

tdbsam is a different password backend than the smbpasswd file.
Run "sudo /usr/bin/pdbedit -L" and see if the user is in it. If you didn't add the user as a Linux user first, you may need to rerun smbpasswd again.

You can use either smbpasswd or pdbedit program to manage the tdbsam account database.

chrism01 08-26-2009 06:42 PM

Try

tdbdump

if you have /etc/samba/passdb.tdb

hlavalle 03-15-2011 08:36 AM

I know that this thread has not been replied for a long time, but as it helped me, I decided to leave here what I found.

Code:

man smb.conf
Then look for "passdb backend (G)"

In my case (Ubuntu 10.04), with tdbsam, the file is at /var/lib/samba/passdb.tdb

With smbpasswd, you have the /etc/samba/smbpasswd, that is created when you add users with the "smbpasswd -a <user>" command.


All times are GMT -5. The time now is 12:10 PM.