Files/Folders get weird names and become inaccessible on Samba share

17,390

Solution 1

It's a file name mangling problem. Samba is converting filenames down to old style DOS 8.3 filenames.

Edit /etc/smb.conf (*) and add mangled names=no to the [global] section and restart the smb service.

Reference: http://oreilly.com/openbook/samba/book/ch05_04.html


(*) if the file is not there, type locate smb.conf to find it. Type sudo updatedb if locate does not find it and try again.

Solution 2

Came across this while looking for visibly the same issue but unrelated to Samba or any other specific file sharing utility.

(It took me a bit of google work to find this page which is why I'm adding my new answer for anyone else who finds this like I did)

The problem was only affecting a single user's directories (when viewed by others) and every mangled directory name was in the format of six(6) uppercase characters or numbers, one(1) ~ (tilde), followed by a single uppercase character or number.

Examples:

G2X4IA~5
O2T3KH~K
SYJ2IT~R

Solution:

The MAC user(s) in question should stop using trailing spaces and/or special characters in directory names. That's it. Almost every one of the directories in question had a trailing space, and the rest had a trailing special character (one actually had both which was a good test case). Simply removing them immediately cleared things up.

Share:
17,390
Scott
Author by

Scott

Updated on September 18, 2022

Comments

  • Scott
    Scott over 1 year

    Here is our current setup:

    Mac OS X 10.5.8 File server using Mac OS Extended (Journaled) file system. There is a share that is shared over AFP (For Mac desktops) and Samba for (Windows desktops).

    Here is what is happening:

    All GFX designers use Mac and create folders/files on the file server over AFP and programmers access those files using samba. Sometimes files and folders appear with weird names and become inaccessible to those connecting over samba.

    enter image description here

    enter image description here

    enter image description here

    The only way to make the created folder accessible is go back onto a Mac desktop got to the location of the folder, create a new folder and move the contents of broken folder to the new one.

    On the Mac desktops they can access the folders perfectly fine and the folder/file name appears as they were created. It's just PC users accessing over Samba that has the file/folder issue. Whats weird is that this happens at random and I cannot find any reason why some files folder end up not working for samba users. I suspect that the mac users are doing something to that file/folder such as adding a flag or some property thats compatible with the Mac file system but causes problems with samba.

    So my question:

    What causes this issue? Is there a permanent fix? If not is there a way I can train the Mac uses to stop them causing the issues for samba users?

  • Tor Arne Vestbø
    Tor Arne Vestbø over 6 years
    Thank you, this was the case for me to, a directory with a trailing space in its name. Setting mangled names=no in smb.conf let me view the file as is on the macOS client, including the trailing space.