[Samba] How to detect active users

Aaron E. ssureshot at gmail.com
Wed Jul 27 07:21:28 MDT 2011

clear the logs and monitor for a few days,, If there is not real 
activity just shut down the service and see if anyone complains they 
can't access something.. After a few days/weeks/months pull the server.

Might not be the perfect scenario but if smbstatus isn't displaying what 
you need then this might make you feel better about it lol

On 07/27/2011 04:33 AM, Malte Forkel wrote:
> Am 26.07.2011 19:27, schrieb Jeremy Allison:
>> On Tue, Jul 26, 2011 at 07:18:15PM +0200, Malte Forkel wrote:
>>> Am 26.07.2011 19:08, schrieb John Drescher:
>>>> On Tue, Jul 26, 2011 at 1:04 PM, Malte Forkel<malte.forkel at berlin.de>  wrote:
>>>>> Am 26.07.2011 18:42, schrieb Chris Weiss:
>>>>>> On Tue, Jul 26, 2011 at 3:06 AM, Malte Forkel<malte.forkel at berlin.de>  wrote:
>>>>>>> Currently, I'm not even sure Samba preserves the kind of state
>>>>>>> information required to detect the usage scenario  I'm interested in. Is
>>>>>>> there any concept of an "open file" in Windows/Samba, after all? May be
>>>>>>> it depends on the application used to open the file?
>>>>>> yes, it depends on the application.  If the app closes the file and
>>>>>> leaves the share, samba honors that.  if the app keeps the file handle
>>>>>> open, samba does too.
>>>>> So an application (like SciTE) might open a file, read and display its
>>>>> contents, and close the file while continuing to display it. And in
>>>>> contrast, a different application might not close the file while it is
>>>>> displaying its contents?
>>>> Exactly.
>>>> John
>>> Well, thanks to all of you for your help.
>>> In summary then, it looks to me like I won't be able to reliably detect
>>> if there is any client out there who would be disappointed if the server
>>> shuts down.
>> Of course you will ! smbstatus does this as I keep repeating.
>> If an application has opened and closed the file and keeps it
>> in memory, then the user won't be disappointed if the server
>> is shut down, they'll get an IO error on save and have to
>> do a "save as" to a local (or other remote) drive.
>> If an application keeps the file open (so it's not safely
>> stored in memory) then smbstatus will show this and you
>> don't shut the server down.
>> You seem to think there's some "magic" option that will
>> show you client intent, not client activity.
>> Client activity is all you need to care about, and smbstatus
>> show you this. Doesn't matter if applications are running
>> or not, whether that have actual files open is all that
>> matters.
>> Jeremy.
> Well, I guess some people get disappointed more easily than others :-)
> I understand that users won't loose any data if the server shuts down
> and they "save as" their changes. But having to re-synchronize those
> files with those on the server once it is up again is something I'd like
> to avoid.
> Plus, the open files (from a user perspective) might just be an
> indicator that the user would like to use other capabilities of the
> server as well. E.g., he might do remote development of an application
> on the server using Eclipse on the Windows machine. If I found out that
> the server had shut down when I try to compile a new version (implicitly
> saving changed files before), I'd be disappointed.
> Malte

More information about the samba mailing list