Friday, October 1, 2010

Samba errors using VFS Modules

I will keep this one short. After struggling for about 30 minutes to get the full_audit VFS module working for Samba, I realized what I was doing wrong. From the looks of others on google, this is a common error that people often don't understand the solution for.

Symptoms:
Samba loads correctly after adding VFS module but shares are not longer accessible
Testparm shows no errors

Errors may include:

log.smbd
Can't find a vfs module [/usr/lib/samba/vfs/full_audit.so]
smbd_vfs_init: vfs_init_custom failed for /usr/lib/samba/vfs/full_audit.so

Syslog:
smbd[7121]: Error loading module '/usr/lib/samba/vfs/full_audit.so': /usr/lib/samba/vfs/full_audit.so: failed to map segment from shared object: Permission denied


Solution:
Check to see if apparmor is running using one of the following (both require root privileges):

/etc/init.d/apparmor status

(or on systems running Upstart)
sudo service apparmor status


If apparmor is loaded, look to see if smbd is set to Enforce. If so, this might be where your problem is. To fix, modify the apparmor profile to allow access to the Samba VFS modules. One Ubuntu 10.04 (and on most systems), they can be found in
/usr/lib/samba/vfs/


An entry in your apparmor profile might looks something like

/usr/lib/samba/** rwkix,


I hope that helps someone out there.