[Samba] %U server-side script executed after user logs out - possible?

John H Terpstra jht at Samba.Org
Sun Dec 12 21:43:05 GMT 2004

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 

> [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

The Official Samba-3 HOWTO & Reference Guide, ISBN: 0131453556
Samba-3 by Example, ISBN: 0131472216
Hardening Linux, ISBN: 0072254971
Other books in production.

More information about the samba mailing list