Re: [Hampshire] Preventing Samba Directory Listing

Top Page

Reply to this message
Author: Simon Capstick
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Preventing Samba Directory Listing
Chris Aitken wrote:
>>>> I just tried to block directory listings of a particular samba share,
>>>> but still allow read/writes within it to explicitly named files. I
>>>> simply did a 'chmod g-r' on the directory in question. The result worked
>>>> on the Samba box and also on the Linux box that had the share mounted
>>>> via cifs. However opening a file (explicitly named) within MS Word 2007
>>>> on WinXP results in a file not found error message. My samba version is
>>>> 3.0.14a-Debian.
>>>>
>>>> Is my chmod g-r barking up the wrong tree or do I have a Windows issue?
>>> When Word opens a file, it creates a copy of the file in the same
>>> directory. You'll need to allow creation of that file type, or total
>>> write access to the share.
>>>
>>> Chris
>>>
>> Thanks Chris. I had forgotten that, although that doesn't seem to be
>> the problem since I can successfully create, read and write files from
>> the Linux CIFS mount, with the directory listing still blocked. It
>> turns out the Windows problem is more specific than I thought, and
>> probably off-topic for this mailing list. MS Word can open the file
>> when the filename is typed into the open file dialog. The specific case
>> where Word fails is when clicking on a 'samba' URL in Internet Explorer.
>> e.g. :
>> http://\\my-samba-server\Test\Test2.txt
>>
>> Here are the permissions of my test Samba share which appear to work on
>> the whole except for the IE URL mentioned above...
>
> How does it respond using Windows Explorer?
>
>> Simon
>>
>> imagine:/home/samba-shares# ls -al test
>> total 20
>> drwx-wx---   2 root  samba-test 4096 Jan 10 17:19 .
>> drwxr-xr-x  34 root  root       4096 Jan 10 17:05 ..
>> -rw-rw----   1 simon samba-test   28 Jan 10 17:19 Test.txt
>> -rw-rw----   1 simon samba-test   14 Jan 10 17:16 Test.txt~
>> -rw-rw----   1 simon samba-test    2 Jan 10 17:18 Test2.txt

>>
>> smb.conf stanza...
>> [Test]
>>          comment = Test Share
>>          path = /home/samba-shares/test
>>          write list = samba-test
>>          force group = samba-test
>>          create mask = 660
>>          directory mask = 770
>>          force create mode = 660
>>          force directory mode = 770
>>          read only = No
>>          valid users = @samba-test

>
> It seems OK - though it's well over a year since I did anything
> serious on (or had access to) a linux box running Samba...
>


Explorer fails to open the Samba folder and gives a 'Access is denied'
error (rather than giving up and showing an empty folder without an
error as Linux/Konqueror does). Typing a full path to a file in the
Samba share also fails in Windows Explorer, i.e. no application is
launched for you. However full file paths typed in to in MS Word and
Notepad do work without problem, with the file being read/write.

Simon