When serving files containing special characters such as "()?:" in the filename through Samba, the names get transformed into an unrecognizable format. For example, a file


is displayed as


Is there a way to avoid this behavior (without renaming the files, obviously)? I'm assuming that character encoding is not to blame because several UTF-8 characters seem to work fine.

  • Samba version 2:3.4.0-3ubuntu5.5 on Ubuntu 9.10
    – Matti
    Mar 20, 2010 at 22:55
  • 4
    Adding "mangled names = no" to smb.conf solved this (thanks, Dennis Williamson).
    – Matti
    Mar 23, 2010 at 0:25

5 Answers 5

  • I own an Apple Macbook Pro laptop with 64-bit OS X 10.11 "El Capitan" running Samba 3 that I installed through Macports.

  • I also own a Dell Inspiron laptop with 64-bit GNU/Linux XUbuntu 16.04 "Xenial Xerus" running Samba 3 that I installed through APT.

Both machines have network-shared folders and use Samba in order to communicate on my WLAN (wireless LAN).

Both my systems are in Brazilian Portuguese. Thus, I use special characters such as ç, á, ã, â, ô, é, ó et cetera.

When I use my Linux laptop to access my OS X Samba shares, all strings are shown correctly: words like maçã, ônus and bênção are shown correctly. Files and folders with long names are also shown, and their names are shown correctly. Thus, the Samba server running on OS X is already properly configured...

...but things weren't working the other way around: if I used the Finder app on OS X to access my Linux Samba shares, all files and folders having at least one of those special characters were not shown (they remained invisible to me), and the long names of files and folders were converted to weird short names. Thus, there was something wrong with the Samba server running on my Linux machine.

=> In my case, what solved this issue was adding the following lines to the [global] section inside the smb.conf file on my Linux machine:

mangled names = no
dos charset = CP850
unix charset = UTF-8

After that, I opened a shell terminal window and restarted the Linux Samba server with this command:

sudo service smbd restart

...which can be replaced by this other command (in case the command above doesn't work on your Linux distribution):

sudo systemctl restart smbd.service

After I restarted the Linux Samba server, the Finder app on OS X finally showed correctly all the files and folders that were previously hidden because of their names having one or more special characters. The mangled ("shortened") names were also "unmangled".


  1. In GNU/Linux systems, the standard location of the smb.conf file is /etc/samba/smb.conf
  2. Presuming that your Linux system has the smb.conf file stored at the standard location /etc/samba/: there are several different ways to edit the smb.conf file. For instance, if you're not using a Desktop Environment (e.g. your system has only a shell terminal, no windows) you can install the Nano text editor, by issuing a command such as sudo apt-get install nano -y or sudo dnf -b -y install nano or something else (depending on which Linux distro you are using), and then run sudo nano /etc/samba/smb.conf. In case you're using a Desktop Environment, you can install a graphical text editor such as GNOME Edit, by issuing a command such as sudo apt-get install gedit -y or sudo dnf -b -y install gedit or something else (depending on which Linux distro you are using), and then run sudo gedit /etc/samba/smb.conf.
  3. In Samba 3+, the display charset parameter is deprecated.
  4. The dos charset parameter does not support the UTF-8 argument. Thus, it must use the default argument CP850.
  5. mangled names = no instructs the Samba server not to shorten long names of files and folders. Hence, because the Samba client just replicates to the user what the Samba server has provided to the client, once the server is properly configured the client will no longer show the user any shortened name.
  • 3
    Thank you, almost 12 years later and still googling this; wish it was the default.
    – neophytte
    Sep 19, 2021 at 11:54
  • 1
    @neophytte No prob. I agree that it'd be easier if these general settings became part of the server's defaults, i.e. mangled names = no. I understand why the Samba devs. keep e.g. mangled names = yes as the default: compatibility, e.g. if one of the client systems doesn't support long file names, mangled names avoid name truncation that could lead to different files having identical truncated names. But most of today's systems are so modern that they support long names. Hence, unmangled names should be the default: only the few older systems would require manual activation of mangling. Sep 19, 2021 at 19:55

I use a shared folder on OS-X and Windows. Some files have the same issue, because they fall into the following: They use characters in the file-name, not supported by Windows.

See: http://support.microsoft.com/kb/177506

It lists the characters, not supported by Windows in files or directories. I guess, that Samba uses the same list of characters when listing files and directories.

A filename cannot contain any of the following characters:
\ / : * ? " < > |

A bit further down, they wrote:

Characters that are valid for naming files, folders, or shortcuts include any combination of letters (A-Z) and numbers (0-9), plus the following special characters:

^   Accent circumflex (caret)
&   Ampersand
'   Apostrophe (single quotation mark)
@   At sign
{   Brace left
}   Brace right
[   Bracket opening
]   Bracket closing
,   Comma
$   Dollar sign
=   Equal sign
!   Exclamation point
-   Hyphen
#   Number sign
(   Parenthesis opening
)   Parenthesis closing
%   Percent
.   Period
+   Plus
~   Tilde
_   Underscore

But I, personally, took the listing of not-allowed characters as a reference for briefing some customers here ;)


Windows does not allow some characters in filenames that Unix does allow. Samba "mangles" the filenames to make them comply with Windows restrictions. You can check the file /etc/smb.conf or /etc/samba/smb.conf to see what settings are in place. To show those settings plus the defaults, use this command:

testparm -vs | less

To narrow that down a bit:

testparm -vs|grep "case\|mangl"

See this page for more information. Also, see about half way down this page (the same information as the previous link).


from samba documentation you can use these:

dos charset = ISO8859-1
unix charset = ISO8859-1
display charset = ISO8859-1
  • 4
    This and adding mangled names= no to [global] fixed my on nas4free Jun 6, 2015 at 0:51
  • This fixed it for me: ubuntu server 22.04 & MacOS 12.6
    – null
    Dec 3, 2022 at 10:11

Yes, it's the char encoding to blame.

Pass "iocharset=iso8859-1" as an option to mount.cifs or select an iso8859-1 locale, instead of an utf-8.

You could also try to prepend "LANG=C.ISO8859-1" or "LC_ALL=C.ISO8859-1" to your commands, etc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .