Validation updates to Samba3 By Example
[tprouty/samba.git] / docs / Samba-Guide / Chap12-Appendix.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE appendix PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3
4 <appendix id="appendix">
5   <title>Appendix: A Collection of Useful Tid-bits</title>
6
7     <para><indexterm>
8         <primary>material</primary>
9       </indexterm><indexterm>
10         <primary>domain</primary>
11         <secondary>joining</secondary>
12       </indexterm>
13         Information presented here is considered to be either basic or well-known material that is informative
14         yet helpful. Over the years, I have observed an interesting behavior. There is an expectation that
15         the process for joining a Windows client to a Samba-controlled Windows Domain may somehow involve steps
16         different from doing so with Windows NT4 or a Windows ADS Domain. Be assured that the steps are identical,
17         as shown in the example given below.
18         </para>
19
20 <sect1 id="domjoin">
21 <title>Joining a Domain: Windows 200x/XP Professional</title>
22
23       <para><indexterm>
24           <primary>joining a domain</primary>
25         </indexterm>
26         Microsoft Windows NT/200x/XP Professional platforms can participate in Domain Security.
27         This section steps through the process for making a Windows 200x/XP Professional machine a
28         member of a Domain Security environment. It should be noted that this process is identical
29         when joining a domain that is controlled by Windows NT4/200x as well as a Samba PDC.
30         </para>
31
32         <procedure>
33                 <step><para>
34                 Click <guimenu>Start</guimenu>.
35                 </para></step>
36
37                 <step><para>
38                 Right-click <guimenu>My Computer</guimenu>, and then select <guimenuitem>Properties</guimenuitem>.
39                 </para></step>
40
41                 <step><para>
42                 The opening panel is the same one that can be reached by clicking <guimenu>System</guimenu> on the Control Panel.
43                 See <link linkend="wxpp001"></link>.
44                 <image id="wxpp001"><imagefile>wxpp001</imagefile><imagedescription>The General Panel.</imagedescription></image>
45                 </para></step>
46
47                 <step><para>
48                 Click the <guimenu>Computer Name</guimenu> tab.
49                 This panel shows the <guimenuitem>Computer Description</guimenuitem>, the <guimenuitem>Full computer name</guimenuitem>,
50                 and the <guimenuitem>Workgroup</guimenuitem> or <guimenuitem>Domain name</guimenuitem>.
51                 </para>
52
53                 <para>
54                 Clicking the <guimenu>Network ID</guimenu> button launches the configuration wizard. Do not use this with
55                 Samba-3. If you wish to change the computer name, or join or leave the domain, click the <guimenu>Change</guimenu> button.
56                 See <link linkend="wxpp004"></link>.
57                 <image id="wxpp004"><imagefile>wxpp004</imagefile><imagedescription>The Computer Name Panel.</imagedescription></image>
58                 </para></step>
59
60                 <step><para>
61                 Click on <guimenu>Change</guimenu>. This panel shows that our example machine (TEMPTATION) is in a workgroup called WORKGROUP.
62                 We join the domain called MIDEARTH. See <link linkend="wxpp006"></link>.
63                 <image id="wxpp006"><imagefile>wxpp006</imagefile><imagedescription>The Computer Name Changes Panel.</imagedescription></image>
64                 </para></step>
65
66                 <step><para>
67                 Enter the name <guimenu>MIDEARTH</guimenu> in the field below the Domain radio button.
68                 </para>
69
70                 <para>
71                 This panel shows that our example machine (TEMPTATION) is set to join the domain called MIDEARTH. See <link linkend="wxpp007"></link>.
72                 <image id="wxpp007"><imagefile>wxpp007</imagefile><imagedescription>The Computer Name Changes Panel &smbmdash; Domain MIDEARTH.</imagedescription></image>
73                 </para></step>
74
75                 <step><para>
76                 Now click the <guimenu>OK</guimenu> button. A dialog box should appear to allow you to provide the credentials (username and password)
77                 of a Domain administrative account that has the rights to add machines to the Domain.
78                 </para>
79
80                 <para>
81                 Enter the name <quote>root</quote> and the root password from your Samba-3 server. See <link linkend="wxpp008"></link>.
82                 <image id="wxpp008"><imagefile>wxpp008</imagefile><imagedescription>Computer Name Changes &smbmdash; User name and Password Panel.</imagedescription></image>
83                 </para></step>
84
85                 <step><para>
86                 Click <guimenu>OK</guimenu>.
87                 </para>
88
89                 <para>
90                 The <quote>Welcome to the MIDEARTH domain</quote> dialog box should appear. At this point, the machine must be rebooted.
91                 Joining the domain is now complete.
92                 </para></step>
93
94         </procedure>
95
96       <para><indexterm>
97           <primary>Active Directory</primary>
98         </indexterm><indexterm>
99           <primary>DNS</primary>
100         </indexterm>
101         The screen capture shown in <link linkend="wxpp007"/> has a button labeled <guimenu>More...</guimenu>. This button opens a
102         panel in which you can set (or change) the Primary DNS suffix of the computer. This is a parameter that mainly affects members
103         of Microsoft Active Directory. Active Directory is heavily oriented around the DNS name space.
104         </para>
105
106       <para><indexterm>
107           <primary>Netlogon</primary>
108         </indexterm><indexterm>
109           <primary>DNS</primary><secondary>dynamic</secondary>
110         </indexterm>
111         Where NetBIOS technology uses WINS as well as UDP broadcast as key mechanisms for name resolution, Active Directory servers
112         register their services with the Microsoft Dynamic DNS server. Windows clients must be able to query the correct DNS server
113         to find the services (like which machines are Domain Controllers or which machines have the Netlogon service running).
114         </para>
115
116       <para><indexterm>
117           <primary>DNS</primary>
118           <secondary>suffix</secondary>
119         </indexterm>
120         The default setting of the Primary DNS suffix is the Active Directory domain name. When you change the Primary DNS suffix,
121         this does not affect Domain Membership, but it can break network browsing and the ability to resolve your computer name to
122         a valid IP address.
123         </para>
124
125         <para>
126         The Primary DNS suffix parameter principally affects MS Windows clients that are members of an Active Directory domain.
127         Where the client is a member of a Samba Domain, it is preferable to leave this field blank.
128         </para>
129
130       <para><indexterm>
131           <primary>Group Policy</primary>
132         </indexterm>
133         According to Microsoft documentation, <quote>If this computer belongs to a group with <constant>Group Policy</constant>
134         enabled on <command>Primary DNS suffice of this computer</command>, the string specified in the Group Policy is used
135         as the primary DNS suffix and you might need to restart your computer to view the correct setting. The local setting is
136         used only if Group Policy is disabled or unspecified.</quote>
137         </para>
138
139 </sect1>
140
141 <sect1>
142         <title>Samba System File Location</title>
143
144       <para><indexterm>
145           <primary>default installation</primary>
146         </indexterm><indexterm>
147           <primary>/usr/local/samba</primary>
148         </indexterm><indexterm>
149           <primary>/usr/local</primary>
150         </indexterm>
151         One of the frustrations expressed by subscribers to the Samba mailing lists revolves around the choice of where the default Samba Team
152         build and installation process locates its Samba files. The location, chosen in the early 1990s, for the default installation is
153         in the <filename>/usr/local/samba</filename> directory. This is a perfectly reasonable location, particularly given all the other
154         Open Source software that installs into the <filename>/usr/local</filename> subdirectories.
155         </para>
156
157         <para>
158         Several UNIX vendors, and Linux vendors in particular, elected to locate the Samba files in a location other than the Samba Team
159         default. 
160         </para>
161
162       <para><indexterm>
163           <primary>Free Standards Grou</primary>
164           <see>FSG</see>
165         </indexterm><indexterm>
166           <primary>FSG</primary>
167         </indexterm><indexterm>
168           <primary>Linux Standards Base</primary>
169           <see>LSB</see>
170         </indexterm><indexterm>
171           <primary>LSB</primary>
172         </indexterm><indexterm>
173           <primary>File Hierarchy System</primary>
174           <see>FHS</see>
175         </indexterm><indexterm>
176           <primary>FHS</primary>
177         </indexterm><indexterm>
178           <primary>file locations</primary>
179         </indexterm><indexterm>
180           <primary>/etc/samba</primary>
181         </indexterm><indexterm>
182           <primary>/usr/sbin</primary>
183         </indexterm><indexterm>
184           <primary>/usr/bin</primary>
185         </indexterm><indexterm>
186           <primary>/usr/share</primary>
187         </indexterm><indexterm>
188           <primary>/usr/share/swat</primary>
189         </indexterm><indexterm>
190           <primary>/usr/lib/samba</primary>
191         </indexterm><indexterm>
192           <primary>/usr/share/samba/swat</primary>
193         </indexterm><indexterm>
194           <primary>SWAT</primary>
195         </indexterm><indexterm>
196           <primary>VFS modules</primary>
197         </indexterm>
198         Linux vendors, working in conjunction with the Free Standards Group (FSG), Linux Standards Base (LSB), and File Hierarchy       
199         System (FHS), have elected to locate the configuration files under the <filename>/etc/samba</filename> directory, common binary
200         files (those used by users) in the <filename>/usr/bin</filename> directory, and the administrative files (daemons) in the
201         <filename>/usr/sbin</filename> directory. Support files for the Samba Web Admin Tool (SWAT) are located under the
202         <filename>/usr/share</filename> directory, either in <filename>/usr/share/samba/swat</filename> or in
203         <filename>/usr/share/swat</filename>. There are additional support files for <command>smbd</command> in the
204         <filename>/usr/lib/samba</filename> directory tree. The files located there include the dynamically loadable modules for the
205         passdb backend as well as for the VFS modules.
206         </para>
207
208       <para><indexterm>
209           <primary>/var/lib/samba</primary>
210         </indexterm><indexterm>
211           <primary>/var/log/samba</primary>
212         </indexterm><indexterm>
213           <primary>run-time control files</primary>
214         </indexterm>
215         Samba creates run-time control files and generates log files. The run-time control files (tdb and dat files) are stored in
216         the <filename>/var/lib/samba</filename> directory. Log files are created in <filename>/var/log/samba.</filename>
217         </para>
218
219         <para>
220         When Samba is built and installed using the default Samba Team process, all files are located under the 
221         <filename>/usr/local/samba</filename> directory tree. This makes it simple to find the files that Samba owns.
222         </para>
223
224       <para><indexterm>
225           <primary>smbd</primary>
226           <secondary>location of files</secondary>
227         </indexterm>
228         One way to find the Samba files that are installed on your UNIX/Linux system is to search for the location
229         of all files called <command>smbd</command>. Here is an example:
230 <screen>
231 &rootprompt; find / -name smbd -print
232 </screen>
233         You can find the location of the configuration files by running:
234 <screen>
235 &rootprompt; /path-to-binary-file/smbd -b | more
236 ...
237 Paths:
238    SBINDIR: /usr/sbin
239    BINDIR: /usr/bin
240    SWATDIR: /usr/share/samba/swat
241    CONFIGFILE: /etc/samba/smb.conf
242    LOGFILEBASE: /var/log/samba
243    LMHOSTSFILE: /etc/samba/lmhosts
244    LIBDIR: /usr/lib/samba
245    SHLIBEXT: so
246    LOCKDIR: /var/lib/samba
247    PIDDIR: /var/run/samba
248    SMB_PASSWD_FILE: /etc/samba/smbpasswd
249    PRIVATE_DIR: /etc/samba
250 ...
251 </screen>
252         If you wish to locate the Samba version, just run:
253 <screen>
254 &rootprompt; /path-to-binary-file/smbd -V
255 Version 3.0.12-SUSE
256 </screen>
257         </para>
258
259         <para>
260         Many people have been caught by installation of Samba using the default Samba Team process when it was already installed
261         by the platform vendor's method. If your platform uses RPM format packages, you can check to see if Samba is installed by
262         executing:<indexterm>
263           <primary>rpm</primary>
264         </indexterm>
265 <screen>
266 &rootprompt; rpm -qa | grep samba
267 samba3-pdb-3.0.12-1
268 samba3-vscan-0.3.5-0
269 samba3-winbind-3.0.12-1
270 samba3-3.0.12-1
271 samba3-python-3.0.12-1
272 samba3-utils-3.0.12-1
273 samba3-doc-3.0.12-1
274 samba3-client-3.0.12-1
275 samba3-cifsmount-3.0.12-1
276         </screen><indexterm>
277           <primary>package names</primary>
278         </indexterm>
279         The package names, of course, vary according to how the vendor, or the binary package builder, prepared them.
280         </para>
281
282 </sect1>
283
284 <sect1>
285         <title>Starting Samba</title>
286
287       <para><indexterm>
288           <primary>daemon</primary>
289         </indexterm>
290         Samba essentially consists of two or three daemons. A daemon is a UNIX application that runs in the background and provides services.
291         An example of a service is the Apache Web server for which the daemon is called <command>httpd</command>. In the case of Samba, there
292         are three daemons, two of which are needed as a minimum.
293         </para>
294
295         <para>
296         The Samba server is made up of the following daemons:
297         </para>
298
299 <example id="ch12SL">
300 <title>A Useful Samba Control Script for SuSE Linux</title>
301 <screen>
302 #!/bin/bash
303 #
304 # Script to start/stop samba
305 # Locate this in /sbin as a file called 'samba'
306
307 RCD=/etc/rc.d
308
309 if [ z$1 == 'z' ]; then
310         echo $0 - No arguments given; must be start or stop.
311         exit
312 fi
313
314 if [ $1 == 'start' ]; then
315         ${RCD}/nmb start
316         ${RCD}/smb start
317         ${RCD}/winbind start
318
319 fi
320 if [ $1 == 'stop' ]; then
321         ${RCD}/smb stop
322         ${RCD}/winbind stop
323         ${RCD}/nmb stop
324 fi
325 if [ $1 == 'restart' ]; then
326         ${RCD}/smb stop
327         ${RCD}/winbind stop
328         ${RCD}/nmb stop
329         sleep 5
330         ${RCD}/nmb start
331         ${RCD}/smb start
332         ${RCD}/winbind start
333 fi
334 exit 0
335 </screen>
336 </example>
337
338         <variablelist>
339                 <varlistentry><term>nmbd</term>
340                         <listitem><para>
341                         <indexterm><primary>smbd</primary></indexterm>
342                         <indexterm><primary>starting samba</primary><secondary>smbd</secondary></indexterm>
343                         This daemon handles all name registration and resolution requests. It is the primary vehicle involved
344                         in network browsing. It handles all UDP-based protocols. The <command>nmbd</command> daemon should
345                         be the first command started as part of the Samba startup process.
346                         </para></listitem>
347                 </varlistentry>
348
349                 <varlistentry><term>smbd</term>
350                         <listitem><para>
351                         <indexterm><primary>nmbd</primary></indexterm>
352                         <indexterm><primary>starting samba</primary><secondary>nmbd</secondary></indexterm>
353                         This daemon handles all TCP/IP-based connection services for file- and print-based operations. It also
354                         manages local authentication. It should be started immediately following the startup of <command>nmbd</command>.
355                         </para></listitem>
356                 </varlistentry>
357
358                 <varlistentry><term>winbindd</term>
359                         <listitem><para>
360                         <indexterm><primary>winbindd</primary></indexterm>
361                         <indexterm><primary>starting samba</primary><secondary>winbindd</secondary></indexterm>
362                         This daemon should be started when Samba is a member of a Windows NT4 or ADS Domain. IT is also needed when
363                         Samba has trust relationships with another Domain. The <command>winbindd</command> daemon will check the
364                         &smb.conf; file for the presence of the <parameter>idmap uid</parameter> and <parameter>idmap gid</parameter>
365                         parameters. If they are not found, <command>winbindd</command> bails out and refuses to start.
366                         </para></listitem>
367                 </varlistentry>
368         </variablelist>
369
370         <para>
371         When Samba has been packaged by an operating system vendor, the startup process is typically a custom feature of its
372         integration into the platform as a whole. Please refer to your operating system platform administration manuals for
373         specific information pertaining to correct management of Samba startup.
374         </para>
375
376 <example id="ch12RHscript">
377 <screen>
378 #!/bin/sh
379 #
380 # chkconfig: 345 81 35
381 # description: Starts and stops the Samba smbd and nmbd daemons \
382 #              used to provide SMB network services.
383
384 # Source function library.
385 . /etc/rc.d/init.d/functions
386 # Source networking configuration.
387 . /etc/sysconfig/network
388 # Check that networking is up.
389 [ ${NETWORKING} = "no" ] &amp;&amp; exit 0
390 CONFIG=/etc/samba/smb.conf
391 # Check that smb.conf exists.
392 [ -f $CONFIG ] || exit 0
393
394 # See how we were called.
395 case "$1" in
396   start)
397         echo -n "Starting SMB services: "
398         daemon smbd -D; daemon nmbd -D; echo;
399         touch /var/lock/subsys/smb
400         ;;
401   stop)
402         echo -n "Shutting down SMB services: "
403         smbdpids=`ps guax | grep smbd | grep -v grep | awk '{print $2}'`
404         for pid in $smbdpids; do
405                 kill -TERM $pid
406         done
407         killproc nmbd -TERM; rm -f /var/lock/subsys/smb
408         echo ""
409         ;;
410   status)
411         status smbd; status nmbd;
412         ;;
413   restart)
414         echo -n "Restarting SMB services: "
415         $0 stop; $0 start;
416         echo "done."
417         ;;
418   *)
419         echo "Usage: smb {start|stop|restart|status}"
420         exit 1
421 esac
422 </screen>
423 </example>
424
425       <para><indexterm>
426           <primary>samba control script</primary>
427         </indexterm>
428         SUSE Linux implements individual control over each Samba daemon. A samba control script that can be conveniently
429         executed from the command line is shown in <link linkend="ch12SL"/>. This can be located in the directory
430         <filename>/sbin</filename> in a file called <filename>samba</filename>. This type of control script should be
431         owned by user root and group root, and set so that only root can execute it.
432         </para>
433
434       <para><indexterm>
435           <primary>startup script</primary>
436         </indexterm>
437         A sample startup script for a Red Hat Linux system is shown in <link linkend="ch12RHscript"/>.
438         This file could be located in the directory <filename>/etc/rc.d</filename> and can be called
439         <filename>samba</filename>. A similar startup script is required to control <command>winbind</command>.
440         If you want to find more information regarding startup scripts please refer to the packaging section of
441         the Samba source code distribution tarball. The packaging files for each platform include a
442         startup control file.
443         </para>
444
445 </sect1>
446
447 <sect1>
448         <title>DNS Configuration Files</title>
449
450         <para>
451         The following files are common to all DNS server configurations. Rather than repeat them multiple times, they
452         are presented here for general reference.
453         </para>
454
455         <sect2>
456         <title>The Forward Zone File for the Loopback Adaptor</title>
457
458         <para>
459         The forward zone file for the loopback address never changes. An example file is shown
460         in <link linkend="loopback"/>. All traffic destined for an IP address that is hosted on a
461         physical interface on the machine itself is routed to the loopback adaptor. This is
462         a fundamental design feature of the TCP/IP protocol implementation. The loopback adaptor
463         is called <constant>localhost</constant>.
464         </para>
465
466 <example id="loopback">
467 <title>DNS Localhost Forward Zone File: <filename>/var/lib/named/localhost.zone</filename></title>
468 <screen>
469 $TTL 1W
470 @               IN SOA  @   root (
471                                 42              ; serial
472                                 2D              ; refresh
473                                 4H              ; retry
474                                 6W              ; expiry
475                                 1W )            ; minimum
476
477                 IN NS           @
478                 IN A            127.0.0.1
479 </screen>
480 </example>
481
482         </sect2>
483
484         <sect2>
485         <title>The Reverse Zone File for the Loopback Adaptor</title>
486
487         <para>
488         The reverse zone file for the loopback address as shown in <link linkend="dnsloopy"/>
489         is necessary so that references to the address <constant>127.0.0.1</constant> can be
490         resolved to the correct name of the interface. 
491         </para>
492
493 <example id="dnsloopy">
494 <title>DNS Localhost Reverse Zone File: <filename>/var/lib/named/127.0.0.zone</filename></title>
495 <screen>
496 $TTL 1W
497 @               IN SOA          localhost.   root.localhost. (
498                                 42              ; serial
499                                 2D              ; refresh
500                                 4H              ; retry
501                                 6W              ; expiry
502                                 1W )            ; minimum
503
504                 IN NS           localhost.
505 1               IN PTR          localhost.
506 </screen>
507 </example>
508
509 <example id="roothint">
510 <title>DNS Root Name Server Hint File: <filename>/var/lib/named/root.hint</filename></title>
511 <screen>
512 ; This file is made available by InterNIC under anonymous FTP as
513 ;       file                /domain/named.root
514 ;       on server           FTP.INTERNIC.NET
515 ; last update: Nov 5, 2002. Related version of root zone: 2002110501
516 ; formerly NS.INTERNIC.NET
517 .                        3600000  IN  NS    A.ROOT-SERVERS.NET.
518 A.ROOT-SERVERS.NET.      3600000      A     198.41.0.4
519 ; formerly NS1.ISI.EDU
520 .                        3600000      NS    B.ROOT-SERVERS.NET.
521 B.ROOT-SERVERS.NET.      3600000      A     128.9.0.107
522 ; formerly C.PSI.NET
523 .                        3600000      NS    C.ROOT-SERVERS.NET.
524 C.ROOT-SERVERS.NET.      3600000      A     192.33.4.12
525 ; formerly TERP.UMD.EDU
526 .                        3600000      NS    D.ROOT-SERVERS.NET.
527 D.ROOT-SERVERS.NET.      3600000      A     128.8.10.90
528 ; formerly NS.NASA.GOV
529 .                        3600000      NS    E.ROOT-SERVERS.NET.
530 E.ROOT-SERVERS.NET.      3600000      A     192.203.230.10
531 ; formerly NS.ISC.ORG
532 .                        3600000      NS    F.ROOT-SERVERS.NET.
533 F.ROOT-SERVERS.NET.      3600000      A     192.5.5.241
534 ; formerly NS.NIC.DDN.MIL
535 .                        3600000      NS    G.ROOT-SERVERS.NET.
536 G.ROOT-SERVERS.NET.      3600000      A     192.112.36.4
537 ; formerly AOS.ARL.ARMY.MIL
538 .                        3600000      NS    H.ROOT-SERVERS.NET.
539 H.ROOT-SERVERS.NET.      3600000      A     128.63.2.53
540 ; formerly NIC.NORDU.NET
541 .                        3600000      NS    I.ROOT-SERVERS.NET.
542 I.ROOT-SERVERS.NET.      3600000      A     192.36.148.17
543 ; operated by VeriSign, Inc. 
544 .                        3600000      NS    J.ROOT-SERVERS.NET.
545 J.ROOT-SERVERS.NET.      3600000      A     192.58.128.30
546 ; housed in LINX, operated by RIPE NCC
547 .                        3600000      NS    K.ROOT-SERVERS.NET.
548 K.ROOT-SERVERS.NET.      3600000      A     193.0.14.129 
549 ; operated by IANA
550 .                        3600000      NS    L.ROOT-SERVERS.NET.
551 L.ROOT-SERVERS.NET.      3600000      A     198.32.64.12
552 ; housed in Japan, operated by WIDE
553 .                        3600000      NS    M.ROOT-SERVERS.NET.
554 M.ROOT-SERVERS.NET.      3600000      A     202.12.27.33
555 ; End of File
556 </screen>
557 </example>
558         </sect2>
559
560         <sect2>
561         <title>DNS Root Server Hint File</title>
562
563         <para>
564         The content of the root hints file as shown in <link linkend="roothint"/>  changes slowly over time. 
565         Periodically this file should be updated from the source shown. Because
566           of its size this file is located at the end of this appendix.
567         </para>
568
569         </sect2>
570
571 </sect1>
572
573 <sect1 id="altldapcfg">
574         <title>Alternative LDAP Database Initialization</title>
575
576       <para><indexterm>
577           <primary>LDAP</primary>
578           <secondary>database</secondary>
579         </indexterm><indexterm>
580           <primary>LDAP</primary>
581           <secondary>initial configuration</secondary>
582         </indexterm>
583         The following procedure may be used as an alternative means of configuring
584         the initial LDAP database. Many administrators prefer to have greater control
585         over how system files get configured.
586         </para>
587
588         <sect2>
589         <title>Initialization of the LDAP Database</title>
590
591         <para><indexterm>
592             <primary>LDIF</primary>
593           </indexterm><indexterm>
594             <primary>Domain Groups</primary>
595             <secondary>well-known</secondary>
596           </indexterm><indexterm>
597             <primary>SID</primary>
598           </indexterm>
599         The first step to get the LDAP server ready for action is to create the LDIF file from
600         which the LDAP database will be preloaded. This is necessary to create the containers
601         into which the user, group, and so on, accounts is written. It is also necessary to
602         preload the well-known Windows NT Domain Groups, as they must have the correct SID so
603         that they can be recognized as special NT Groups by the MS Windows clients.
604         </para>
605
606         <procedure id="ldapinit">
607                 <step><para>
608                 Create a directory in which to store the files you use to generate
609                 the LDAP LDIF file for your system. Execute the following:
610 <screen>
611 &rootprompt; mkdir /etc/openldap/SambaInit
612 &rootprompt; chown root.root /etc/openldap/SambaInit
613 &rootprompt; chmod 700 /etc/openldap/SambaInit
614 </screen>
615                 </para></step>
616
617                 <step><para>
618                 Install the files shown in <link linkend="ch6-ldapreconfa"/>, <link linkend="ch6-ldapreconfb"/>,
619                 and <link linkend="ch6-ldapreconfc"/> into the directory 
620                 <filename>/etc/openldap/SambaInit/SMBLDAP-ldif-preconfig.sh.</filename> These three files are,
621                 respectively, Part A, B, and C of the <filename>SMBLDAP-ldif-preconfig.sh</filename> file.
622                 </para></step>
623
624                 <step><para>
625                 Install the files shown in <link linkend="ch6-ldifpata"/> and <link linkend="ch6-ldifpatb"/> into the directory
626                 <filename>/etc/openldap/SambaInit/nit-ldif.pat.</filename> These two files are
627                 Part A and B, respectively, of the <filename>init-ldif.pat</filename> file.
628                 </para></step>
629
630                 <step><para>
631                 Change to the <filename>/etc/openldap/SambaInit</filename> directory. Execute the following:
632 <screen>
633 &rootprompt; ./SMBLDAP-ldif-preconfig.sh
634
635 How do you wish to refer to your organization?
636 Suggestions:
637         Black Tire Company, Inc.
638         Cat With Hat Ltd.
639 How would you like your organization name to appear?
640 Your organization name is: My Organization
641 Enter a new name is this is not what you want, press Enter to Continue.
642 Name [My Organization]: Abmas Inc.
643
644 Samba Config File Location [/etc/samba/smb.conf]:
645 Enter a new full path or press Enter to continue.
646 Samba Config File Location [/etc/samba/smb.conf]:
647 Domain Name: MEGANET2
648 Domain SID: S-1-5-21-3504140859-1010554828-2431957765
649
650 The name of your Internet domain is now needed in a special format
651 as follows, if your domain name is mydomain.org, what we need is
652 the information in the form of:
653         Domain ID: mydomain
654         Top level: org
655 If your fully qualified hostname is: snoopy.bazaar.garagesale.net
656 where "snoopy" is the name of the machine,
657 Then the information needed is:
658         Domain ID: garagesale
659         Top Level: net
660
661 Found the following domain name: abmas.biz
662 I think the bit we are looking for might be: abmas
663 Enter the domain name or press Enter to continue:
664
665 The top level organization name I will use is: biz
666 Enter the top level org name or press Enter to continue:
667 &rootprompt;
668 </screen>
669                 This creates a file called <filename>MEGANET2.ldif</filename>.
670                 </para></step>
671
672                 <step><para>
673                 It is now time to preload the LDAP database with the following
674                 command:
675 <screen>
676 &rootprompt; slapadd -v -l MEGANET2.ldif
677 added: "dc=abmas,dc=biz" (00000001)
678 added: "cn=Manager,dc=abmas,dc=biz" (00000002)
679 added: "ou=People,dc=abmas,dc=biz" (00000003)
680 added: "ou=Computers,dc=abmas,dc=biz" (00000004)
681 added: "ou=Groups,dc=abmas,dc=biz" (00000005)
682 added: "ou=Domains,dc=abmas,dc=biz" (00000006)
683 added: "sambaDomainName=MEGANET2,ou=Domains,dc=abmas,dc=biz" (00000007)
684 added: "cn=domadmins,ou=Groups,dc=abmas,dc=biz" (00000008)
685 added: "cn=domguests,ou=Groups,dc=abmas,dc=biz" (00000009)
686 added: "cn=domusers,ou=Groups,dc=abmas,dc=biz" (0000000a)
687 </screen>
688                 You should verify that the account information was correctly loaded by executing:
689 <screen>
690 &rootprompt; slapcat
691 dn: dc=abmas,dc=biz
692 objectClass: dcObject
693 objectClass: organization
694 dc: abmas
695 o: Abmas Inc.
696 description: Posix and Samba LDAP Identity Database
697 structuralObjectClass: organization
698 entryUUID: af552f8e-c4a1-1027-9002-9421e01bf474
699 creatorsName: cn=manager,dc=abmas,dc=biz
700 modifiersName: cn=manager,dc=abmas,dc=biz
701 createTimestamp: 20031217055747Z
702 modifyTimestamp: 20031217055747Z
703 entryCSN: 2003121705:57:47Z#0x0001#0#0000
704 ...
705
706 dn: cn=domusers,ou=Groups,dc=abmas,dc=biz
707 objectClass: posixGroup
708 objectClass: sambaGroupMapping
709 gidNumber: 513
710 cn: domusers
711 sambaSID: S-1-5-21-3504140859-1010554828-2431957765-513
712 sambaGroupType: 2
713 displayName: Domain Users
714 description: Domain Users
715 structuralObjectClass: posixGroup
716 entryUUID: af7e98ba-c4a1-1027-900b-9421e01bf474
717 creatorsName: cn=manager,dc=abmas,dc=biz
718 modifiersName: cn=manager,dc=abmas,dc=biz
719 createTimestamp: 20031217055747Z
720 modifyTimestamp: 20031217055747Z
721 entryCSN: 2003121705:57:47Z#0x000a#0#0000
722 </screen>
723                 </para></step>
724
725                 <step><para>
726                 Your LDAP database is ready for testing. You can now start the LDAP server
727                 using the system tool for your Linux operating system. For SUSE Linux, you can
728                 do this as follows:
729 <screen>
730 &rootprompt; rcldap start
731 </screen>
732                 </para></step>
733
734                 <step><para>
735                 It is now a good idea to validate that the LDAP server is running correctly.
736                 Execute the following:
737 <screen>
738 &rootprompt; ldapsearch -x -b "dc=abmas,dc=biz" "(ObjectClass=*)"
739 # extended LDIF
740 #
741 # LDAPv3
742 # base &lt;dc=abmas,dc=biz&gt; with scope sub
743 # filter: (ObjectClass=*)
744 # requesting: ALL
745 #
746
747 # abmas.biz
748 dn: dc=abmas,dc=biz
749 objectClass: dcObject
750 objectClass: organization
751 dc: abmas
752 o: Abmas Inc.
753 description: Posix and Samba LDAP Identity Database
754 ...
755 # domusers, Groups, abmas.biz
756 dn: cn=domusers,ou=Groups,dc=abmas,dc=biz
757 objectClass: posixGroup
758 objectClass: sambaGroupMapping
759 gidNumber: 513
760 cn: domusers
761 sambaSID: S-1-5-21-3504140859-1010554828-2431957765-513
762 sambaGroupType: 2
763 displayName: Domain Users
764 description: Domain Users
765
766 # search result
767 search: 2
768 result: 0 Success
769
770 # numResponses: 11
771 # numEntries: 10
772 </screen>
773                 Your LDAP server is ready for creation of additional accounts.
774                 </para></step>
775         </procedure>
776
777         </sect2>
778
779 <example id="ch6-ldapreconfa">
780 <title>LDAP Pre-configuration Script: <filename>SMBLDAP-ldif-preconfig.sh</filename> &smbmdash; Part A</title>
781 <screen>
782 #!/bin/bash
783 #
784 # This script prepares the ldif LDAP load file only
785 #
786
787 # Pattern File Name
788 file=init-ldif.pat
789
790 # The name of my organization
791 ORGNAME="My Organization"
792
793 # My Internet domain. ie: if my domain is: buckets.org, INETDOMAIN="buckets"
794 INETDOMAIN="my-domain"
795
796 # In the above case, md domain is: buckets.org, TLDORG="org"
797 TLDORG="org"
798
799 # This is the Samba Domain/Workgroup Name
800 DOMNAME="MYWORKGROUP"
801
802 #
803 # Here We Go ...
804 #
805
806 cat &lt;&lt;EOF
807
808 How do you wish to refer to your organization?
809
810 Suggestions:
811         Black Tire Company, Inc.
812         Cat With Hat Ltd.
813
814 How would you like your organization name to appear?
815
816 EOF
817
818 echo "Your organization name is: $ORGNAME"
819 echo
820 echo "Enter a new name or, press Enter to Continue."
821 echo
822 </screen>
823 </example>
824
825 <example id="ch6-ldapreconfb">
826 <title>LDAP Pre-configuration Script: <filename>SMBLDAP-ldif-preconfig.sh</filename> &smbmdash; Part B</title>
827 <screen>
828 echo -e -n "Name [$ORGNAME]: "
829         read name
830
831 if [ ! -z "$name" ]; then 
832         ORGNAME=${name}
833 fi
834 echo
835 sed "s/ORGNAME/${ORGNAME}/g" &lt; $file &gt; $file.tmp1
836
837 # Try to find smb.conf
838
839 if [ -e /usr/local/samba/lib/smb.conf ]; then
840         CONF=/usr/local/samba/lib/smb.conf
841 elif [ -e /etc/samba/smb.conf ]; then
842         CONF=/etc/samba/smb.conf
843 fi
844
845 echo "Samba Config File Location [$CONF]: "
846 echo
847 echo "Enter a new full path or press Enter to continue."
848 echo
849 echo -n "Samba Config File Location [$CONF]: "
850         read name
851 if [ ! -z "$name" ]; then
852         CONF=$name
853 fi
854 echo
855
856 # Find the name of our Domain/Workgroup
857 DOMNAME=`grep -i workgroup ${CONF} | sed "s/ //g" | cut -f2 -d=`
858 echo Domain Name: $DOMNAME
859 echo
860
861 sed "s/DOMNAME/${DOMNAME}/g" &lt; $file.tmp1 &gt; $file.tmp2
862
863 DOMSID=`net getlocalsid ${DOMNAME} | cut -f2 -d: | sed "s/ //g"`
864 echo Domain SID: $DOMSID
865
866 sed "s/DOMSID/${DOMSID}/g" &lt; $file.tmp2 &gt; $file.tmp1
867 </screen>
868 </example>
869
870 <example id="ch6-ldapreconfc">
871 <title>LDAP Pre-configuration Script: <filename>SMBLDAP-ldif-preconfig.sh</filename> &smbmdash; Part C</title>
872 <screen>
873 cat &gt;&gt;EOL
874 The name of your Internet domain is now needed in a special format
875 as follows, if your domain name is mydomain.org, what we need is
876 the information in the form of:
877         Domain ID: mydomain
878         Top level: org
879
880 If your fully qualified hostname is: snoopy.bazaar.garagesale.net
881 where "snoopy" is the name of the machine,
882 Then the information needed is:
883         Domain ID: garagesale
884         Top Level: net
885
886 EOL
887 INETDOMAIN=`hostname -d | cut -f1 -d.`
888 echo Found the following domain name: `hostname -d`
889 echo "I think the bit we are looking for might be: $INETDOMAIN"
890 echo
891 echo -n "Enter the domain name or press Enter to continue: "
892         read domnam
893 if [ ! -z $domnam ]; then
894         INETDOMAIN=$domnam
895 fi
896 echo
897 sed "s/INETDOMAIN/${INETDOMAIN}/g" &lt; $file.tmp1 &gt; $file.tmp2
898 TLDORG=`hostname -d | sed "s/${INETDOMAIN}.//g"`
899 echo "The top level organization name I will use is: ${TLDORG}"
900 echo
901 echo -n "Enter the top level org name or press Enter to continue: "
902         read domnam
903 if [ ! -z $domnam ]; then
904         TLDORG=$domnam
905 fi
906 sed "s/TLDORG/${TLDORG}/g" &lt; $file.tmp2 &gt; $DOMNAME.ldif
907 rm $file.tmp*
908 exit 0
909 </screen>
910 </example>
911
912 <example id="ch6-ldifpata">
913 <title>LDIF Pattern File Used to Pre-configure LDAP &smbmdash; Part A</title>
914 <screen>
915 dn: dc=INETDOMAIN,dc=TLDORG
916 objectClass: dcObject
917 objectClass: organization
918 dc: INETDOMAIN
919 o: ORGNAME
920 description: Posix and Samba LDAP Identity Database
921
922 dn: cn=Manager,dc=INETDOMAIN,dc=TLDORG
923 objectClass: organizationalRole
924 cn: Manager
925 description: Directory Manager
926
927 dn: ou=People,dc=INETDOMAIN,dc=TLDORG
928 objectClass: top
929 objectClass: organizationalUnit
930 ou: People
931
932 dn: ou=Computers,dc=INETDOMAIN,dc=TLDORG
933 objectClass: top
934 objectClass: organizationalUnit
935 ou: Computers
936
937 dn: ou=Groups,dc=INETDOMAIN,dc=TLDORG
938 objectClass: top
939 objectClass: organizationalUnit
940 ou: Groups
941
942 dn: ou=Idmap,dc=INETDOMAIN,dc=TLDORG
943 objectClass: top
944 objectClass: organizationalUnit
945 ou: Idmap
946
947 dn: sambaDomainName=DOMNAME,ou=Domains,dc=INETDOMAIN,dc=TLDORG
948 objectClass: sambaDomain
949 sambaDomainName: DOMNAME
950 sambaSID: DOMSID
951 sambaAlgorithmicRidBase: 1000
952 structuralObjectClass: sambaDomain
953 </screen>
954 </example>
955
956 <example id="ch6-ldifpatb">
957 <title>LDIF Pattern File Used to Pre-configure LDAP &smbmdash; Part B</title>
958 <screen>
959 dn: cn=domadmins,ou=Groups,dc=INETDOMAIN,dc=TLDORG
960 objectClass: posixGroup
961 objectClass: sambaGroupMapping
962 gidNumber: 512
963 cn: domadmins
964 sambaSID: DOMSID-512
965 sambaGroupType: 2
966 displayName: Domain Admins
967 description: Domain Administrators
968
969 dn: cn=domguests,ou=Groups,dc=INETDOMAIN,dc=TLDORG
970 objectClass: posixGroup
971 objectClass: sambaGroupMapping
972 gidNumber: 514
973 cn: domguests
974 sambaSID: DOMSID-514
975 sambaGroupType: 2
976 displayName: Domain Guests
977 description: Domain Guests Users
978
979 dn: cn=domusers,ou=Groups,dc=INETDOMAIN,dc=TLDORG
980 objectClass: posixGroup
981 objectClass: sambaGroupMapping
982 gidNumber: 513
983 cn: domusers
984 sambaSID: DOMSID-513
985 sambaGroupType: 2
986 displayName: Domain Users
987 description: Domain Users
988 </screen>
989 </example>
990
991 </sect1>
992
993 <sect1>
994 <title>The LDAP Account Manager</title>
995
996       <para><indexterm>
997           <primary>LAM</primary>
998         </indexterm><indexterm>
999           <primary>LDAP Account Manager</primary>
1000           <see>LAM</see>
1001         </indexterm><indexterm>
1002           <primary>PHP</primary>
1003         </indexterm><indexterm>
1004           <primary>unencrypted</primary>
1005         </indexterm><indexterm>
1006           <primary>SSL</primary>
1007         </indexterm><indexterm>
1008           <primary>Posix</primary>
1009         </indexterm><indexterm>
1010           <primary>accounts</primary><secondary>manage</secondary>
1011         </indexterm>
1012 The LDAP Account Manager (LAM) is an application suite that has been written in PHP.
1013 LAM can be used with any Web server that has PHP4 support. It connects to the LDAP
1014 server either using unencrypted connections or via SSL. LAM can be used to manage
1015 Posix accounts as well as SambaSAMAccounts for users, groups, and Windows machines
1016 (hosts).
1017 </para>
1018
1019 <para>
1020 LAM is available from the <ulink url="http://sourceforge.net/projects/lam/">LAM</ulink>
1021 home page and from its mirror sites. LAM has been released under the GNU GPL version 2.
1022 The current version of LAM is 0.4.3. Release of version 0.5 is expected some time early
1023 in 2004.
1024 </para>
1025
1026       <para><indexterm>
1027           <primary>PHP4</primary>
1028         </indexterm><indexterm>
1029           <primary>OpenLDAP</primary>
1030         </indexterm><indexterm>
1031           <primary>Perl</primary>
1032         </indexterm>
1033 Requirements:
1034 </para>
1035
1036 <itemizedlist>
1037         <listitem><para>A web server that will work with PHP4.</para></listitem>
1038         <listitem><para>PHP4 (available from the <ulink url="http://www.php.net/">
1039         PHP</ulink> home page.)</para></listitem>
1040         <listitem><para>OpenLDAP 2.0 or later.</para></listitem>
1041         <listitem><para>A Web browser that supports CSS.</para></listitem>
1042         <listitem><para>Perl.</para></listitem>
1043         <listitem><para>The gettext package.</para></listitem>
1044         <listitem><para>mcrypt + mhash (optional since version 0.4.3).</para></listitem>
1045         <listitem><para>It is also a good idea to install SSL support.</para></listitem>
1046 </itemizedlist>
1047
1048 <para>
1049 LAM is a useful tool that provides a simple Web-based device that can be used to
1050         manage the contents of the LDAP directory to:<indexterm>
1051           <primary>organizational units</primary>
1052         </indexterm><indexterm>
1053           <primary>operating profiles</primary>
1054         </indexterm><indexterm>
1055           <primary>account policies</primary>
1056         </indexterm>
1057 </para>
1058
1059 <itemizedlist>
1060         <listitem><para>Display user/group/host and Domain entries.</para></listitem>
1061         <listitem><para>Manages entries (Add/Delete/Edit).</para></listitem>
1062         <listitem><para>Filter and sort entries.</para></listitem>
1063         <listitem><para>Set LAM administrator accounts.</para></listitem>
1064         <listitem><para>Store and use multiple operating profiles.</para></listitem>
1065         <listitem><para>Edit organizational units (OUs).</para></listitem>
1066         <listitem><para>Upload accounts from a file.</para></listitem>
1067         <listitem><para></para>Is compatible with Samba-2.2.x and Samba-3.</listitem>
1068 </itemizedlist>
1069
1070 <para>
1071 When correctly configured, LAM allows convenient management of UNIX (Posix) and Samba
1072 user, group, and windows domain member machine accounts.
1073 </para>
1074
1075       <para><indexterm>
1076           <primary>default password</primary>
1077         </indexterm><indexterm>
1078           <primary>secure connections</primary>
1079         </indexterm><indexterm>
1080           <primary>LAM</primary>
1081         </indexterm><indexterm>
1082           <primary>SSL</primary>
1083         </indexterm>
1084 The default password is <quote>lam.</quote> It is highly recommended that you use only 
1085 an SSL connection to your Web server for all remote operations involving LAM. If you 
1086 want secure connections, you must configure your Apache Web server to permit connections 
1087 to LAM using only SSL.
1088 </para>
1089
1090 <procedure id="ch6-laminst">
1091         <step><para>
1092         Extract the LAM package with:
1093 <screen>
1094 &rootprompt; tar xzf ldap-account-manager_0.4.3.tar.gz
1095 </screen>
1096 Alternately, install the LAM RPM for your system using the following example for
1097 example:
1098 <screen>
1099 &rootprompt; rpm -Uvh ldap-account-manager-0.4.3-1.noarch.rpm
1100 </screen>
1101         </para></step>
1102         
1103         <step><para>
1104         Copy the extracted files to the document root directory of your Web server.
1105         For example, on SuSE Linux Enterprise Server 8, copy to the 
1106         <filename>/srv/web/htdocs</filename> directory.
1107         </para></step>
1108
1109         <step><para><indexterm>
1110               <primary>file permissions</primary>
1111             </indexterm>
1112         Set file permissions using the following commands:
1113 <screen>
1114 &rootprompt; chown -R wwwrun.www /srv/www/htdocs/lam
1115 &rootprompt; chmod 755 /srv/www/htdocs/lam/sess
1116 &rootprompt; chmod 755 /srv/www/htdocs/lam/tmp
1117 &rootprompt; chmod 755 /srv/www/htdocs/lam/config
1118 &rootprompt; chmod 755 /srv/www/htdocs/lam/lib/*pl
1119 </screen>
1120         </para></step>
1121
1122         <step><para><indexterm>
1123               <primary>LAM</primary>
1124               <secondary>configuration file</secondary>
1125             </indexterm>
1126        Using your favorite editor create the following <filename>config.cfg</filename>
1127        LAM configuration file:
1128 <screen>
1129 &rootprompt; cd /srv/www/htdocs/lam/config
1130 &rootprompt; cp config.cfg_sample config.cfg
1131 &rootprompt; vi config.cfg
1132             </screen><indexterm>
1133               <primary>LAM</primary>
1134               <secondary>profile</secondary>
1135             </indexterm><indexterm>
1136               <primary>LAM</primary>
1137               <secondary>wizard</secondary>
1138             </indexterm>
1139         An example file is shown in <link linkend="lamcfg"/>.
1140         This is the minimum configuration that must be completed. The LAM profile
1141         file can be created using a convenient wizard that is part of the LAM
1142         configuration suite.
1143         </para></step>
1144
1145         <step><para>
1146         Start your Web server then, using your Web browser, connect to 
1147         <ulink url="http://localhost/lam">LAM</ulink> URL. Click on the
1148         the <parameter>Configuration Login</parameter> link then click on the
1149         Configuration Wizard link to begin creation of the default profile so that 
1150         LAM can connect to your LDAP server. Alternately, copy the 
1151         <filename>lam.conf_sample</filename> file to a file called 
1152         <filename>lam.conf</filename> then, using your favorite editor, 
1153         change the settings to match local site needs.
1154         </para></step>
1155 </procedure>
1156
1157       <para><indexterm>
1158           <primary>pitfalls</primary>
1159         </indexterm>
1160         An example of a working file is shown here in <link linkend="lamconf"/>.
1161         This file has been stripped of comments to keep the size small. The comments
1162         and help information provided in the profile file that the wizard creates
1163         is very useful and will help many administrators to avoid pitfalls.
1164         Your configuration file obviously reflects the configuration options that
1165         are preferred at your site.
1166         </para>
1167
1168       <para><indexterm>
1169           <primary>LAM</primary>
1170           <secondary>login screen</secondary>
1171         </indexterm>
1172         It is important that your LDAP server is running at the time that LAM is 
1173         being configured. This permits you to validate correct operation.
1174         An example of the LAM login screen is provided in <link linkend="lam-login"/>.
1175         </para>
1176
1177         <image id="lam-login">
1178                 <imagedescription>The LDAP Account Manager Login Screen</imagedescription>
1179                 <imagefile scale="50">lam-login</imagefile>
1180         </image>
1181
1182       <para><indexterm>
1183           <primary>LAM</primary>
1184           <secondary>configuration editor</secondary>
1185         </indexterm>
1186         The LAM configuration editor has a number of options that must be managed correctly.
1187         An example of use of the LAM configuration editor is shown in <link linkend="lam-config"/>.
1188         It is important that you correctly set the minimum and maximum UID/GID values that are
1189         permitted for use at your site. The default values may not be compatible with a need to
1190         modify initial default account values for well-known Windows network users and groups.
1191         The best work-around is to temporarily set the minimum values to zero (0) to permit
1192         the initial settings to be made. Do not forget to reset these to sensible values before
1193         using LAM to add additional users and groups.
1194         </para>
1195
1196         <image id="lam-config">
1197                 <imagedescription>The LDAP Account Manager Configuration Screen</imagedescription>
1198                 <imagefile scale="50">lam-config</imagefile>
1199         </image>
1200
1201       <para><indexterm>
1202           <primary>PDF</primary>
1203         </indexterm>
1204         LAM has some nice, but unusual features. For example, one unexpected feature in most application
1205         screens permits the generation of a PDF file that lists configuration information. This is a well
1206         thought out facility. This option has been edited out of the following screen shots to conserve
1207         space.
1208         </para>
1209
1210       <para><indexterm>
1211           <primary>LAM</primary>
1212           <secondary>opening screen</secondary>
1213         </indexterm>
1214         When you log onto LAM the opening screen drops you right into the user manager as shown in
1215         <link linkend="lam-user"/>. This is a logical action as it permits the most-needed facility
1216         to be used immediately. The editing of an existing user, as with the addition of a new user,
1217         is easy to follow and very clear in both layout and intent. It is a simple matter to edit
1218         generic settings, UNIX specific parameters, and then Samba account requirements. Each step
1219         involves clicking a button that intuitively drives you through the process. When you have
1220         finished editing simply press the <guimenu>Final</guimenu> button.
1221         </para>
1222
1223         <image id="lam-user">
1224                 <imagedescription>The LDAP Account Manager User Edit Screen</imagedescription>
1225                 <imagefile scale="50">lam-users</imagefile>
1226         </image>
1227
1228         <para>
1229         The edit screen for groups is shown in <link linkend="lam-group"/>. As with the edit screen
1230         for user accounts, group accounts may be rapidly dealt with. <link linkend="lam-group-mem"/>
1231         shown a sub-screen from the group editor that permits users to be assigned secondary group
1232         memberships. 
1233         </para>
1234
1235         <image id="lam-group">
1236                 <imagedescription>The LDAP Account Manager Group Edit Screen</imagedescription>
1237                 <imagefile scale="50">lam-groups</imagefile>
1238         </image>
1239
1240         <image id="lam-group-mem">
1241                 <imagedescription>The LDAP Account Manager Group Membership Edit Screen</imagedescription>
1242                 <imagefile scale="50">lam-group-members</imagefile>
1243         </image>
1244
1245       <para><indexterm>
1246           <primary>smbldap-tools</primary>
1247         </indexterm><indexterm>
1248           <primary>scripts</primary>
1249         </indexterm>
1250         The final screen presented here is one that you should not normally need to use. Host accounts will
1251         be automatically managed using the smbldap-tools scripts. This means that the screen <link linkend="lam-host"/>
1252         will, in most cases, not be used.
1253         </para>
1254
1255         <image id="lam-host">
1256                 <imagedescription>The LDAP Account Manager Host Edit Screen</imagedescription>
1257                 <imagefile scale="50">lam-hosts</imagefile>
1258         </image>
1259
1260         <para>
1261         One aspect of LAM that may annoy some users is the way it forces certain conventions on
1262         the administrator. For example, LAM does not permit the creation of Windows user and group
1263         accounts that contain upper-case characters or spaces even though the underlying UNIX/Linux
1264         operating system may exhibit no problems with them. Given the propensity for using upper-case
1265         characters and spaces (particularly in the default Windows account names) this may cause
1266         some annoyance. For the rest, LAM is a very useful administrative tool.
1267         </para>
1268
1269 <example id="lamcfg">
1270 <title>Example LAM Configuration File &smbmdash; <filename>config.cfg</filename></title>
1271 <screen>
1272 # password to add/delete/rename configuration profiles
1273 password: not24get
1274
1275 # default profile, without ".conf"
1276 default: lam
1277 </screen>
1278 </example>
1279
1280 <example id="lamconf">
1281 <title>LAM Profile Control File &smbmdash; <filename>lam.conf</filename></title>
1282 <screen>
1283 ServerURL: ldap://massive.abmas.org:389
1284 Admins: cn=Manager,dc=abmas,dc=biz
1285 Passwd: not24get
1286 usersuffix: ou=People,dc=abmas,dc=biz
1287 groupsuffix: ou=Groups,dc=abmas,dc=biz
1288 hostsuffix: ou=Computers,dc=abmas,dc=biz
1289 domainsuffix: ou=Domains,dc=abmas,dc=biz
1290 MinUID: 0
1291 MaxUID: 65535
1292 MinGID: 0
1293 MaxGID: 65535
1294 MinMachine: 20000
1295 MaxMachine: 25000
1296 userlistAttributes: #uid;#givenName;#sn;#uidNumber;#gidNumber
1297 grouplistAttributes: #cn;#gidNumber;#memberUID;#description
1298 hostlistAttributes: #cn;#description;#uidNumber;#gidNumber
1299 maxlistentries: 30
1300 defaultLanguage: en_GB:ISO-8859-1:English (Britain)
1301 scriptPath: 
1302 scriptServer: 
1303 samba3: yes
1304 cachetimeout: 5
1305 pwdhash: SSHA
1306 </screen>
1307 </example>
1308
1309 </sect1>
1310
1311 <sect1 id="ch12-SUIDSGID">
1312         <title>Effect of Setting File and Directory SUID/SGID Permissions Explained</title>
1313
1314         <indexterm><primary>SUID</primary></indexterm>
1315         <indexterm><primary>SGID</primary></indexterm>
1316         <para>
1317         The setting of the SUID/SGID bits on the file or directory permissions flag has particular
1318         consequences. If the file is executable and the SUID bit is set, it executes with the privilege
1319         of (with the UID of) the owner of the file. For example, if you are logged onto a system as
1320         a normal user (let's say as the user <constant>bobj</constant>), and you execute a file that is owned
1321         by the user <constant>root</constant> (uid = 0), and the file has the SUID bit set, then the file is
1322         executed as if you had logged in as the user <constant>root</constant> and then executed the file.
1323         The SUID bit effectively gives you (as <constant>bobj</constant>) administrative privilege for the
1324         use of that executable file.
1325         </para>
1326
1327         <para>
1328         The setting of the SGID bit does precisely the same as the effect of the SUID bit, except that it
1329         applies the privilege to the UNIX group setting. In other words, the file executes with the force
1330         of capability of the group.
1331         </para>
1332
1333         <para>
1334         When the SUID/SGID permissions are set on a directory, all files that are created within that directory
1335         is automatically given the ownership of the SUID user and the SGID group, as per the ownership
1336         of the directory in which the file is created. This means that the system level <command>create()</command>
1337         function executes with the SUID user and/or SGID group of the directory in which the file is
1338         created.
1339         </para>
1340
1341         <para>
1342         If you want to obtain the SUID behavior, simply execute the following command:
1343 <screen>
1344 &rootprompt; chmod u+s file-or-directory
1345 </screen>
1346         To set the SGID properties on a file or a directory, execute this command:
1347 <screen>
1348 &rootprompt; chmod g+s file-or-directory
1349 </screen>
1350         And to set both SUID and SGID properties, execute the following:
1351 <screen>
1352 &rootprompt; chmod ug+s file-or-directory
1353 </screen>
1354         </para>
1355
1356         <para>
1357         Let's consider the example of a directory <filename>/data/accounts</filename>. The permissions on this
1358         directory before setting both SUID and SGID on this directory are:
1359 <screen>
1360 &rootprompt; ls -al /data/accounts
1361 total 1
1362 drwxr-xr-x   10 root     root          232 Dec 18 17:08 .
1363 drwxr-xr-x   21 root     root          600 Dec 17 23:15 ..
1364 drwxrwxrwx    2 bobj     Domain Users  48 Dec 18 17:08 accounts/
1365 drwx------    2 root     root           48 Jan 26  2002 lost+found
1366 </screen>
1367         In this example, if the user <constant>maryv</constant> creates a file, it would be owned by her.
1368         If <constant>maryv</constant> has the primary group of <constant>Accounts</constant>, the file is
1369         owned by the group <constant>Accounts</constant> as shown in this listing:
1370 <screen>
1371 &rootprompt; ls -al /data/accounts/maryvfile.txt
1372 drw-rw-r--    2 maryv    Accounts     12346 Dec 18 17:53
1373 </screen>
1374         </para>
1375
1376         <para>
1377         Now you set the SUID and SGID and check the result as follows:
1378 <screen>
1379 &rootprompt; chmod ug+s /data/accounts
1380 &rootprompt; ls -al /data/accounts
1381 total 1
1382 drwxr-xr-x   10 root     root          232 Dec 18 17:08 .
1383 drwxr-xr-x   21 root     root          600 Dec 17 23:15 ..
1384 drwsrwsr-x    2 bobj     Domain Users  48 Dec 18 17:08 accounts
1385 drwx------    2 root     root           48 Jan 26  2002 lost+found
1386 </screen>
1387         If <constant>maryv</constant> creates a file in this directory after this change has been made, the
1388         file is owned by the user <constant>bobj</constant>, and the group is set to the group
1389         <constant>Domain Users</constant> as shown here:
1390 <screen>
1391 &rootprompt; chmod ug+s /data/accounts
1392 &rootprompt; ls -al /data/accounts/maryvfile.txt
1393 total 1
1394 drw-rw-r--    2 bobj     Domain Users  12346 Dec 18 18:11 maryvfile.txt
1395 </screen>
1396         </para>
1397
1398 </sect1>
1399
1400 <sect1 id="ch12dblck">
1401         <title>Shared Data Integrity</title>
1402
1403       <para><indexterm>
1404           <primary>data integrity</primary>
1405         </indexterm><indexterm>
1406           <primary>multi-user</primary>
1407           <secondary>data access</secondary>
1408         </indexterm>
1409         The integrity of shared data is often viewed as a particularly emotional issue, especially where
1410         there are concurrent problems with multi-user data access. Contrary to the assertions of some who have
1411         experienced problems in either area, the cause has nothing to do with the phases of the moons of Jupiter.
1412         </para>
1413
1414         <para>
1415         The solution to concurrent multi-user data access problems must consider three separate areas
1416         from which the problem may stem:<indexterm>
1417           <primary>locking</primary>
1418           <secondary>Application level</secondary>
1419         </indexterm><indexterm>
1420           <primary>locking</primary>
1421           <secondary>Client side</secondary>
1422         </indexterm><indexterm>
1423           <primary>locking</primary>
1424           <secondary>Server side</secondary>
1425         </indexterm>
1426         </para>
1427
1428         <itemizedlist>
1429                 <listitem><para>application level locking controls.</para></listitem>
1430                 <listitem><para>client side locking controls.</para></listitem>
1431                 <listitem><para>server side locking controls.</para></listitem>
1432         </itemizedlist>
1433
1434       <para><indexterm>
1435           <primary>database applications</primary>
1436         </indexterm><indexterm>
1437           <primary>Microsoft Access</primary>
1438         </indexterm>
1439         Many database applications use some form of application-level access control. An example of one
1440         well-known application that uses application-level locking is Microsoft Access. Detailed guidance
1441         is provided given that this is the most common application for which problems have been reported.
1442         </para>
1443
1444       <para><indexterm>
1445           <primary>Microsoft Excel</primary>
1446         </indexterm><indexterm>
1447           <primary>Act!</primary>
1448         </indexterm>
1449         Common applications that are affected by client- and server-side locking controls include MS
1450         Excel and Act!. Important locking guidance is provided here.
1451         </para>
1452
1453
1454         <sect2>
1455         <title>Microsoft Access</title>
1456
1457         <para>
1458         The best advice that can be given is to carefully read the Microsoft knowledge base articles that
1459         cover this area. Examples of relevant documents includes:
1460         </para>
1461
1462         <itemizedlist>
1463         <listitem><para>http://support.microsoft.com/default.aspx?scid=kb;en-us;208778</para></listitem>
1464         <listitem><para>http://support.microsoft.com/default.aspx?scid=kb;en-us;299373</para></listitem>
1465         </itemizedlist>
1466
1467
1468         <para><indexterm>
1469             <primary>multi-user</primary>
1470             <secondary>access</secondary>
1471           </indexterm><indexterm>
1472             <primary>exclusive open</primary>
1473           </indexterm>
1474         Make sure that your MS Access database file is configured for multi-user access (not set for 
1475         exclusive open). Open MS Access on each client workstation then set the following: <menuchoice>
1476         <guimenu>(Menu bar) Tools</guimenu><guimenu>Options</guimenu><guimenu>[tab] General</guimenu>
1477         </menuchoice>.  Set network path to Default database folder: <filename>\\server\share\folder</filename>.
1478         </para>
1479
1480         <para>
1481         You can configure MS Access file sharing behavior as follows: click <guimenu>[tab] Advanced</guimenu>.
1482           Set:<indexterm>
1483             <primary>record locking</primary>
1484           </indexterm>
1485         </para>
1486
1487         <itemizedlist>
1488                 <listitem><para>Default open mode: Shared</para></listitem>
1489                 <listitem><para>Default Record Locking: Edited Record</para></listitem>
1490                 <listitem><para>Open databases using record_level locking</para></listitem>
1491         </itemizedlist>
1492
1493         <para><indexterm>
1494             <primary>MS Access</primary>
1495             <secondary>validate</secondary>
1496           </indexterm>
1497         You must now commit the changes so that they will take effect. To do so, click 
1498         <guimenu>Apply</guimenu><guimenu>Ok</guimenu>. At this point, you should exit MS Access, restart 
1499         it and then validate that these settings have not changed.
1500         </para>
1501
1502         </sect2>
1503
1504         <sect2>
1505         <title>Act! Database Sharing</title>
1506
1507         <para><indexterm>
1508             <primary>ACT! database</primary>
1509           </indexterm><indexterm>
1510             <primary>data corruption</primary>
1511           </indexterm>
1512         Where the server sharing the ACT! database(s) is running Samba, Windows NT, 200x or XP, you 
1513         must disable opportunistic locking on the server and all workstations. Failure to do so
1514         results in data corruption. This information is available from the Act! Web site
1515         knowledge-base articles 
1516         <ulink url="http://itdomino.saleslogix.com/act.nsf/docid/1998223162925">1998223162925</ulink>
1517         as well as from article
1518         <ulink url="http://itdomino.saleslogix.com/act.nsf/docid/200110485036">200110485036</ulink>.
1519         </para>
1520
1521         <para><indexterm>
1522             <primary>opportunistic locking</primary>
1523           </indexterm><indexterm>
1524             <primary>Act!Diag</primary>
1525           </indexterm>
1526         These documents clearly state that opportunistic locking must be disabled on both
1527         the server (Samba in the case we are interested in here), as well as on every workstation
1528         from which the centrally shared Act! database will be accessed. Act! provides
1529         a tool called <command>Act!Diag</command> that may be used to disable all workstation
1530         registry settings that may otherwise interfere with the operation of Act! 
1531         Registered Act! users may download this utility from the Act! Web 
1532         <ulink url="http://www.act.com/support/updates/index.cfm">site.</ulink>
1533         </para>
1534
1535         </sect2>
1536
1537         <sect2>
1538         <title>Opportunistic Locking Controls</title>
1539
1540         <para><indexterm>
1541             <primary>file cacheing</primary>
1542           </indexterm>
1543         Third-party Windows applications may not be compatible with the use of opportunistic file
1544         and record locking. For applications that are known not to be compatible,<footnote>Refer to
1545         the application manufacturers' installation guidelines and knowledge base for specific
1546         information regarding compatibility. It is often safe to assume that if the software
1547         manufacturer does not specifically mention incompatibilities with opportunistic file
1548         and record locking, or with Windows client file cacheing, the application is probably
1549         compatible with Windows (as well as Samba) default settings.</footnote> oplock
1550         support may need to be disabled both on the Samba server and on the Windows workstations.
1551         </para>
1552
1553         <para><indexterm>
1554             <primary>cache</primary>
1555           </indexterm><indexterm>
1556             <primary>write lock</primary>
1557           </indexterm><indexterm>
1558             <primary>flush</primary>
1559             <secondary>cache memory</secondary>
1560           </indexterm>
1561         Oplocks enable a Windows client to cache parts of a file that are being
1562         edited. Another windows client may then request to open the file with the
1563         ability to write to it. The server will then ask the original workstation
1564         that had the file open with a write lock to release it's lock. Before
1565         doing so, that workstation must flush the file from cache memory to the
1566         disk or network drive.
1567         </para>
1568
1569         <para><indexterm>
1570             <primary>Oplocks</primary>
1571             <secondary>disabled</secondary>
1572           </indexterm>
1573         Disabling of Oplocks usage may require server and client changes.
1574         Oplocks may be disabled by file, by file pattern, on the share, or on the
1575         samba server.
1576         </para>
1577
1578         <para>
1579         The following are examples showing how Oplock support may be managed using
1580         Samba &smb.conf; file settings:
1581 <screen>
1582 By file:        veto oplock files = myfile.mdb
1583
1584 By Pattern:     veto oplock files = /*.mdb/
1585
1586 On the Share:   oplocks = No
1587                 level2 oplocks = No
1588
1589 On the server:
1590 (in [global])   oplocks = No
1591                 level2 oplocks = No
1592 </screen>
1593         </para>
1594
1595         <para>
1596         The following registry entries on Microsoft Windows XP Professional, 2000 Professional and Windows NT4
1597         workstation clients must be configured as shown here:
1598 <screen>
1599 REGEDIT4
1600
1601 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\
1602             Services\LanmanServer\Parameters]
1603       "EnableOplocks"=dword:00000000
1604
1605 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\
1606             Services\LanmanWorkstation\Parameters]
1607       "UseOpportunisticLocking"=dword:00000000
1608 </screen>
1609         </para>
1610
1611         <para>
1612         Comprehensive coverage of file and record locking controls is provided in TOSHARG Chapter 13.
1613         The information provided in that chapter was obtained from a wide variety of sources.
1614         </para>
1615
1616         </sect2>
1617
1618 </sect1>
1619
1620 </appendix>
1621