[Samba] Login and logout scripts

Dennis McLeod dmcleod at foranyauto.com
Tue Jan 30 17:51:03 GMT 2007

I was trying to this same thing yesterday. No PDC (it's setup as one, but
the machines are not joined to the domain), the machines (XP only) are in a
simple workgroup. Local group policy to run the logon/logoff script. Not all
of the usernames exist on the Samba server. Only one department (accounting)
so far, but I have 5 defined, and they are members of the appropriate
groups, etc. All the usernames/passwords on the client match the
usernames/passwords on the Samba Server, so it's transparent if the user
exists. What I can't figure out is how to bypass the prompting for a
username/password for the ones that don't exist. 
I looked at the ifmember stuff, but I'm doing local logons, so no joy there.
Can I query the Samba server for group membership in my logon script

I attempted to add the drive mapping like this:
net use g: \\server\%username%
Except the usernames that don't exist get prompted to enter a username and
I tried passing an "enter key" by using an enter.dat, but it doesn't get to
that line in the script because it's waiting for a response.

I'm currently bypassing this part by putting a check file on the machines in
accounting. I figure someday I will get them to join the domain, and I'll
work it out then, but if someone knows how to make it work otherwise, please
let me know....

Here's what I've done:
IF NOT EXIST "%systemdrive%\checks\acctng.chk" GOTO EOF
net use g: \\server\%username%
net use h: \\server\accounting



Oh, Samba version 3.010149 on Centos 4.4

-----Original Message-----
From: samba-bounces+dmcleod=foranyauto.com at lists.samba.org
[mailto:samba-bounces+dmcleod=foranyauto.com at lists.samba.org] On Behalf Of
Maurice Forte
Sent: Tuesday, January 30, 2007 9:00 AM
To: Paul McGrath
Cc: samba at lists.samba.org
Subject: RE: [Samba] Login and logout scripts


Recently,  I was trying to do something similar with login/logout scripts 
or the preexec clause but couldn't get it to work.   I am running Samba 
3.0.23c on AIX(not as PDC) with LDAP and 'security='user'  in the smb.conf 
file.   Can you run login/logout scripts without a PDC?   For the Windows 
clients that connect to my Samba server,  I want to capture their %USERNAME%
and compare it to the user that they are trying to connect to 
the share with?   If they are different,   I want to deny mount access to 
the share.   I looked at the Samba variables but there is no variable for 
capturing the user's login name.    Do you have any ideas on how to 
accomplish such a task?

Maurice Forte
Email:  mforte at us.ibm.com
Phone: 919-486-0153

"Paul McGrath" <J.P.McGrath at leeds.ac.uk> Sent by:
samba-bounces+mforte=us.ibm.com at lists.samba.org
01/24/2007 07:12 AM

<samba at lists.samba.org>

RE: [Samba] Login and logout scripts


If you are just using a samba server as the PDC with no MS Windows domain
controller then yes you can have login scripts.

You can also use group membership comparisons within the login script using
a windows tool called ifmember.exe.  Both the vbs/bat files and ifmember.exe
go /etc/netlogon.

To do the group comparison you have do a net groupmap command to map the
unix group with an nt group.

I have done this on a Mac Tiger and Panther server.  If you want more info
mail me directly.  I am going on holiday tomorrow so I may not get back
straight away.

> -----Original Message-----
> From: Mauricio Szabo [mailto:mauricio.szabo at ufabc.edu.br]
> Sent: Tuesday 23 January 2007 12:43
> To: samba at lists.samba.org
> Subject: [Samba] Login and logout scripts
> Is there a way to run a script on my samba PDC machine when a user 
> logs in and logs out?
> Thanks in advance.
> --
> Air conditioners and Computers are the same - they both crash when you 
> open Windows.
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba

To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba

More information about the samba mailing list