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

I have to migrate a Samba 3 to a new Samba 4 server.

My problem is that the database on the samba 3 server seems a bit empty. The secrets.dtb file is only 20K whereas the “pbedit -L |wc -l”command give me 16970 lines.

On my Samba3 /var/lib/samba is 1,5M

After I had migrate the databse (following instructions on, “pdbedit -L” command on the new server give me only : SAMBA4$, Administrator, dns-samba4, krbtgt and nobody.

So I tried to create a VM with a Samba3. I added some users, done the same things I did for the migration and now I can see the users created on the VM.

It’s like users on the Samba 3 server are in a sort of cache.

I already migrate the /etc/{passwd,shadow,group} files and I can see users with the “getent passwd” command.

Any ideas why my users are present when I use pdbedit but the database is so empty ?

The global part of my smb.conf on the Samba 3 server :

   workgroup = INTERNET
   netbios name = PDC-SMB3
   server string = %h server
   interfaces = eth0
   obey pam restrictions = Yes
   passdb backend = smbpasswd
   passwd program = /usr/bin/passwd %u
   passwd chat = *new* %n\n *Re* %n\n *pa*
   username map = /etc/samba/smbusers
   unix password sync = Yes
   syslog = 0
   log file = /var/log/samba/log.%U
   max log size = 1000
   socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
   add user script = /usr/sbin/useradd -s /bin/false -m '%u' -g users
   delete user script = /usr/sbin/userdel -r '%u'
   add group script = /usr/sbin/groupadd '%g'
   delete group script = /usr/sbin/groupdel '%g'
   add user to group script = /usr/sbin/usermod -G '%g' '%u'
   add machine script = /usr/sbin/useradd -s /bin/false -d /dev/null '%u' -g machines
   logon script = logon.cmd
   logon home = \\$L\%U
   domain logons = Yes
   os level = 255
   preferred master = Yes
   local master = Yes
   domain master = Yes
   dns proxy = No
   ldap ssl = no
   panic action = /usr/share/samba/panic-action %d
   invalid users = root
   admin users = admin, root, administrateur
   log level = 2
share|improve this question

I find a way to do it.

I used "pdbedit -e smbpasswd:/root/samba-users.bak" on the Samba 3 server to export users. Then I did a "pdbedit -i /root/samba-users.bak" on the Samba 4 server where /root/samba-users.bak is the file that I copied from the Samba 3 server. Of course, I already imported users from the old server to the new one.

share|improve this answer
correct: pdbedit -i smbpasswd:/root/samba-users.bak – user295652 Jun 23 '15 at 7:32

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.