Section 6.5. Virtual File Systems


6.5. Virtual File Systems

The smbd daemon interacts with files and directories on disk through a Virtual File System (VFS) module. The default VFS plug-in implements the Samba's standard file serving functionality. Other plug-ins distributed with the official Samba distribution and stored in /usr/local/samba/lib/vfs for default installations include:

  • A trash bin for saving deleted files.

  • A logging module for recoding a user's access to files.

  • A module to improve integration when sharing files via the Netatalk protocol.

There are also some third-party plug-ins available, such as the samba-vscan virus scanning plug-in (http://www.openantivirus.org/projects.php).

Each plug-in supports its own set of configuration settings that can be integrated into smb.conf using parametric options of the form module_name:option. In this section, we use the recycle.so VFS module as an example of the basic configuration steps. The complete set of VFS modules and associated documentation is included in the Samba distribution.

The purpose of the recycle.so library is to intercept any delete requests and move the target to a trash bin rather than removing it from disk. This is a nice safety net for users and prevents administrators from having to restore files from backup media when a user accidentally deletes an important document. Our example extends the [homes] share to provide users with a personal recycle directory.

The first step in configuring any VFS module is to define the vfs object value for the share. This parameter requires only the name of the VFS module (or modules). The smbd process automatically adds the necessary extension and attempts to load the plug-in from the vfs folder in Samba's library directory, which can be determined by running smbd -b | grep LIBDIR. Here is how the share definition should appear:

 [homes]     read only = no     vfs object = recycle 

The recycle module supports a variety of options for customizing how deleted files and directories should be backed up. The most common options are the directory where the deleted files are stored (repository), whether to maintain the file's original directory structure (keeptree), and which files should deleted rather than backed up (exclude). The modified share with the new VFS option syntax is:

 [homes]     read only = no     vfs object = recycle     recycle:repository = .trash     recycle:keeptree = yes     recycle:exclude = *.tmp, *~, *.bak 

New VFS modules added to a share picked up in the same fashion as new configuration parameters. There is no need to restart Samba. Each new client connection is able to take advantage of the new settings. With the recycle plug-in in place, a user can safely delete files from her home directory and immediately retrieve them from the top-level .trash directory.

Table 6-12 lists the complete set of recycle plug-in parameters and a brief description of each. For information on other VFS modules, check the Samba documentation.

Table 6-12. VFS recycle parameters

Parameter

Value

Description

Default

Scope

directory_mode

octal permission set

The Unix permissions assigned to directories created due to the keeptree option.

0700

Share

exclude

filename pattern

List of filename patterns that should be excluded from the recycle repository. The pattern follows the Microsoft globbing syntax.

""

Share

exclude_dir

filename pattern

List of directory name patterns that should be excluded from the recycle repository. The pattern follows the Microsoft globbing syntax.

""

Share

keeptree

boolean

Should the original directory hierarchy be maintained when moving files to the repository?

no

Share

maxsize

integer

The maximum file size in bytes that should be backed up. Files larger than this size are deleted.

-1(back up files of any size)

Share

repository

string

The absolute or relative path to the directory used to store deleted files.

.recycle

Share

touch

boolean

Should the access time be updated when the file is moved to the repository?

no

Share

touch_mtime

boolean

Should the modification time be updated when the file is moved to the repository?

no

Share


As of the 3.0.22 release, developers still have not provided individual manpages for the various VFS plug-ins, a deficiency they have promised to correct "real soon now."





Using Samba
Using Samba: A File and Print Server for Linux, Unix & Mac OS X, 3rd Edition
ISBN: 0596007698
EAN: 2147483647
Year: 2004
Pages: 135

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net