[Samba] xls file locked for editing by unknown user

Moray Henderson (ICT) Moray.Henderson at ict.om.org
Tue Jun 29 02:54:42 MDT 2010

Dave Coventry wrote:
>I'm not sure that this is the right place to ask about this, but one
>of my users is having a problem with her files,specifically excel
>files which she is editing with openoffice.
>I suspect that she is closing down her PC without logging out or
>something and so appears to be still logged in.
>She is using Vista and the server is a Debian Lenny box.
>Whenever she tries to access the files on the server the file is
>apparently "locked for editing by unknown user".
>I cannot find any .~ lockfiles and rebooting both machines does not
>resolve this.
>The permissions are set to 777 and the owner of the files is this
>particular user.
>As I say, I'm assuming this is a Samba issue.
>Can anyone suggest a way to resolve this?
>~ Dave

Which version of Samba?

Does smbstatus(1) list the file as being locked?  If so, it should give
a pid you can examine.  The fuser(1) and lsof(8) commands can track
which process has a file open.

If rebooting the server does not clear the lock, there's either a lock
file or a cached lock record somewhere.  Try /var/lib/samba/locking.tdb.
Although it's binary, you can grep(1) it for the filename, or use
tdbdump(8) to display the contents.  According to
files.3F, locking.tdb is not required to persist across restarts.  I
wouldn't try deleting this when Samba is running; even with Samba shut
down I would rename it rather than deleting it.

However, there has got to be a better solution to stale locks than
restarting Samba and deleting a tdb file every time it happens.  Does
the lock clear automatically after a time?  There may be lock tuning
parameters that could help - see smb.conf(5) for details.

"To err is human.  To purr, feline"

More information about the samba mailing list