Hi, I'm new to this mailing list so I don't know what the rules are here, so I apologise in advance if I break any. In Samba 2.2.3a it has the smb.conf line of 'login script', a few days ago I tried 'login script = login.bat %U'. Upon doing this, Samba didn't process my login script at all. This may seem like a really stupid question, but why is this? The only reason I can think of (after looking at the code) is that it ignores whitespace in the 'login script' smb.conf directive and if it sees it, it ignores the whole line? I'm not a good coder, I can read the stuff and understand it for the most part but I'm no guru. What I was wondering is, what kind of code modifications would it take to allow a parameter of 'login.bat %U' so that when Samba sees that line, it executes login.bat with the parameter of %U (%U according to the SWAT docs means 'username')? I ask because I got curious as to whether GROUP login scripts would work, I coded a small C tool that parses the passwd and groups files (in /etc) to check for the existance of the user in question and to check what group they're in. It then creates a 1-byte file in the /export/netlogon/test/groups directory of 'username-groupname' which my login.bat then checks for it's existence in the directory. If it finds it, it calls the /export/netlogon/test/groups/<groupname>.bat file IF it exists. I've tested my C tool and the batch files and they work fine, it led me to the conclusion above about the 'login script' smb.conf directive. Any ideas on this? Okay yeah it is just me being curious, but an additional thought could be if people wanted to go from Novell Netware to Samba, they can use group login scripts in Novell. Just a thought. Thanks, Kris "May darkness be your only ally, for in the shadows you can hide" - Kris 1998-2002 -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com> iQEVAwUBPHjfdSBHjRAjzresAQHZpgf/ZKpt2Nl+8EmIJwT/rLFtx8yhFFKdqVk6 pQGsgeOGN1ZI5kSOU6FBeWkyVS3YKLV6UHhvHVm1MQuBwPyfnjhQGj+OuI9jQPoc qTFb0TRQivOQoOeJq1PfIFcl53RrvRUOFAl8+jdKqZo/IFARdllknkCMTZirvp5l M+7/4a/ua2rx8d46zab1RF5YYNHRjyJRXD913FHty5VXCX31DJ55nAho30lOKOPC TNT+zzO1UC/J+keWSjxSSV3wPeOiOgtUtI5FiuXJmv1IXzsxjogGCTd0HUJ/04mR H623bEhl8M8yF/x6seCNKpHDkDQjoL+ddlQGVezdgbg3z7Jd7Y6VKA==/whC -----END PGP SIGNATURE-----
> It would be much easier to just set the variable in the login.bat file and > do what you need inside of the script. You can't send command line > switches to the logon script from this directive. You could use multiple > logon scripts like '%U.bat'. This would mean that each user had there own > script. You could then make this script call another script like'login.bat> %username%' or something. But, by far the easiest method is to use asingle> script that will handle multiple users and groups. > > -- > BrianBrian, It would be easier yes, but on the Windows' side of things, it does not have access to /etc/passwd or /etc/group, so how can I use the single login script to determine what group a user is in? That's why I wrote the C program for, which will search for the given username etc... Windows doesn't have this, I can port it to Win32 but I'd rather not as I'd then need to copy the /etc/group and /etc/passwd files. Each user having their own script is a problem, we have 1500+ users and we don't have time to setup 1500+ login scripts, we thought it would be easy to implement group-based logins. Seems that's not the case and never was, anyone out there with any other suggestions as to enable the use of group logins? Thanks Kris
--On Saturday, March 23, 2002 11:56 AM +0000 "K. Hawkes" <k.hawkes@zombies.force9.net> wrote:> What I was wondering is, what kind of code modifications would it take to > allow a parameter of 'login.bat %U' so that when > Samba sees that line, it executes login.bat with the parameter of %U (%U > according to the SWAT docs means 'username')? > > I ask because I got curious as to whether GROUP login scripts would work, > I coded a small C tool that parses the passwd and groups files (in /etc) > to check for the existance of the user in question and to check what group > they're in. It then creates a 1-byte file > in the /export/netlogon/test/groups directory of 'username-groupname' > which my login.bat then checks for it's existence in the directory. If > it finds it, it calls the /export/netlogon/test/groups/<groupname>.bat > file IF it exists. I've tested my C tool and the batch files and they > work fine, it led me to the conclusion above about the 'login script' > smb.conf directive. > > Any ideas on this?This question just came up in the last few weeks... See http://www.phonax.com/fileservers/index.shtml for more information, as well as Richard Sharpe's Samba book from Que. All you need do is add to your C program to write out a batch file that will be sent to the client, and executed there. In the SMB.CONF you add an entry for a root preexec to execute your C program, and *THERE* you can use the variable substitution that you are unable to use on the login script = line. Your line becomes login script = %U.bat (Your C program would create the file)... Here is how you would set up your smb.conf: [global] logon script = %U.bat [netlogon] path = /dir/netlogon root preexec = /dir/netlogon/logonscript %U %M %m %G root postexec = rm /dir/netlogon/%U.bat HTH... - john