1 ntlogon.py v0.8b Copyright 2002 by Timothy (rhacer) Grant
2 This programme is released under the terms of the GNU Public License
3 This programme has NO WARRANTY of any kind, use at your own risk.
8 included patch that made machine name %m a macro substitution value.
9 Thanks to: Nick Lopez <kimo_sabe@atdot.org>
14 PLEASE NOT THAT I AM CONSIDERING THIS A BETA UNTIL I GET SOME FEEDBACK
15 FROM USERS ON WHETHER THE MACRO FEATURE WORKS FOR THEM.
17 added the ability to define substitution macros: see the useage section
19 removed the large docstring from the file and moved the information to
20 the USEAGE section of this file
22 cleaned up the code and made more flexible
24 improved the code comments
29 added a -v --version switch
31 added a --pause switch which will put a pause statement between each
32 non-blank line of the script.
37 When I originally posted v0.5 on Freshmeat, I really expected *some*
38 feedback. To date this little script has been downloaded over 700 times, but
39 absolutely nobody has sent me an e-mail to tell me if it is useful, or if
40 it is absolutely the stupidest waste of bandwidth they have ever seen.
41 I'd really love to know if even one person other than me and the other techs
42 here at Avalon have found it useful.
45 rhacer (rhacer@craigelachie.org)
48 Thanks to those that did respond to my plea! I'd still love to hear from
54 As my experience with Linux and Samba increased, I had no trouble whipping up
55 a custom Perl, Python or Bash script to create Samba Logon Scripts, but I
56 noticed that I changed things from place to place, and that my users had *no*
57 chance of ever figuring out how to modify those scripts themselves.
59 In an attempt to create a company wide standard that both my co-workers and my
60 customers could *easily* modify I hit upon the scheme I used here.
62 I settled on an INI file feel, because most who have experience with Win boxes
63 have some concept of INI files.
68 The distribution archive contains three files:
71 ntlogon.py The actual Python script (place in /usr/local/samba/bin)
72 ntlogon.conf A sample configuration file (place in /etc)
74 This script was created using Python v1.5.2, and I believe it uses only
77 Your smb.conf file needs to contain a netlogon section similar to the
78 following (These settings *are not* normal on a RH box. These settings
79 are all based on the excellent book that I learned Samba from: Samba
80 Integrating Unix and Windows by John D. Blair. It is somewhat out of
81 date now, but that's the history of the strange file locations):
84 path = /usr/local/samba/netlogon
87 root preexec = /usr/local/samba/bin/ntlogon --user=%U --os=%m
88 root postexec = rm /usr/local/samba/netlogon/%U.bat
93 PLEASE SEE NTLOGON.CONF FOR A DETAILED CONFIGURATION EXAMPLE
95 This programme will build a Windows NT logon script for users connecting
96 to a Samba server. Samba macros that are curently understood:
100 %a machine architecture
101 %m machine netbios name
103 This programme reads a configuration that looks strikingly similar to both
104 the Samba configuration file, and a DOS "boot menu" AUTOEXEC.BAT file.
106 The default file name is /etc/ntlogon.conf (though I really think it ought
107 to be called ntlogon.batch!) You may change the filename by using the -f
108 or --templatefile startup option.
110 The default netlogon directory is /usr/local/samba/netlogon though this
111 can be changed with the -d or --dir startup option.
113 The default batch file name generated is username.bat if no username is
114 specified the default value is logon.bat (e.g., if --user=fred is specified
115 on the command line then the logon script generated will be stored in
118 Use the --debug option to print the logon script to screen instead of the
121 Use the --pause option to place a pause statement between each line of the
122 script to assist in debugging a logon script.
124 The file is divided into sections that have headers in square brackets
131 The file may also contain user defined substitution macros. They are
132 defined by placing the macro name on the left side of an equal sign,
133 and the substitution text on the right side of the equal sign. They
134 are also case sensitive:
138 SERVERNAME = myservername
140 They are referenced by prepending a "%" sign to the variable name:
142 NET USE %MAINDRIVE \\\\servername\\mainshare /YES
143 NET USE %USERDRIVE \\\\%SERVERNAME\\usershare /YES
148 Nick Lopez <kimo_sabe@atdot.org> for the net bios name patch.
153 Author : Timothy (rhacer) Grant
155 I can be reached at tjg@craigelachie.org
156 ntlogon website www.craigelachie.org/rhacer/ntlogon
158 Please feel free to contact me with any suggestions, improvements, bugs you