[Samba] Recent inability to view long filenames stored with scp via samba mount

Jeremy Allison jra at samba.org
Fri Nov 8 20:39:41 UTC 2019

On Fri, Nov 08, 2019 at 03:20:14PM -0500, Michael Lueck via samba wrote:
> Indeed, I was finding other exceptions than just the new Beethoven Piano
> Sonata files. Some dating back to 2012! So definitely not new. I just have
> not needed to swap disks on my workstation in so long I have not needed to
> restore the MP3 collection.
> Both the : and the ? characters are key to having Samba limit the filename
> to the short version. I took care to remove both chars (one at a time) from
> a MP3, rync to backup, and once both chars were removed, NOW I can see the
> same long filename via the SAMBA mount as I see on the native Linux file
> system.

Yep, I had to do this to my media collection too
in order to move to SMB2 mounts for better

> Bravo Jeremy! Excellent sleuthing all!
> So what is a complete list of not allowable chars for SMB compatibility? I intent to purge my MP3 collection of all invalid chars.

In the code it's:

        for (i=1;i<128;i++) {
                if (i <= 0x1f) {
                        /* Control characters. */
                        char_flags[i] |= FLAG_ILLEGAL;


                if (strchr("*\\/?<>|\":", i)) {
                        char_flags[i] |= FLAG_ILLEGAL;


but we must also mangle names ending in '.' and any
names that match DOS reserved names of:

static const char * const reserved_names[] =
{ "AUX", "LOCK$", "CON", "COM1", "COM2", "COM3", "COM4",
  "LPT1", "LPT2", "LPT3", "NUL", "PRN"

Not that your mp3 files would match those :-).

More information about the samba mailing list