[Samba] Get logged on username (several sessions on the same machine)

Douglas VanLeuven roamdad at sonic.net
Wed Mar 12 21:12:25 GMT 2008


Kurthermal wrote:
> But the machine has been rebooted and another user has opened a session
> on it, but 'net status session' or 'net session' continue to claim that
> there are 2 users logged on the same machine. It isn't always the case,
> I think it can be due for example to a reset of the machine so windows
> didn't close cleanly the network resources.

I'm sorry I wasn't clear enough.  I wasn't attempting to explain your
circumstance.  I was trying to state a general design principal using a
kind of Socratic method.

Windows workstations are notorious for not bothering to signal goodbye.
  There are MS KB articles about fine tuning Windows servers to avoid
exhausting resources because the workstations are like that.  It's not a
samba issue, it's a windows issue.  I only tried to explain why it is
the way it is because you used the bug word.

There has been a samba option for forever (since at least 1.x or beta)

deadtime = <minutes>

just so the sessions don't hang around forever.  I never tried setting
it to 1 min., but you could experiment.  But it doesn't work if an
application forgets to close a file or release a lock..

I never tried it, but it should be possible to script something with the
"root preexec" if this is really an issue for you.  But be warned -
there are legitimate reasons multiple users can be logged on to a samba
machine at the same time.

For example.  My wife is logged on a widows machine.  I connect with
remote desktop.

Samba version 3.0.28-0.1.95-1624-SUSE-SL10.3
PID     Username      Group         Machine
-------------------------------------------------------------------
 7207   ranger1$      machine       192.168.202.35 (192.168.202.35)
 7207   FOREST\doug   users         192.168.202.35 (192.168.202.35)
 7339   FOREST\cindy  users         192.168.202.35 (192.168.202.35)
 7207   FOREST\cindy  users         192.168.202.35 (192.168.202.35)
 7339   ranger1$      machine       192.168.202.35 (192.168.202.35)

There's nothing I know of to readily distinguish your circumstance from
this circumstance other than quiescence on the connection for a period
of time.

Doug

> 
> Is there a way to get samba close all connections from a machine if
> another user try to open a new network resource from that machine ?
> 
> Or is there another way to get the currently active session on a PDC
> client ?
> 
> 
> Douglas VanLeuven wrote :
>> Kurthermal wrote:
>>  
>>> Am I the only one to have noticed this behaviour ?
>>> Do I have to report a bug or so ?
>>> Where can I get some answers ?
>>>
>>>     
>>
>> If a service was running as a prior user and needed network resources
>> from the samba server in addition to the currently logged on user,
>> wouldn't it be wrong to make the assumption those resources should no
>> longer be available?
>>
>> It only takes one exception to break a general case.
>>
>> Regards, Doug
>>
>>
>>   




More information about the samba mailing list