2020年4月9日木曜日

The location of password file of samba 4 on FreeBSD 12.1

Today, I've tried to install new samba server and migrate users from old server to new one. If I could  found user and password file of samba, then I just copy it, but I could not found. At first, I tried to list users as following:
$ pdbedit -L
tdbsam_open: Failed to open/create TDB passwd [/var/db/samba4/private/passdb.tdb]
tdbsam_getsampwnam: failed to open /var/db/samba4/private/passdb.tdb!
User Search failed!
$
Fortunately I've get the password file location from this error message.
$ sudo ls /var/db/samba4/private
Password:
msg.sock        passdb.tdb      secrets.tdb
$
Ok, I've copied it to new server and ...
# cp PATHNAME/passdb.tdb PATHNAME/secrets.tdb /var/db/samba4/private
# pdbedit -L
user1:2003: Name1
user2:2001: Name2
#
It worked.