[Samba] logged in users

Malte Woelky Malte.Woelky at gmx.de
Wed Jul 28 00:17:46 GMT 2004


Hallo,

>>        is it possible to query the domain controller
>>        which user is loggid in from which workstation.
CW> man smbstatus

oh no, it's so simple - I didn't though... ;-)

Just run smbstatus, grep (or parse output, which is more save)
the user in question, get the ip of the
workstation


and finally (this I kney) shutdown the ws using 'net shutdown ...'

(in real life you would use the 'logon' or 'profile' or 'home' share ...)



e.g. want to kick user 'mwoelky'
--------------------------------


server:~ # smbstatus

Samba version 2.2.8a-SuSE
Service      uid      gid      pid     machine
----------------------------------------------
video        root     root     16735   woelky   (10.0.80.230) Tue Jul 27 11:38:10 2004
download     root     root     20801   ds9      (10.0.80.103) Tue Jul 27 16:23:37 2004
video        root     root     29421   rugaldo  (10.0.80.176) Wed Jul 28 01:49:53 2004
video        root     root     29078   saugstation (10.0.80.23) Wed Jul 28 01:26:09 2004
storage      root     root     16735   woelky   (10.0.80.230) Tue Jul 27 11:38:08 2004
download     root     root     16735   woelky   (10.0.80.230) Tue Jul 27 11:38:08 2004
temp_mw      root     root     16735   woelky   (10.0.80.230) Tue Jul 27 11:38:08 2004
mwoelky      mwoelky  users    16735   woelky   (10.0.80.230) Tue Jul 27 11:38:11 2004
cfusion_ww   root     root     16735   woelky   (10.0.80.230) Tue Jul 27 11:38:11 2004
mp3          root     root     16735   woelky   (10.0.80.230) Tue Jul 27 11:38:08 2004
upload       mwoelky  users    16735   woelky   (10.0.80.230) Tue Jul 27 11:38:08 2004

server:~ # smbstatus | grep mwoelky

mwoelky      mwoelky  users    16735   woelky   (10.0.80.230) Tue Jul 27 11:38:11 2004
upload       mwoelky  users    16735   woelky   (10.0.80.230) Tue Jul 27 11:38:08 2004

server:~ # smbstatus | grep mwoelky| awk 'print $6'  (or similary ...)

voila, go the ip's (maybe user is logged on on different ips)

10.0.80.230
10.0.80.230

(sort and kill dupes...)

10.0.80.230

and then 'net shutdown ... <ip>'


Big tnx, Craig !!!

-- 
Best regards,
 Malte                            mailto:malte.woelky at gmx.de

Malte Woelky -=[SkyNet]=- 
Unix/DBs/Networks/LDAP/Active Directory 
Cert  : MCSA 2000+2003, MCSA:msg, MCSE 2000+2003
voice : 0209/977 37 03 : 0173/90 32 167 
eMail : Malte.Woelky at gmx.de 
WWW : http://www.woelky.net/ 
_________ ICQ# 12 767 43 99 _________




More information about the samba mailing list