Here is how Samba mangles a long filename into an 8.3 filename:
-
If the original filename does not begin with a dot, up to the first five alphanumeric characters that occur before the last dot (if there is one) are converted to uppercase. These characters are used as the first five characters of the 8.3 mangled filename.
-
If the original filename begins with a dot, the dot is removed and up to the first five alphanumeric characters that occur before the last dot (if there is one) are converted to uppercase. These characters are used as the first five characters of the 8.3 mangled filename.
-
These characters are immediately followed a special mangling character: by default, a tilde (~), although Samba allows you to change this character.
-
The base of the long filename before the last period is hashed into a two-character code; parts of the name after the last dot may be used if necessary. This two character code is appended to the 8.3 filename after the mangling character.
-
The first three characters after the last dot (if there is one) of the original filename are converted to uppercase and appended onto the mangled name as the extension. If the original filename began with a dot, three underscores (
_ _ _
) are used as the extension instead.
Here are some examples:
virtuosity.dat VIRTU~F1.DAT
.htaccess HTACC~U0._ _ _
hello.java HELLO~1F.JAV
team.config.txt TEAMC~04.TXT
antidisestablishmentarianism.txt ANTID~E3.TXT
antidiseast.txt ANTID~9K.TXT
Using these rules will allow Windows for Workgroups to differentiate the two files on behalf of the poor individual who is forced to see the network through the eyes of that operating system. Note that the same long filename should always hash to the same mangled name with Samba; this doesn't always happen with Windows. The downside of this approach is that there can still be collisions; however, the chances are greatly reduced.
You generally want to use the mangling configuration options with only the oldest clients. We recommend doing this without disrupting other clients by adding an
include
directive to the
smb.conf file:
[global]
include = /ucsr/local/samba/lib/smb.conf.%m
This resolves to
smb.conf.WfWg when a Window for Workgroups client attaches. Now you can create a file
/usr/local/samba/lib/smb.conf.WfWg which might contain these options:
[global]
case sensitive = no
default case = upper
preserve case = no
short preserve case = no
mangle case = yes
mangled names= yes
If you are not using Windows for Workgroups 3.1, then you probably do not need to change any of these options from their defaults.