This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.(This used to...
[kai/samba.git] / docs / htmldocs / pdb-mysql.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >Passdb MySQL plugin</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
9 "><LINK
10 REL="HOME"
11 TITLE="SAMBA Project Documentation"
12 HREF="samba-howto-collection.html"><LINK
13 REL="UP"
14 TITLE="Optional configuration"
15 HREF="optional.html"><LINK
16 REL="PREVIOUS"
17 TITLE="Unified Logons between Windows NT and UNIX using Winbind"
18 HREF="winbind.html"><LINK
19 REL="NEXT"
20 TITLE="Passdb XML plugin"
21 HREF="pdb-xml.html"></HEAD
22 ><BODY
23 CLASS="CHAPTER"
24 BGCOLOR="#FFFFFF"
25 TEXT="#000000"
26 LINK="#0000FF"
27 VLINK="#840084"
28 ALINK="#0000FF"
29 ><DIV
30 CLASS="NAVHEADER"
31 ><TABLE
32 SUMMARY="Header navigation table"
33 WIDTH="100%"
34 BORDER="0"
35 CELLPADDING="0"
36 CELLSPACING="0"
37 ><TR
38 ><TH
39 COLSPAN="3"
40 ALIGN="center"
41 >SAMBA Project Documentation</TH
42 ></TR
43 ><TR
44 ><TD
45 WIDTH="10%"
46 ALIGN="left"
47 VALIGN="bottom"
48 ><A
49 HREF="winbind.html"
50 ACCESSKEY="P"
51 >Prev</A
52 ></TD
53 ><TD
54 WIDTH="80%"
55 ALIGN="center"
56 VALIGN="bottom"
57 ></TD
58 ><TD
59 WIDTH="10%"
60 ALIGN="right"
61 VALIGN="bottom"
62 ><A
63 HREF="pdb-xml.html"
64 ACCESSKEY="N"
65 >Next</A
66 ></TD
67 ></TR
68 ></TABLE
69 ><HR
70 ALIGN="LEFT"
71 WIDTH="100%"></DIV
72 ><DIV
73 CLASS="CHAPTER"
74 ><H1
75 ><A
76 NAME="PDB-MYSQL">Chapter 16. Passdb MySQL plugin</H1
77 ><DIV
78 CLASS="SECT1"
79 ><H1
80 CLASS="SECT1"
81 ><A
82 NAME="AEN2566">16.1. Building</H1
83 ><P
84 >To build the plugin, run <B
85 CLASS="COMMAND"
86 >make bin/pdb_mysql.so</B
87 >
88 in the <TT
89 CLASS="FILENAME"
90 >source/</TT
91 > directory of samba distribution. </P
92 ><P
93 >Next, copy pdb_mysql.so to any location you want. I 
94 strongly recommend installing it in $PREFIX/lib or /usr/lib/samba/</P
95 ></DIV
96 ><DIV
97 CLASS="SECT1"
98 ><H1
99 CLASS="SECT1"
100 ><A
101 NAME="AEN2572">16.2. Configuring</H1
102 ><P
103 >This plugin lacks some good documentation, but here is some short info:</P
104 ><P
105 >Add a the following to the <B
106 CLASS="COMMAND"
107 >passdb backend</B
108 > variable in your <TT
109 CLASS="FILENAME"
110 >smb.conf</TT
111 >:
112 <PRE
113 CLASS="PROGRAMLISTING"
114 >passdb backend = [other-plugins] plugin:/location/to/pdb_mysql.so:identifier [other-plugins]</PRE
115 ></P
116 ><P
117 >The identifier can be any string you like, as long as it doesn't collide with 
118 the identifiers of other plugins or other instances of pdb_mysql. If you 
119 specify multiple pdb_mysql.so entries in 'passdb backend', you also need to 
120 use different identifiers!</P
121 ><P
122 >Additional options can be given thru the smb.conf file in the [global] section.</P
123 ><P
124 ><PRE
125 CLASS="PROGRAMLISTING"
126 >identifier:mysql host                     - host name, defaults to 'localhost'
127 identifier:mysql password
128 identifier:mysql user                     - defaults to 'samba'
129 identifier:mysql database                 - defaults to 'samba'
130 identifier:mysql port                     - defaults to 3306
131 identifier:table                          - Name of the table containing users</PRE
132 ></P
133 ><P
134 ><SPAN
135 CLASS="emphasis"
136 ><I
137 CLASS="EMPHASIS"
138 >WARNING: since the password for the mysql user is stored in the 
139 smb.conf file, you should make the the smb.conf file 
140 readable only to the user that runs samba. This is considered a security 
141 bug and will be fixed soon.</I
142 ></SPAN
143 ></P
144 ><P
145 >Names of the columns in this table(I've added column types those columns should have first):</P
146 ><P
147 ><PRE
148 CLASS="PROGRAMLISTING"
149 >identifier:logon time column             - int(9)
150 identifier:logoff time column            - int(9)
151 identifier:kickoff time column           - int(9)
152 identifier:pass last set time column     - int(9)
153 identifier:pass can change time column   - int(9)
154 identifier:pass must change time column  - int(9)
155 identifier:username column               - varchar(255) - unix username
156 identifier:domain column                 - varchar(255) - NT domain user is part of
157 identifier:nt username column            - varchar(255) - NT username
158 identifier:fullname column            - varchar(255) - Full name of user
159 identifier:home dir column               - varchar(255) - Unix homedir path
160 identifier:dir drive column              - varchar(2) - Directory drive path (eg: 'H:')
161 identifier:logon script column           - varchar(255) - Batch file to run on client side when logging on
162 identifier:profile path column           - varchar(255) - Path of profile
163 identifier:acct desc column              - varchar(255) - Some ASCII NT user data
164 identifier:workstations column           - varchar(255) - Workstations user can logon to (or NULL for all)
165 identifier:unknown string column         - varchar(255) - unknown string
166 identifier:munged dial column            - varchar(255) - ?
167 identifier:uid column                    - int(9) - Unix user ID (uid)
168 identifier:gid column                    - int(9) - Unix user group (gid)
169 identifier:user sid column               - varchar(255) - NT user SID
170 identifier:group sid column              - varchar(255) - NT group ID
171 identifier:lanman pass column            - varchar(255) - encrypted lanman password
172 identifier:nt pass column                - varchar(255) - encrypted nt passwd
173 identifier:plain pass column             - varchar(255) - plaintext password
174 identifier:acct control column           - int(9) - nt user data
175 identifier:unknown 3 column              - int(9) - unknown
176 identifier:logon divs column             - int(9) - ?
177 identifier:hours len column              - int(9) - ?
178 identifier:unknown 5 column              - int(9) - unknown
179 identifier:unknown 6 column              - int(9) - unknown</PRE
180 ></P
181 ><P
182 >Eventually, you can put a colon (:) after the name of each column, which 
183 should specify the column to update when updating the table. You can also
184 specify nothing behind the colon - then the data from the field will not be 
185 updated. </P
186 ></DIV
187 ><DIV
188 CLASS="SECT1"
189 ><H1
190 CLASS="SECT1"
191 ><A
192 NAME="AEN2589">16.3. Using plaintext passwords or encrypted password</H1
193 ><P
194 >I strongly discourage the use of plaintext passwords, however, you can use them:</P
195 ><P
196 >If you would like to use plaintext passwords, set 'identifier:lanman pass column' and 'identifier:nt pass column' to 'NULL' (without the quotes) and 'identifier:plain pass column' to the name of the column containing the plaintext passwords. </P
197 ><P
198 >If you use encrypted passwords, set the 'identifier:plain pass column' to 'NULL' (without the quotes). This is the default.</P
199 ></DIV
200 ><DIV
201 CLASS="SECT1"
202 ><H1
203 CLASS="SECT1"
204 ><A
205 NAME="AEN2594">16.4. Getting non-column data from the table</H1
206 ><P
207 >It is possible to have not all data in the database and making some 'constant'.</P
208 ><P
209 >For example, you can set 'identifier:fullname column' to : 
210 <B
211 CLASS="COMMAND"
212 >CONCAT(First_name,' ',Sur_name)</B
213 ></P
214 ><P
215 >Or, set 'identifier:workstations column' to :
216 <B
217 CLASS="COMMAND"
218 >NULL</B
219 ></P
220 ><P
221 >See the MySQL documentation for more language constructs.</P
222 ></DIV
223 ></DIV
224 ><DIV
225 CLASS="NAVFOOTER"
226 ><HR
227 ALIGN="LEFT"
228 WIDTH="100%"><TABLE
229 SUMMARY="Footer navigation table"
230 WIDTH="100%"
231 BORDER="0"
232 CELLPADDING="0"
233 CELLSPACING="0"
234 ><TR
235 ><TD
236 WIDTH="33%"
237 ALIGN="left"
238 VALIGN="top"
239 ><A
240 HREF="winbind.html"
241 ACCESSKEY="P"
242 >Prev</A
243 ></TD
244 ><TD
245 WIDTH="34%"
246 ALIGN="center"
247 VALIGN="top"
248 ><A
249 HREF="samba-howto-collection.html"
250 ACCESSKEY="H"
251 >Home</A
252 ></TD
253 ><TD
254 WIDTH="33%"
255 ALIGN="right"
256 VALIGN="top"
257 ><A
258 HREF="pdb-xml.html"
259 ACCESSKEY="N"
260 >Next</A
261 ></TD
262 ></TR
263 ><TR
264 ><TD
265 WIDTH="33%"
266 ALIGN="left"
267 VALIGN="top"
268 >Unified Logons between Windows NT and UNIX using Winbind</TD
269 ><TD
270 WIDTH="34%"
271 ALIGN="center"
272 VALIGN="top"
273 ><A
274 HREF="optional.html"
275 ACCESSKEY="U"
276 >Up</A
277 ></TD
278 ><TD
279 WIDTH="33%"
280 ALIGN="right"
281 VALIGN="top"
282 >Passdb XML plugin</TD
283 ></TR
284 ></TABLE
285 ></DIV
286 ></BODY
287 ></HTML
288 >