3

I'd like to set up my samba server in the following way:

  1. Client 1 opens file A
  2. Client 2 attempts to open file A while Client 1 has it open
  3. Client 2 is granted read-only access to the file

Edit: All clients will be Windows XP or Windows 7 machines.

As per this page, what I want would be closest to a deny-mode of DENY_DOS, but I can't seem to make that option take effect.

Any help would be greatly appreciated.

4
  • Could you be more specific about the clients who are connecting to this server? In modern samba versions and linux distros file locking is in the default config.
    – Jasper
    Jul 31, 2010 at 15:59
  • See my edit - they'll all be windows.
    – Alex S
    Jul 31, 2010 at 16:11
  • Sorry for all the commenting, but what applications are having problems with this? I never experienced problems with WinXP and serveral standard apps, incl. Adobe,Microsoft. Of course applications could be ill behaved, just make local temporary copies and close the file, hence no lock.
    – Jasper
    Jul 31, 2010 at 16:32
  • I've just been testing with Notepad - [sorry if this is overtly noobish] I though locks were enforced by the OS or filesystem, not individual programs.
    – Alex S
    Jul 31, 2010 at 17:01

1 Answer 1

7

You cannot force all programs to use the file locking mechanism provided by samba. A lot of 'simple' applications just open the file, make a local copy (either in memory or on local disk) and then close the original file, so the lock only lasts as long as the opening and copying action. Notepad is one example of this. Moreover, this is actually a feature of most progams, not a shortcoming.

Think about what happens when an applications crashes with the lock still in place. Programs using filesystem locks should be aware of it and its implications and have a recover and release mechanism. That's why 'simple' applications avoid filesystem locking.

If you really want to use some kind of 'in use' messages for all applications you should use a versioning system. As mentioned elsewhere on serverfault, this isn't necessarily a technical problem, more a social one: you'll have a hard time convincing non-technical people to actually use it.

1
  • I was considering that, but most, if not all files we'll be working with are binary, so I wanted to try and look for another solution first. Luckily, as far as getting people to use it, its another person and I starting a small business, so it shouldn't be too much trouble. Thanks for your input.
    – Alex S
    Aug 2, 2010 at 2:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .