Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Most of our computers run Ubuntu, but two of them dual-boot into Windows, and when we have guests over, they typically also run Windows computers. Thus, in addition to using NFS, our file server (Ubuntu server) also runs Samba.

And since we use Ubuntu mostly, we like to take advantage of its advantages over Windows, such as being able to use the characters \:*?"<>| in a file name. The problem, of course, is that Windows doesn't accept those characters in file names, and so Samba has to translate the file name into something more acceptable. The way it does this, however, I find to be obnoxious.

The file name Episode 182 - Exorcist 2: The Heretic.mp4 for instance turns into E4Q82R~Y.MP4. This is a terrible "correction". Is there a way to make Samba's mangling a little more friendly to humans? Is possible to "correct" it to something like Episode 182 - Exorcist 2_ The Heretic.mp4 instead, where the illegal characters are simply substituted?

share|improve this question
Check out the description of this patch in the Samba Mailing List. The described method is working out-of-the-box with Samba 4.1.4-Debian. – mpy Feb 8 '14 at 17:59

2 Answers 2

In this link you can see the mangling options. I think first you should disable the option:

mangled names

After that I guess the names should look better...

To replace the colon e.g. use this line:

mangled map =(: _)

You can add more replace rules like this:

mangled map =(: _) (foo bar)

(also replaces any occurence of foo by bar)

share|improve this answer
They look better now. In fact, when I set "mangled names" to "no", the file names show up in Windows completely unchanged. While this certainly looks better, it also makes Windows applications unable to open the files. If I try to open a file tes:t.txt in Notepad, e.g., I am told "Cannot find the [...]\tes:t.txt file." Same goes with other "illegal" files in their respective applications. – Alex Nov 15 '11 at 8:58
edited my answer! – Michael K Nov 15 '11 at 9:05
mangled map has been removed from Samba. From what I can tell after a little looking around, it was removed years ago. This is what my log.smbd file says if I try to use it: Ignoring unknown parameter "mangled map" – Alex Nov 15 '11 at 9:33
You are right... deprecated. It won't work. It is not that simple - the complicated file name is to prevent having two files with the dame name. The file foo:.txt and foo_.txt could exist and then your renaming would fail. So the best would be to enforce file name rules such that only names are allowed which are allowed in both file systems. – Michael K Nov 15 '11 at 9:40

For those coming here through Google and wondering what to do since mangled map is deprecated, you can use vfs_catia to solve the problem. In my case, I just needed colons, so I put the following in my smb.conf:

vfs objects = catia
catia:mappings = 0x22:0xa8

I put it under [global], but that may impact performance, so I'd recommend putting it under another [share] section.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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