Tomasz Chmielewski
2004-Dec-12 16:09 UTC
[Samba] %U server-side script executed after user logs out - possible?
Hello, I ahve a Samba domain controller and Windows users in that domain. I would like to execute a script on a server for a user that logs out. For example, after user "joe" logged out, I would like to execute /home/samba/scripts/logout/joe.sh Is it possible? If so, how? Tomek
John H Terpstra
2004-Dec-12 16:26 UTC
[Samba] %U server-side script executed after user logs out - possible?
On Sunday 12 December 2004 09:08, Tomasz Chmielewski wrote:> Hello, > > I ahve a Samba domain controller and Windows users in that domain. > > > I would like to execute a script on a server for a user that logs out. > > For example, after user "joe" logged out, I would like to execute > /home/samba/scripts/logout/joe.shTry the "postexec" option. The problem you will find is that not all logouts will send the instructions necessary to trigger this script. - John T. -- John H Terpstra Samba-Team Member Phone: +1 (650) 580-8668 Author: The Official Samba-3 HOWTO & Reference Guide, ISBN: 0131453556 Samba-3 by Example, ISBN: 0131472216 Hardening Linux, ISBN: 0072254971 Other books in production.
Tomasz Chmielewski
2004-Dec-12 16:55 UTC
[Samba] %U server-side script executed after user logs out - possible?
John H Terpstra wrote:> On Sunday 12 December 2004 09:08, Tomasz Chmielewski wrote: > >>Hello, >> >>I ahve a Samba domain controller and Windows users in that domain. >> >> >>I would like to execute a script on a server for a user that logs out. >> >>For example, after user "joe" logged out, I would like to execute >>/home/samba/scripts/logout/joe.sh > > > Try the "postexec" option. The problem you will find is that not all logouts > will send the instructions necessary to trigger this script.What do you mean? Is it Windows-version specific problem (i.e. NT4 and win2k with no service packs only), Samba-version problem (Samba < 3.0.5), or it just works like that and noone know why? :) As far as I understand "postexec", it will execute each time after user disconnets from a given share: [profiles] path = /home/samba/profiles (...) root postexec = /home/samba/scripts/logout/%u.sh So joe.sh should execute after Joe logs out. Considering what you said (not all logouts will send the instructions triggering the script) - what may be a cause for such a misbehaviuor? Tomek
John H Terpstra
2004-Dec-12 21:47 UTC
[Samba] %U server-side script executed after user logs out - possible?
On Sunday 12 December 2004 09:54, Tomasz Chmielewski wrote:> John H Terpstra wrote: > > On Sunday 12 December 2004 09:08, Tomasz Chmielewski wrote: > >>Hello, > >> > >>I ahve a Samba domain controller and Windows users in that domain. > >> > >> > >>I would like to execute a script on a server for a user that logs out. > >> > >>For example, after user "joe" logged out, I would like to execute > >>/home/samba/scripts/logout/joe.sh > > > > Try the "postexec" option. The problem you will find is that not all > > logouts will send the instructions necessary to trigger this script. > > What do you mean? Is it Windows-version specific problem (i.e. NT4 and > win2k with no service packs only), Samba-version problem (Samba < > 3.0.5), or it just works like that and noone know why? :) > > > As far as I understand "postexec", it will execute each time after user > disconnets from a given share:Correct, but can you be sure that Samba will always receive that logoff information?> > [profiles] > path = /home/samba/profiles > (...) > root postexec = /home/samba/scripts/logout/%u.sh > > > So joe.sh should execute after Joe logs out. > > Considering what you said (not all logouts will send the instructions > triggering the script) - what may be a cause for such a misbehaviuor?Reliability of network hardware infrastructure may be the key factor, however, I have seen apparently reliable networks where Windows NT4 and 2000 workstation logoffs would not trigger the postexec process. Using Ethereal it was plain to see that the workstation did not send anything to Samba either - it just dropped off the network. As far as Samba was concerned the client was still connected and the user was still logged in. - John T. -- John H Terpstra Samba-Team Member Phone: +1 (650) 580-8668 Author: The Official Samba-3 HOWTO & Reference Guide, ISBN: 0131453556 Samba-3 by Example, ISBN: 0131472216 Hardening Linux, ISBN: 0072254971 Other books in production.
Tomasz Chmielewski
2004-Dec-13 09:54 UTC
[Samba] %U server-side script executed after user logs out - possible?
John H Terpstra wrote:>>As far as I understand "postexec", it will execute each time after user >>disconnets from a given share: > > > Correct, but can you be sure that Samba will always receive that logoff > information?>>Considering what you said (not all logouts will send the instructions >>triggering the script) - what may be a cause for such a misbehaviuor? > > > Reliability of network hardware infrastructure may be the key factor, however, > I have seen apparently reliable networks where Windows NT4 and 2000 > workstation logoffs would not trigger the postexec process. Using Ethereal it > was plain to see that the workstation did not send anything to Samba either - > it just dropped off the network. As far as Samba was concerned the client was > still connected and the user was still logged in.Too bad. I just hoped it was possible for Samba to notice that when user uploaded his/her profile, this also means that that user has just logged off (and therefore, Samba shall trigger some %U script). Tomek