Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to have a *nix Samba share accessible by Windows clients.

Samba has an option to enable or disable filename case-sensitivity. Normally for windows access, this is disabled, so that fred==FRED=fReD.

However, this leads to one major gotcha, AFAICT:

  • On unix, you create two folders called "RODDY" and "roddy"
  • On Windows, you'll see both of the folders, but...
  • When you delete/rename/open one from Windows, you could end up deleting/renaming/etc either of them. You have no way of knowing which!.

So, my question is, how does Samba behave on windows if the case-sensitive flag is set "ON"? Can a user still see both folders, and have file operations work in a consistent manner?

share|improve this question
up vote 8 down vote accepted

It should be fine. Windows Explorer does a fine job of displaying filename case correctly. I use this in my smb.conf to make sure what I type in Explorer is what Samba uses (I set all of these per-share):

case sensitive = True
default case = lower
preserve case = yes
short preserve case = yes

I ran through a quick test (Samba 3.0.24 on the backend, WinXP on the front). Files were created on the samba server via an SSH session.

$ cd /some/samba/share/path
$ mkdir test
$ cd test

$ mkdir test1 TEST1
$ touch test1/foo TEST1/bar

After this, I browsed through my mapped drive to the test directory. I can see both "test1" and "TEST1" directories. I opened "test1" and saw the "foo" file. I opened "TEST1" and saw the "bar" file. So far so good.

Then I went back to the test directory, and in the Explorer window, renamed TEST1 to TEST2. Windows freaked slightly -- it renamed the folder, then showed BOTH folders as TEST2 -- appearing to have renamed both folders. But, in the SSH terminal, I checked:

$ ls
test1 TEST2

So Windows renamed the file, and Samba got the filename correctly. When I pressed F5 in the Explorer window to refresh the folder contents, the display changed to show the correct folder names.

Caveat: Linux filesystems allow some characters that Windows doesn't (like ":"). Samba has a "name mangling" option to turn those filenames into something Windows will like. If I make a file called "FA:23" in my SSH window, for example, Samba mangles the name to "F7T4H0~F" and that's what appears in the Explorer window.

share|improve this answer
    
Great answer, thanks! – Roddy Oct 13 '09 at 12:13
    
Note that with a Windows 95 client you can't access directories inside shares when the case sensitive option is enabled. You should use the auto option in this case. – devius Oct 18 '14 at 16:32
    
Assume you have two folders on your unix filesystem: Test1 and test1 Which one will a user see in windows? Can I makge sure in Samba that if a folder Test1 exists, and someone on unix tries to create a folder test1, that it automatically merges it to Test1 instead, so that Windows users will always be able to see all files? In my experience, Windows user cannot see both folders if Test1 and test1 exist, but only one of them. – Erik Apr 15 at 8:13

The options which worked for me are below:

preserve case           = yes
short preserve case     = yes
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.