8

Samba does not display files correctly when they contain a colon.

Original file name: test:file.txt

Display name under Windows: T8S6CH~R.TXT

How can I fix it?

Info:

Linux: SLES 11 SP 3

Samba: Version 3.6.3-0.33.39.1-3128-SUSE-CODE11-x86_64

5

For some reason Samba started to mangle the file names containing a colon. That far I could not find anything regarding this behavior in Internet.

The solution is very simple. Adding mangled names = no in the [global] section to /etc/samba/smb.conf and restarting Samba fixed the issue.

  • Great to know that! +1 – Luciano Andress Martini Jul 29 '16 at 17:46
  • This solution is incomplete. Files with illegal Windows characters such as ':' are not shown. See roaima's solution. – Hans Deragon 21 hours ago
5

The problem with Samba's mangled names option is that neither setting is ideal. You can have names that are not mangled, but cannot be accessed in any way because they contain illegal characters, or names that are mangled into the DOS 8.3 format and hence close to unreadable.

Fortunately there is (now) a VFS module called catia which will provide custom character mappings. In particular it's possible to map out the characters considered illegal in Windows filenames.

In the [global] section place these lines:

    # Mapping illegal characters, where enabled with "vfs objects = catia"
    mangled names = no
    catia:mappings = 0x22:0xa8,0x2a:0xa4,0x2f:0xf8,0x3a:0xf7,0x3c:0xab,0x3e:0xbb,0x3f:0xbf,0x5c:0xff,0x7c:0xa6

In each [share_name] section add this next line (if you already have a vfs objects line, just append catia to the list):

    vfs objects = catia

On my Debian-based system this VFS object module was installed as part of the standard package.

One example of a filename that is mapped by this setting is 2017-12-24 12:23.txt. Using mangled names = yes has this file displayed as 2BB0Y9~4.TXT. Using vfs objects = catia instead has this file name displayed as 2017-12-24 12÷23.txt. It's not perfect but it's pretty good. And most importantly, I can access it from Windows applications.

  • 1
    See ⁚ ∶ ׃ ꞉ for other characters that look like ASCII colon. – Stéphane Chazelas Jul 25 '17 at 16:29
  • @StéphaneChazelas please do also feel free to submit that as a suggestion to the Samba development team. I just took their suggested list. – roaima Jul 25 '17 at 16:57
  • When I share a folder with Nautilus, the folder does not, obviously, show up in /etc/samba/smb.conf. How can I apply your solution in this scenario? – Hans Deragon 21 hours ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.