[Samba] How to migrate samba users?

Charles
Tue, 28 Aug 2018 10:15:44 -0000

Hello Samba users mailing list :)

I want to migrate samba users from an old server to a new one.  The old
server has Samba 4.2 on Debian 8 Jessie.  The new server has Samba 4.5
on Debian 9 Stretch.  Both are plain SMB/CIFS servers, no DC or AD.

Both have this in smb.conf (generated by testparm from an
smb.conf.source file which has nothing about the backend):

     idmap config * : backend = tdb

I tried export and import but the old server users did not appear on the
new server (user names changed to protect the innocent):

root at old:~# pdbedit --export tdbsam:/tmp/old.tdbsam.export.tdb
[copied old.tdbsam.export.tdb from old to new]
root at new:~# pdbedit --import tdbsam:/tmp/old.tdbsam.export.tdb
Importing account for new-user-1...ok
Importing account for new-user-2...ok
root at new~# pdbedit --list
new-user-1:1002:
new-user-2:1001:

I tried running pdbedit with --debuglevel=5 but was not enlightened.

What to do?  It would be nice to merge users from old to new as tried.
If merge is not possible, it would be OK to loose the new users and
re-create them.

Is it OK to replace the whole new /var/lib/samba tree with the old one?

Best

Charles