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.
|
---|
4 |
|
---|
5 | ===================
|
---|
6 | CHANGES SINCE v0.7b
|
---|
7 | ===================
|
---|
8 | included patch that made machine name %m a macro substitution value.
|
---|
9 | Thanks to: Nick Lopez <kimo_sabe@atdot.org>
|
---|
10 |
|
---|
11 | ==================
|
---|
12 | CHANGES SINCE v0.6
|
---|
13 | ==================
|
---|
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.
|
---|
16 |
|
---|
17 | added the ability to define substitution macros: see the useage section
|
---|
18 |
|
---|
19 | removed the large docstring from the file and moved the information to
|
---|
20 | the USEAGE section of this file
|
---|
21 |
|
---|
22 | cleaned up the code and made more flexible
|
---|
23 |
|
---|
24 | improved the code comments
|
---|
25 |
|
---|
26 | ==================
|
---|
27 | CHANGES SINCE v0.5
|
---|
28 | ==================
|
---|
29 | added a -v --version switch
|
---|
30 |
|
---|
31 | added a --pause switch which will put a pause statement between each
|
---|
32 | non-blank line of the script.
|
---|
33 |
|
---|
34 | ===============
|
---|
35 | A PERSONAL NOTE
|
---|
36 | ===============
|
---|
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.
|
---|
43 |
|
---|
44 | Thanks.
|
---|
45 | rhacer (rhacer@craigelachie.org)
|
---|
46 |
|
---|
47 | September 27, 2000
|
---|
48 | Thanks to those that did respond to my plea! I'd still love to hear from
|
---|
49 | any other users!
|
---|
50 |
|
---|
51 | ============
|
---|
52 | INTRODUCTION
|
---|
53 | ============
|
---|
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.
|
---|
58 |
|
---|
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.
|
---|
61 |
|
---|
62 | I settled on an INI file feel, because most who have experience with Win boxes
|
---|
63 | have some concept of INI files.
|
---|
64 |
|
---|
65 | ============
|
---|
66 | INSTALLATION
|
---|
67 | ============
|
---|
68 | The distribution archive contains three files:
|
---|
69 |
|
---|
70 | README This file
|
---|
71 | ntlogon.py The actual Python script (place in /usr/local/samba/bin)
|
---|
72 | ntlogon.conf A sample configuration file (place in /etc)
|
---|
73 |
|
---|
74 | This script was created using Python v1.5.2, and I believe it uses only
|
---|
75 | standard libraries.
|
---|
76 |
|
---|
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):
|
---|
82 |
|
---|
83 | [netlogon]
|
---|
84 | path = /usr/local/samba/netlogon
|
---|
85 | writeable = no
|
---|
86 | guest ok = no
|
---|
87 | root preexec = /usr/local/samba/bin/ntlogon --user=%U --os=%m
|
---|
88 | root postexec = rm /usr/local/samba/netlogon/%U.bat
|
---|
89 |
|
---|
90 | ======
|
---|
91 | USEAGE
|
---|
92 | ======
|
---|
93 | PLEASE SEE NTLOGON.CONF FOR A DETAILED CONFIGURATION EXAMPLE
|
---|
94 |
|
---|
95 | This programme will build a Windows NT logon script for users connecting
|
---|
96 | to a Samba server. Samba macros that are curently understood:
|
---|
97 |
|
---|
98 | %U user name
|
---|
99 | %G group name
|
---|
100 | %a machine architecture
|
---|
101 | %m machine netbios name
|
---|
102 |
|
---|
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.
|
---|
105 |
|
---|
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.
|
---|
109 |
|
---|
110 | The default netlogon directory is /usr/local/samba/netlogon though this
|
---|
111 | can be changed with the -d or --dir startup option.
|
---|
112 |
|
---|
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
|
---|
116 | fred.bat)
|
---|
117 |
|
---|
118 | Use the --debug option to print the logon script to screen instead of the
|
---|
119 | output file
|
---|
120 |
|
---|
121 | Use the --pause option to place a pause statement between each line of the
|
---|
122 | script to assist in debugging a logon script.
|
---|
123 |
|
---|
124 | The file is divided into sections that have headers in square brackets
|
---|
125 |
|
---|
126 | [Global]
|
---|
127 | [User-username]
|
---|
128 | [Group-groupname]
|
---|
129 | [OS-osname]
|
---|
130 |
|
---|
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:
|
---|
135 |
|
---|
136 | MAINDRIVE = G:
|
---|
137 | USERDRIVE = U:
|
---|
138 | SERVERNAME = myservername
|
---|
139 |
|
---|
140 | They are referenced by prepending a "%" sign to the variable name:
|
---|
141 |
|
---|
142 | NET USE %MAINDRIVE \\\\servername\\mainshare /YES
|
---|
143 | NET USE %USERDRIVE \\\\%SERVERNAME\\usershare /YES
|
---|
144 |
|
---|
145 | ==============
|
---|
146 | SPECIAL THANKS
|
---|
147 | ==============
|
---|
148 | Nick Lopez <kimo_sabe@atdot.org> for the net bios name patch.
|
---|
149 |
|
---|
150 | ===================
|
---|
151 | CONTACT INFORMATION
|
---|
152 | ===================
|
---|
153 | Author : Timothy (rhacer) Grant
|
---|
154 |
|
---|
155 | I can be reached at tjg@craigelachie.org
|
---|
156 | ntlogon website www.craigelachie.org/rhacer/ntlogon
|
---|
157 |
|
---|
158 | Please feel free to contact me with any suggestions, improvements, bugs you
|
---|
159 | might find.
|
---|
160 |
|
---|