58bb64d3efba7cfbd4529ab8c223afc764d85577
[vlendec/samba-autobuild/.git] / docs / docbook / projdoc / VFS.xml
1 <chapter id="VFS">
2 <chapterinfo>
3         &author.jelmer;
4         &author.jht;
5         &author.tpot;
6         <author><firstname>Simo</firstname><surname>Sorce</surname><contrib>original vfs_skel README</contrib></author>
7         <author><firstname>Alexander</firstname><surname>Bokovoy</surname><contrib>original vfs_netatalk docs</contrib></author>
8         <author><firstname>Stefan</firstname><surname>Metzmacher</surname><contrib>Update for multiple modules</contrib></author>
9 </chapterinfo>
10 <title>Stackable VFS modules</title>
11
12 <sect1>
13 <title>Features and Benefits</title>
14
15 <para>
16 Since Samba-3, there is support for stackable VFS (Virtual File System) modules. 
17 Samba passes each request to access the UNIX file system through the loaded VFS modules. 
18 This chapter covers all the modules that come with the Samba source and references to 
19 some external modules.
20 </para>
21
22
23 </sect1>
24
25 <sect1>
26 <title>Discussion</title>
27
28 <para>
29 If not supplied with your platform distribution binary Samba package you may have problems
30 compiling these modules, as shared libraries are compiled and linked in different ways
31 on different systems. They currently have been tested against GNU/Linux and IRIX.
32 </para>
33
34 <para>
35 To use the VFS modules, create a share similar to the one below. The
36 important parameter is the <smbconfoption><name>vfs objects</name></smbconfoption> parameter where
37 you can list one or more VFS modules by name. For example, to log all access 
38 to files and put deleted files in a recycle bin, see <link linkend="vfsrecyc"/>.
39
40 <smbconfexample id="vfsrecyc">
41         <title>smb.conf with VFS modules</title>
42         <smbconfsection>[audit]</smbconfsection>
43 <smbconfoption><name>comment</name><value>Audited /data directory</value></smbconfoption>
44 <smbconfoption><name>path</name><value>/data</value></smbconfoption>
45 <smbconfoption><name>vfs objects</name><value>audit recycle</value></smbconfoption>
46 <smbconfoption><name>writeable</name><value>yes</value></smbconfoption>
47 <smbconfoption><name>browseable</name><value>yes</value></smbconfoption>
48         </smbconfexample>
49 </para>
50
51 <para>
52 The modules are used in the order in which they are specified.
53 </para>
54
55 <para>
56 Samba will attempt to load modules from the <filename>/lib</filename> directory in the root directory of the
57 Samba installation (usually <filename>/usr/lib/samba/vfs</filename> or <filename>/usr/local/samba/lib/vfs
58 </filename>).
59 </para>
60
61 <para>
62 Some modules can be used twice for the same share.
63 This can be done using a configuration similar to the one shown in <link linkend="multimodule"/>.
64
65 <smbconfexample id="multimodule">
66         <title>smb.conf with multiple VFS modules</title>
67 <smbconfsection>[test]</smbconfsection>
68 <smbconfoption><name>comment</name><value>VFS TEST</value></smbconfoption>
69 <smbconfoption><name>path</name><value>/data</value></smbconfoption>
70 <smbconfoption><name>writeable</name><value>yes</value></smbconfoption>
71 <smbconfoption><name>browseable</name><value>yes</value></smbconfoption>
72 <smbconfoption><name>vfs objects</name><value>example:example1 example example:test</value></smbconfoption>
73 <smbconfoption><name>example1: parameter</name><value>1</value></smbconfoption>
74 <smbconfoption><name>example:  parameter</name><value>5</value></smbconfoption>
75 <smbconfoption><name>test:        parameter</name><value>7</value></smbconfoption>
76 </smbconfexample>
77 </para>
78
79 </sect1>
80
81 <sect1>
82 <title>Included Modules</title>
83
84         <sect2>
85         <title>audit</title>
86
87                 <para>
88                 A simple module to audit file access to the syslog
89                 facility. The following operations are logged:
90                 <itemizedlist>
91                         <listitem>share</listitem>
92                         <listitem>connect/disconnect</listitem>
93                         <listitem>directory opens/create/remove</listitem>
94                         <listitem>file open/close/rename/unlink/chmod</listitem>
95                 </itemizedlist>
96                 </para>
97
98         </sect2>
99
100         <sect2>
101         <title>extd_audit</title>
102
103                 <para>
104                 This module is identical with the <command>audit</command> module above except
105                 that it sends audit logs to both syslog as well as the <command>smbd</command> log files. The 
106                 <smbconfoption><name>log level</name></smbconfoption> for this module is set in the &smb.conf; file. 
107                 </para>
108
109                 <para>
110                 Valid settings and the information that will be recorded are shown in <link linkend="xtdaudit"/>.
111                 </para>
112
113                 <table frame="all" id="xtdaudit">
114                         <title>Extended Auditing Log Information</title>
115                 <tgroup cols="2" align="center">
116                         <thead>
117                         <row><entry align="center">Log Level</entry><entry>Log Details - File and Directory Operations</entry></row>
118                         </thead>
119                         <tbody>
120                         <row><entry align="center">0</entry><entry align="left">Creation / Deletion</entry></row>
121                         <row><entry align="center">1</entry><entry align="left">Create / Delete / Rename / Permission Changes</entry></row>
122                         <row><entry align="center">2</entry><entry align="left">Create / Delete / Rename / Perm Change / Open / Close</entry></row>
123                         </tbody>
124                 </tgroup>
125                 </table>
126
127         </sect2>
128
129         <sect2 id="fakeperms">
130         <title>fake_perms</title>
131
132                 <para>
133                 This module was created to allow Roaming Profile files and directories to be set (on the Samba server
134                 under UNIX) as read only. This module will, if installed on the Profiles share, report to the client
135                 that the Profile files and directories are writable. This satisfies the client even though the files
136                 will never be overwritten as the client logs out or shuts down.
137                 </para>
138
139         </sect2>
140
141         <sect2>
142         <title>recycle</title>
143
144                 <para>
145                 A Recycle Bin-like module. Where used, unlink calls will be intercepted and files moved
146                 to the recycle directory instead of being deleted. This gives the same effect as the
147                 <guiicon>Recycle Bin</guiicon> on Windows computers.
148                 </para>
149
150                 <para>
151                 The <guiicon>Recycle Bin</guiicon> will not appear in <application>Windows Explorer</application> views of the network file system
152                 (share) nor on any mapped drive. Instead, a directory called <filename>.recycle</filename> will be
153                 automatically created when the first file is deleted. Users can recover files from the 
154                 <filename>.recycle</filename> directory. If the <parameter>recycle:keeptree</parameter> has been
155                 specified, deleted files will be found in a path identical with that from which the file was deleted.
156                 </para>
157                 
158                 <para>Supported options for the <command>recycle</command> module are as follow:
159                 <variablelist>
160                         <varlistentry>
161                         <term>recycle:repository</term>
162                                 <listitem><para>
163                                 Relative path of the directory where deleted files should be moved.
164                                 </para></listitem>
165                         </varlistentry>
166
167                         <varlistentry>
168                         <term>recycle:keeptree</term>
169                                 <listitem><para>
170                                 Specifies whether the directory structure should be kept or if the files in the directory that is being 
171                                 deleted should be kept seperately in the recycle bin.
172                                 </para></listitem>
173                         </varlistentry>
174                         
175                         <varlistentry>
176                         <term>recycle:versions</term>
177                                 <listitem><para>
178                                 If this option is set, two files 
179                                 with the same name that are deleted will both 
180                                 be kept in the recycle bin. Newer deleted versions 
181                                 of a file will be called <quote>Copy #x of <replaceable>filename</replaceable></quote>.
182                                 </para></listitem>
183                         </varlistentry>
184
185                         <varlistentry>
186                         <term>recycle:touch</term>
187                                 <listitem><para>
188                                 Specifies whether a file's access date should be touched when the file is moved to the recycle bin.
189                                 </para></listitem>
190                         </varlistentry>
191
192                         <varlistentry>
193                         <term>recycle:maxsize</term>
194                                 <listitem><para>
195                                 Files that are larger than the number of bytes specified by this parameter will not be put into the recycle bin.
196                                 </para></listitem>
197                         </varlistentry>
198
199                         <varlistentry>
200                         <term>recycle:exclude</term>
201                                 <listitem><para>
202                                 List of files that should not be put into the recycle bin when deleted, but deleted in the regular way.
203                                 </para></listitem>
204                         </varlistentry>
205
206                         <varlistentry>
207                         <term>recycle:exclude_dir</term>
208                                 <listitem><para>
209                                 Contains a list of directories. When files from these directories are
210                                 deleted, they are not put into the
211                                 recycle bin but are deleted in the
212                                 regular way.
213                                 </para></listitem>
214                         </varlistentry>
215
216                         <varlistentry>
217                         <term>recycle:noversions</term>
218                                 <listitem><para>
219                                 Opposite of <parameter>recycle:versions</parameter>. If both options are specified, this one takes precedence.
220                                 </para></listitem>
221                         </varlistentry>
222                 </variablelist>
223                 </para>
224
225         </sect2>
226
227         <sect2>
228         <title>netatalk</title>
229
230                 <para>
231                 A netatalk module will ease co-existence of Samba and netatalk file sharing services.
232                 </para>
233
234                 <para>Advantages compared to the old netatalk module:
235                 <itemizedlist>
236                         <listitem><para>Does not care about creating .AppleDouble forks, just keeps them in sync.</para></listitem>
237                         <listitem><para>If a share in &smb.conf; does not contain .AppleDouble item in hide or veto list, it will be added automatically.</para></listitem>
238                 </itemizedlist>
239                 </para>
240
241         </sect2>
242
243 </sect1>
244
245 <sect1>
246 <title>VFS Modules Available Elsewhere</title>
247
248 <para>
249 This section contains a listing of various other VFS modules that 
250 have been posted but do not currently reside in the Samba CVS 
251 tree for one reason or another (e.g., it is easy for the maintainer 
252 to have his or her own CVS tree).
253 </para>
254
255 <para>
256 No statements about the stability or functionality of any module
257 should be implied due to its presence here.
258 </para>
259
260         <sect2>
261         <title>DatabaseFS</title>
262
263                 <para>
264                 URL: <ulink noescape="1" url="http://www.css.tayloru.edu/~elorimer/databasefs/index.php">http://www.css.tayloru.edu/~elorimer/databasefs/index.php</ulink>
265                 </para>
266
267                 <para>By <ulink url="mailto:elorimer@css.tayloru.edu">Eric Lorimer.</ulink></para>
268
269                 <para>
270                 I have created a VFS module that implements a fairly complete read-only
271                 filesystem. It presents information from a database as a filesystem in
272                 a modular and generic way to allow different databases to be used
273                 (originally designed for organizing MP3s under directories such as
274                 <quote>Artists,</quote> <quote>Song Keywords,</quote> and so on. I have since easily
275                 applied it to a student
276                 roster database.) The directory structure is stored in the
277                 database itself and the module makes no assumptions about the database
278                 structure beyond the table it requires to run.
279                 </para>
280
281                 <para>
282                 Any feedback would be appreciated: comments, suggestions, patches,
283                 and so on. If nothing else, hopefully it might prove useful for someone
284                 else who wishes to create a virtual filesystem.
285                 </para>
286
287         </sect2>
288
289         <sect2>
290         <title>vscan</title>
291
292         <para>URL: <ulink noescape="1" url="http://www.openantivirus.org/">http://www.openantivirus.org/</ulink></para>
293
294                 <para>
295                 <filename>samba-vscan</filename> is a proof-of-concept module for Samba, which
296                 uses the VFS (virtual file system) features of Samba 2.2.x/3.0
297                 alphaX. Of course, Samba has to be compiled with VFS support. 
298                 <filename>samba-vscan</filename> supports various virus scanners and is maintained 
299                 by Rainer Link.
300                 </para>
301
302         </sect2>
303 </sect1>
304
305 </chapter>