Local execution of scripts upon domain logon and logoff

Richard Sharpe rsharpe at ns.aus.com
Fri Sep 13 04:41:01 GMT 2002

On Fri, 13 Sep 2002 c.maxwell at a-r-m.com.au wrote:

> I would like to have server-side logon and logoff scripts to do things 
> like clean up home directories and perform various share (un)mounts and 
> fold linking etc.

OK, you can clean up home directories in a server-side logon/logoff 
script, but mounting shares can only be done on the client.

I don't know what fold linking means.

However, an important question is: What type of clients?

> I don't know a whole lot about C programming, but I understand the 
> basics and really want to get this working.

Why not use the functionality that is already there?

You can use a [root] preexec for the netlogon share, or for the homes 

> How would I go about putting this functionality in?

Well, the problem is that you can't do everything you want with Network 
logon. At Network logon, if you are talking about NT clients (NT4.0, 5.0 
and 5.1), then there are a bunch of RPCs that are executed, which you can 
hook into, but I fear that someone who professes "not to know a lot about 
C programming" might find the going a little tough.

In addition, some of what you want to do can be accomplished with network 
logon scripts (perhaps dynamically generated). If you are going to do 
that, they you can have preexec scripts to the some of the clean up and a 
postexec to do other cleanup. Note, however, that if the user simply 
switches off the computer, the logoff script will not run, so you might 
want to do everything in the logon script.

> I have the source for 2.2.5 and have modified param.c to have two new 
> global parameters, szLogonPreExec and szLogonPostExec.
> I want to specify a script to be run in smb.conf with substitutions, 
> like normal RootPreExec and RootPostExec, and I would like them to be 
> called upon domain logon and logoff respectively.
> Where do I find the code for processing logons and logoffs?

Well, it is spread around. If it is an NT client, then it will 
RequestChallenges, then do a NetAuthenticate2. These are in rpc_server/*.c

> I am still searching the code as I am writing this, but any help would 
> be appreciated!
> Regards,
> Cameron Maxwell

Richard Sharpe, rsharpe at ns.aus.com, rsharpe at samba.org, 
sharpe at ethereal.com

More information about the samba-technical mailing list