This chapter wraps up our coverage of the smb.conf configuration file with some miscellaneous options that can perform a variety of tasks. We will talk briefly about options for supporting programmers, internationalization, messages, and common Windows bugs. For the most part, you will use these options only in isolated circumstances. We also cover performing automated backups with the smbtar command at the end of this chapter. So without further ado, let's jump into our first subject: options to help programmers.
If you have programmers accessing your Samba server, you'll want to be aware of the special options listed in Table 8.1.
numerical (number of minutes)
Adds a specified number of minutes to the reported time.
Allows non-owners of a file to change its time if they can write to it.
Causes file times to be rounded to the next even second.
Sets directory times to avoid a MS nmake bug.
time service = yes dos filetimes = yes fake directory create times = yes dos filetime resolution = yes delete readonly = yes
If you set these options, Samba shares will provide the kind of compatible file times that Visual C++, nmake, and other Microsoft programming tools require. Otherwise, PC make programs will tend to think that all the files in a directory need to be recompiled every time. Obviously, this is not the behavior you want.
If your Samba server has an accurate clock, or if it's a client of one of the Unix network time servers, you can instruct it to advertise itself as an SMB time server by setting the
server option as follows:
[global] time service = yes
The client will still have to request the correct time with the following DOS command, substituting the Samba server name in at the appropriate point:
C:\NET TIME \\
This command can be placed in a Windows logon script (see Chapter 6, Users, Security, and Domains ).
By default, the
server option is normally set to
no. If you turn this service on, you can use the command above to keep the client clocks from drifting. Time synchronization is important to clients using programs such as make, which compile based on the last time the file was changed. Incorrectly synchronized times can cause such programs to either remake all files in a directory, which wastes time, or not recompile a source file that was just modified because of a slight clock drift.
To deal with clients that don't process daylight savings time properly, Samba provides the
offset option. If set, it adds the specified number of minutes to the current time. This is handy if you're in Newfoundland and Windows doesn't know about the 30-minute time difference there:
[global] time offset = 30
Traditionally, only the root user and the owner of a file can change its last-modified date on a Unix system. The share-level
filetimes option allows the Samba server to mimic the characteristics of a DOS/Windows machine: any user can change the last modified date on a file in that share if he or she has write permission to it. In order to do this, Samba uses its root privileges to modify the timestamp on the file.
By default, this option is disabled. Setting this option to
yes is often necessary to allow PC make programs to work properly. Without it, they cannot change the last-modified date themselves. This often results in the program thinking all files need recompiling when they really don't.
resolution is share-level option. If set to
yes, Samba will arrange to have the file times rounded to the closest two-second boundary. This option exists primarily to satisfy a quirk in Windows that prevents Visual C++ from correctly recognizing that a file has not changed. You can enable it as follows:
[data] dos filetime resolution = yes
We recommend using this option only if you are using Microsoft Visual C++ on a Samba share that supports opportunistic locking.
times option exists to keep PC make programs sane. VFAT and NTFS filesystems record the creation date of a specific directory while Unix does not. Without this option, Samba takes the earliest recorded date it has for the directory (often the last-modified date of a file) and returns it to the client. If this is not sufficient, set the following option under a share definition:
[data] fake directory create times = yes
If set, Samba will adjust the directory create time it reports to the hardcoded value January 1st, 1980. This is primarily used to convince the Visual C++ nmake program that any object files in its build directories are indeed younger than the creation date of the directory itself and need to be recompiled.