Samba on a FreeBSD Mini FAQ

Compilation

Q: When I compile Samba from ports I get error that looks like:

 checking how to build vfs_cap... shared
 checking how to build vfs_expand_msdfs... shared
 checking how to build vfs_shadow_copy... shared
 Using libraries:
     LIBS = -lcrypt  -liconv
     AUTH_LIBS = -lcrypt  -lpam -lpam
 checking configure summary... ERROR: No locking available. Running Samba would be unsafe
 configure: error: summary failure. Aborting config
 ===>  Script "configure" failed unexpectedly.

A: This message means that configure check wasn't able to verify presence and/or correct work of the file locking system calls flock(2) and/or fcntl(2). If you are running -CURRENT there is a slim chance that something related was broken in the recent libc or kernel, but most common reason is that...

You are keeping your ports collection tree on an NFS share and don't have properly configured RPC locking on your NFS server and/or client. Please, check Handbook for more details. In short, you have to make sure that RPC locking is enabled both for an NFS server and a client. Make sure that your /etc/rc.conf contains:

rpcbind_enable="YES"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"

As a workaround you can also set WRKDIRPREFIX variable in the /etc/make.conf to point to the local file system:

WRKDIRPREFIX=     /var/tmp

or, point WRKDIR there:

# make WRKDIR=/var/tmp/samba install clean

Usage

Q: How to use pdb_multi? What are the configuration options?

A: Unfortunately, there isn't much documentation regarding pdb_multi(as well as pdb_mysql and pdb_pgsql).

Here is the example how I used it to temporary override user password to a known one for automatic transfer of mailboxes from Kerio to Exchange. Replacing user password in the LDAP was another option, but using temporary alternative password database via Samba was a better solution.

Here is the config line:

 passdb backend = multi:smbpasswd,ldapsam:ldap://ldap.example.com/

smbpasswd backend was used for it's simplicity, as it can be easily edited by any text editor. For the production use tdbsam or other backend would be more appropriate.

Samba/MiniFAQ (last edited 2020-10-14T11:46:22+0000 by SashaVigole)