Samba does not display files correctly when they contain a colon.
Original file name: test:file.txt
Display name under Windows: T8S6CH~R.TXT
How can I fix it?
Info:
Linux: SLES 11 SP 3
Samba: Version 3.6.3-0.33.39.1-3128-SUSE-CODE11-x86_64
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communitySamba does not display files correctly when they contain a colon.
Original file name: test:file.txt
Display name under Windows: T8S6CH~R.TXT
How can I fix it?
Info:
Linux: SLES 11 SP 3
Samba: Version 3.6.3-0.33.39.1-3128-SUSE-CODE11-x86_64
The problem with Samba's mangled names
option is that neither setting is ideal. You can have names that are not mangled, but cannot be accessed in any way because they contain illegal characters, or names that are mangled into the DOS 8.3 format and hence close to unreadable.
Fortunately there is (now) a VFS module called catia
which will provide custom character mappings. In particular it's possible to map out the characters considered illegal in Windows filenames.
In the [global]
section place these lines:
# Mapping illegal characters, where enabled with "vfs objects = catia"
mangled names = no
catia:mappings = 0x22:0xa8,0x2a:0xa4,0x2f:0xf8,0x3a:0xf7,0x3c:0xab,0x3e:0xbb,0x3f:0xbf,0x5c:0xff,0x7c:0xa6
In each [share_name]
section add this next line (if you already have a vfs objects
line, just append catia
to the list):
vfs objects = catia
As usual, if it's going to apply to all your shares, this share-based setting can be placed in [global]
instead of each individual share defintion.
On my Debian-based system this VFS object module was installed as part of the standard package.
One example of a filename that is mapped by this setting is 2017-12-24 12:23.txt
. Using mangled names = yes
has this file displayed as 2BB0Y9~4.TXT
. Using vfs objects = catia
instead has this file name displayed as 2017-12-24 12÷23.txt
. It's not perfect but it's pretty good. And most importantly, I can access it from Windows applications.
For some reason Samba started to mangle the file names containing a colon. That far I could not find anything regarding this behavior in Internet.
The solution is very simple. Adding mangled names = no
in the [global]
section to /etc/samba/smb.conf
and restarting Samba fixed the issue.
Special characters question mark ? \ < > * etc are illegal in windows filenames and I always avoid using them.
Nevertheless, I have no problem with these characters using my macOS Catalina accessing my FreeNAS-11.3-U1 and SMB/Samba setup. I'm not sure why this setting isn't by default, but you'll have to follow these steps to make it work flawless with MacOS.
In FreeNAS webUI, goto Sharing>SMB>Edit
fruit:encoding = native
Then goto Services and restart SMB