advisory file locks in linux - do they work?

Jeff Gibson jgibson at spscommerce.com
Thu Apr 14 04:17:41 EST 2011


On 04/13/2011 11:45 AM, Bob Proulx wrote:
> You seem to think that all programs do file locking? Or perhaps you
> are aware that they do not but you think they /should/ use file
> locking and this is your way of lobbying to add it?
Whoa - Please don't start attacking.  I had just read on some websites 
that SFTP supported it (perhaps this was not OpenSSH), and I *thought* I 
had it working on Solaris at one point.  Guess not.  Anyway it's good to 
know this so I don't spend any more time trying to get it to work! :)
> Since you already know about the 'flock -c cmd' then you already know
> how to add this to sftp in your process.
>
>
Perhaps I wasn't very clear - we have clients connecting to us via SFTP 
- We cannot reasonably expect them to know enough about UNIX/SFTP to do 
the above, and many of the 3rd party programs they use are closed source 
with limited feature sets.  Instead I was hoping that it was possible 
for the internal-sftp process to automatically lock incoming files.  As 
I have now learned, OpenSSH/SFTP does not support this natively.  
However, we have had an internal developer add the functionality and so 
far it seems to work.
> As such there is no need for file locking to be added to any
> particular program.  You have the control to semaphore between any
> process that you wish to coordinate.  This is much more flexible and
> powerful than creating an infinite number of infinitely large
> monolithic programs that contain all possible functionality.
>
OK - so is there a way to do this with the internal-sftp command while 
using a chroot directory?  I guess I'm not grokking how to do this on 
the server-side without adding code or copying binaries to the user's 
directory.

Anyway, thanks for you time.
JG


More information about the openssh-unix-dev mailing list