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

Ryan Novosielski novosirj at umdnj.edu
Sat Mar 15 08:37:26 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

My recommendation is to use the [homes] share, not the [netlogon] share,
probably for this reason. I'm not really sure how I arrived at that
conclusion, but possibly I ran into that same issue long ago.

Kurthermal wrote:
> I'm aware that the fact connections aren't while the should is a client
> issue (let's say due to a finger press on the reset switch). I also know
> that it can possible that multiple users have a session open from the
> same machine (let's say a Linux box where Alice and Bob are connected
> with SSH and where they "smbmount" some ressources on a Samba Server).
> I now understand that there is no really a way to do what I want only
> with Samba, and that this is due to pure logic and SMB/CIFS
> specifications (if I'm wrong, please correct me).
> 
> root preexec option in [netlogon] resource definition helps me now to
> get the real name of the connected user (since in my case only one
> person can use a workstation).
> 
> Note that I see more than one execution of "root preexec" in one logon,
> as if client opens/closes/opens/closes/opens "netlogon" share from 2 to
> 4 times in its logon procedure...
> 
> Thanks for your answer, cheers.
> K.
> 
> 
> Douglas VanLeuven wrote :
>> 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
>>>>
>>>>
>>>>         
>>
>>
>>
>>
>>   


- --
 ---- _  _ _  _ ___  _  _  _
 |Y#| |  | |\/| |  \ |\ |  | |Ryan Novosielski - Systems Programmer II
 |$&| |__| |  | |__/ | \| _| |novosirj at umdnj.edu - 973/972.0922 (2-0922)
 \__/ Univ. of Med. and Dent.|IST/AST - NJMS Medical Science Bldg - C630
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH24rGmb+gadEcsb4RAkSzAKCU4+mQjQtgef61EYmcqefYh43auQCgqoi9
mi9SQAmLYYR405FZuBcH2Nk=
=RmUT
-----END PGP SIGNATURE-----


More information about the samba mailing list