trigger a program when user login/logoff from NT domain

Gong Wei ccegongw at
Wed Jun 9 13:35:23 GMT 1999

Hi all,


As most (if not all) of us known already Samba allows people to execute a
program before (exec) and after (postexec) a user connect to a share.

In our network due to certain requirement we have to find some way to run a
program when the user login to NT domain, then run another program when he
log out.

A natural solution is to setup a Samba server and change the NT login script
so upon login, a "net use \\XXX\yyy" will be issued which in turn triggered
a program running on the Samba server.  Then this connection will be
maintained throughout the user session.  The user will never access
\\XXX\yyy since no data stored there.

When user logoff, the share disconnects and another program runs.

In our smb.conf, we have the following lines:
        deadtime = 0
        keepalive = 0

In this way, an estabilished connection won't be disconnected unless the
user logoff the domain.  This is exactly what we want since we only want to
trigger the program at the moment that the user login/logoff.

This setup has been running fine, until we extend it to whole the campus
which contains 26,000 users.

My Samba server is a poor Linux machine, PII 400 with 256MB RAM, 128MB Swap
(this is the max. swap per partition for Linux?), kernel 2.2.7-ac2.  

This machine simply crashes because it run out of resources.  I've done a
"echo 20480 > /proc/sys/fs/file-max;ulimit -n 10240;/etc/init.d/samba start"
which couldn't solve the problem.  I saw some error message on console
screen: "Cannot fork(), run out of resource ...."

So now the question is:
1. Is this approach (maintain a connection for each login session) feasible
for so many users (26,000)?
2. If no, any other alternative?  We simply want to trigger something
exactly at the time that the user login/logoff.
3. If yes, any pointer on fine-tune the kernel parameters?  Will it help if
I change this machine to FreeBSD?  

In fact, I am running a test FreeBSD machine, PII 400 with 128MB RAM, 1GB
SWAP, Stable 3.2, MAXUSER set to 256, kern.maxfiles=15000,
kern.maxfilesperproc=10240, ulimit -n 10240 before start samba daemon.
Don't know what will happen to this machine tomorrow morning ... :-)

Please email your comments/pointer of info/suggestions to me
(ccegongw at as I haven't submitted to this samba list yet. Thanks

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Gong Wei.vcf
Type: application/octet-stream
Size: 572 bytes
Desc: not available
Url :

More information about the samba mailing list