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

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.