Score:0

How to 8.3 name mangle like windows

sn flag

Objective: I am looking for a way to create a windows share on Ubuntu which supports windows style 8.3 name mangling.

AllYourDrivesAreBelongToUs.txt -> ALLYOU~1.TXT

Rational: The company I work for has an access based quoting software which apparently uses 8.3 name mangling under the hood to access its files. I would like to host these files on the server it will currently not work on a non-windows based share.

I have read about Samba's version of name mangling, but this is not the same would not match the apparent hard coded 8.3 names mangled inside the quoting software.

If I map a windows shared drive in windows, I can access a long file by truncating it to 6 characters and adding a ~1 followed by the extension as shown above. This currently does not work with a similarly mapped samba drive in windows.

Question: Does anyone know of samba settings which would enable windows style 8.3 file mangling to make this happen or perhaps know of a filesystem wrapper which could introduce this aliasing functionality on the OS level?

Score:0
cn flag

From O'Reilly on samba:

[global]
    include = /usr/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

and it has a remark:

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.

And another note: according to the old manual

Samba still has to remain backward-compatible with network clients that store files in just the 8.3 format, such as Windows for Workgroups. If a user creates a file on a share called antidisestablishmentarianism.txt, a Windows for Workgroups client cannot tell it apart from another file in the same directory called antidisease.txt. Like Windows 95/98/Me and Windows NT/2000/XP, Samba has to employ a special method for translating a long filename to an 8.3 filename in such a way that similar filenames will not cause collisions. This is called name mangling, and Samba deals with this in a manner that is similar, but not identical to, Windows 95 and its successors

So there is NO 100% support for this.

sn flag
I had found and read this, but as according to the quoted text "Samba deals with this in a manner that is similar, but not identical to, Windows 95 and its successors". Samba appends a number based on the hash of the replaced text which is unlikely to always resolve to ~1. However it is true I haven't actually tried this.
Score:0
us flag

Use the shortname option for the mount command:

shortname=mode
      Defines  the  behavior  for  creation  and  display of filenames which fit into 8.3
      characters.  If a long name for a file exists, it will always be the preferred  one
      for display.  There are four modes:

      lower  Force  the short name to lower case upon display; store a long name when the
             short name is not all upper case.

      win95  Force the short name to upper case upon display; store a long name when  the
             short name is not all upper case.

      winnt  Display  the  short name as is; store a long name when the short name is not
             all lower case or all upper case.

      mixed  Display the short name as is; store a long name when the short name  is  not
             all upper case.  This mode is the default since Linux 2.6.32.

Reference: http://manpages.ubuntu.com/manpages/hirsute/man8/mount.8.html

sn flag
This seams to only apply to files which fit into 8.3 characters already instead of aliasing longer filenames with an 8.3 characters name.
sn flag
This is also a mount option specifically for vfat.
us flag
Couldn't you create a FAT partition to store the files, mount the partition using `shortname=winnt`, then share the mount point via samba?
sn flag
The help only mentions this defining how filenames which are already short are displayed. I am looking for a way that allows long filenames to be accessible by a short alias.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.