1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <chapter id="nw4migration">
4 <title>Migrating NetWare Server to Samba-3</title>
7 <indexterm><primary>Novell</primary></indexterm>
8 <indexterm><primary>SUSE</primary></indexterm>
9 Novell is a company any seasoned IT manager has to admire. It has become increasingly
10 Linux-friendly and is emerging out of a deep regression that almost saw the company
11 disappear into obscurity. Novell's SUSE Linux hosts the NetWare server and it is the
12 platform of choice to which many older NetWare servers are being migrated.
13 It will be interesting to see what becomes of NetWare over time.
14 Meanwhile, there can be no denying that Novell is a Linux company.
18 <indexterm><primary>Red Hat</primary></indexterm>
19 <indexterm><primary>Debian</primary></indexterm>
20 <indexterm><primary>Gentoo</primary></indexterm>
21 <indexterm><primary>Mandrake</primary></indexterm>
22 Whatever flavor of Linux is preferred in your environment, whether Red Hat, Debian,
23 Gentoo, Mandrake, or SUSE (Novell), the information in this chapter should be read with
24 the knowledge that file locations may vary a little; even so, the information
25 in this chapter should provide something of value.
29 <indexterm><primary>migration</primary></indexterm>
30 Contributions to this chapter were made by Misty Stanley-Jones, a UNIX administrator of many
31 years who surfaced on the Samba mailing list with a barrage of questions and who
32 regularly helps other administrators to solve thorny Samba migration questions.
36 <indexterm><primary>NetWare</primary></indexterm>
37 <indexterm><primary>NLM</primary></indexterm>
38 <indexterm><primary>NetWare</primary></indexterm>
39 <indexterm><primary>Mars_NWE</primary></indexterm>
40 One wonders how many NetWare servers remain in active service. Many are being migrated
41 to Samba on Linux. Red Hat Linux, SUSE Linux 9.x, and SUSE Linux Enterprise Server 9 are
42 ideal target platforms to which a NetWare server may be migrated. The migration method
43 of choice is much dependent on the tools that the administrator finds most natural to use.
44 The old-hand NetWare guru will likely want to use tools like the NetWare NLM for
45 <command>rsync</command> to migrate files from the NetWare server to the Samba server.
46 The UNIX administrator might prefer tools that are part of the Mars_NWE (Martin Stovers' NetWare
47 Emulator) open source package. The MS Windows network administrator will likely make use of the
48 NWConv utility that is a part of Windows NT4 Server. Whatever your tool of choice,
49 migration will be filled with joyous and challenging moments &smbmdash; though probably not
54 The priority that Misty faced was one of migration of the data files off the NetWare 4.11
55 server and onto a Samba-based Windows file and print server. This chapter does not pretend
56 to document all the different methods that could be used to migrate user and group accounts
57 off a NetWare server. Its focus is on migration of data files.
61 This chapter tells its own story, so ride along. Maybe the information presented here
62 will help to smooth over a similar migration challenge in your favorite networking environment.
66 File paths have been modified to permit use of RPM packages provided by Novell. In the
67 original documentation contributed by Misty, the Courier-IMAP package had been built
68 directly from the original source tarball.
72 <title>Introduction</title>
75 <indexterm><primary>Novell</primary></indexterm>
76 Misty Stanley-Jones was recruited by Abmas to administer a network that had
77 not received much attention for some years and was much in need of a makeover.
78 As a brand-new sysadmin to this company, she inherited a very old Novell file server
79 and came with a determination to change things for the better.
83 A site survey turned up the following details for the old NetWare server:
87 <member><para>200 MHz MMX processor</para></member>
88 <member><para>512K RAM</para></member>
89 <member><para>24 GB disk space in RAID1</para></member>
90 <member><para>Novell 4.11 patched to service pack 7</para></member>
91 <member><para>60+ users</para></member>
92 <member><para>7 network-attached printers</para></member>
96 The company had outgrown this server several years before and was dealing with
97 severe growing pains. Some of the problems experienced were:
102 <para>Very slow performance</para>
105 <para>Available storage hovering around the 5% range</para>
108 <para>Extremely slow print spooling.</para>
112 Users storing information on their local hard
113 drives, causing backup integrity problems
121 <indexterm><primary>payroll</primary></indexterm>
122 At one point disk space had filled up to 100 percent, causing the payroll database
123 to become corrupt. This caused the accounting department to be down for over
124 a week and necessitated deployment of another file server. The replacement
125 server was created with very poor security and design considerations from
126 a discarded desktop PC.
130 <title>Assignment Tasks</title>
133 Misty has provided this summary of her migration experience in the hope
134 that it will help someone to avoid the challenges she faced. Perhaps her
135 configuration files and background will accelerate your learning as you
136 grapple with a similar migration challenge. Let there be no confusion,
137 the information presented in this chapter is provided to demonstrate
138 how Misty dealt with a particular NetWare migration requirement, and
139 it provides an overall approach to the implementation of a Samba-3
140 environment that is significantly divergent from that presented in
141 <link linkend="happy"/>.
145 The complete removal of all site-specific information in order to produce
146 a generic migration solution would rob this chapter of its character.
147 It should be recognized, therefore, that the examples given require
148 significant adaptation to suit local needs and thus
149 there are some gaps in the example files. That is not Misty's fault;it
150 is the result of treatment given to her files in an attempt to make
151 the overall information more useful to you.
155 <indexterm><primary>cost-benefit</primary></indexterm>
156 After management reviewed a cost-benefit report as well as an estimated
157 time-to-completion, approval was given proceed with the solution proposed.
158 The server was built from purchased components. The total project cost
159 was $3,000. A brief description of the configuration follows:
164 <para>3.0 GHz P4 Processor</para>
167 <para>1 GB RAM</para>
170 <para>120 GB SATA operating system drive</para>
173 <para>4 x 80 GB SATA data drives (RAID5 240 GB capacity)</para>
176 <para>2 x 80 GB SATA removable drives for online backup</para>
179 <para>A DLT drive for asynchronous offline backup</para>
182 <para>SUSE Linux Professional 9.1</para>
187 The new system has operated for 6 months without problems. Over the past months
188 much attention has been focused on cleaning up desktops and user profiles.
195 <title>Dissection and Discussion</title>
198 <indexterm><primary>LDAP</primary></indexterm>
199 <indexterm><primary>e-Directory</primary></indexterm>
200 <indexterm><primary>authentication</primary></indexterm>
201 <indexterm><primary>identity management</primary></indexterm>
202 A decision to use LDAP was made even though I knew nothing about LDAP except that
203 I had been reading the book <quote>LDAP System Administration,</quote> by Gerald Carter.
204 LDAP seemed to provide some of the functionality of Novell's e-Directory Services
205 and would provide centralized authentication and identity management.
209 <indexterm><primary>database</primary></indexterm>
210 <indexterm><primary>RPM</primary></indexterm>
211 <indexterm><primary>tree</primary></indexterm>
212 Building the LDAP database took a while and a lot of trial and error. Following
213 the guidance I obtained from <quote>LDAP System
214 Administration,</quote> I installed OpenLDAP (from RPM; later I compiled
215 a more current version from source) and built my initial LDAP tree.
219 <title>Technical Issues</title>
222 <indexterm><primary>white-pages</primary></indexterm>
223 <indexterm><primary>inetOrgPerson</primary></indexterm>
224 <indexterm><primary>OpenLDAP</primary></indexterm>
225 <indexterm><primary>/etc/passwd</primary></indexterm>
226 <indexterm><primary>/etc/shadow</primary></indexterm>
227 <indexterm><primary>LDIF</primary></indexterm>
228 <indexterm><primary>IMAP</primary></indexterm>
229 <indexterm><primary>POP3</primary></indexterm>
230 <indexterm><primary>SMTP</primary></indexterm>
231 The first challenge was to create a company white pages, followed by manually
232 entering everything from the printed company directory. This used only the inetOrgPerson
233 object class from the OpenLDAP schemas. The next step was to write a shell script that
234 would look at the <filename>/etc/passwd</filename> and <filename>/etc/shadow</filename>
235 files on our mail server and create an LDIF file from which the information could be
236 imported into LDAP. This would allow use of LDAP for Linux authentication, IMAP, POP3,
241 Because a decision was made to use Courier-IMAP the schema <quote>authldap.schema</quote>
242 from the Courier-IMAP source, tarball is necessary to resolve Courier-specific LDAP directory
243 needs. Where the Courier-IMAP file provided by SUSE is used, this file is named
244 <filename>courier.schema</filename>.
248 Looking back, it would have been much easier to populate the LDAP directory using a convenient
249 tool such as <command>phpLDAPAdmin</command> from the outset. An excessive amount of time was
250 spent trying to generate LDIF files that could be parsed using the <command>ldapmodify</command>
251 so that necessary changes could be written to the directory. This was a learning experience!
255 An attempt was made to use the PADL POSIX account migration scripts, but I gave up trying to
256 make them work. Instead, even though it is most inelegant, I wrote a simple script that did
257 what I needed. It is enclosed as a simple example to demonstrate that you do not need to be
258 a guru to make light of otherwise painful repetition. This file is listed in <link linkend="sbeamg"/>.
261 <example id="sbeamg">
262 <title>A Rough Tool to Create an LDIF File from the System Account Files</title>
266 cat /etc/passwd | while read l; do
267 uid=`echo $l | cut -d : -f 1`
268 uidNumber=`echo $l | cut -d : -f 3`
269 gidNumber=`echo $1 | cut -d : -f 4`
270 gecos=`echo $l | cut -d : -f 5`
271 homeDirectory=`echo $l | cut -d : -f 6`
272 loginShell=`echo $l | cut -d : -f 6`
273 userPassword=`cat /etc/shadow | grep $uid | cut -d : -f 2`
275 echo "dn: cn=$gecos,ou=people,dc=mycompany,dc=com"
276 echo "objectClass: account"
277 echo "objectClass: posixAccount"
280 echo "uidNumber: $uidNumber"
281 echo "gidNumber: $gidNumber"
282 echo "homeDirectory: $homeDirectory"
283 echo "loginShell: $loginShell"
284 echo "userPassword: $userPassword"
291 The PADL MigrationTools are recommended for migration of the UNIX account information into
292 the LDAP directory. The tools consist of a set of Perl scripts for migration of users, groups,
293 aliases, hosts, netgroups, networks, protocols, PRCs, and services from the existing ASCII text
294 files (or from a name service such as NIS). This too set can be obtained from the <ulink url=
295 "http://www.padl.com">PADL Web site</ulink>.
303 <title>Implementation</title>
309 <title>NetWare Migration Using LDAP Backend</title>
312 The following software must be installed on the SUSE Linux Enterprise Server to perform
317 <member><para>courier-imap</para></member>
318 <member><para>courier-imap-ldap</para></member>
319 <member><para>nss_ldap</para></member>
320 <member><para>openldap2-client</para></member>
321 <member><para>openldap2-devel (only for Samba compilation)</para></member>
322 <member><para>openldap2</para></member>
323 <member><para>pam_ldap</para></member>
324 <member><para>samba-3.0.20 or later</para></member>
325 <member><para>samba-client-3.0.20 or later</para></member>
326 <member><para>samba-winbind-3.0.20 or later</para></member>
327 <member><para>smbldap-tools Version 0.8.8</para></member>
331 Each software application must be carefully configured in preparation for migration.
332 The configuration files used at Abmas are provided as a guide and should be modified
333 to meet needs at your site.
337 <title>LDAP Server Configuration</title>
340 The <filename>/etc/openldap/slapd.conf</filename> file Misty used is shown here:
342 #/etc/openldap/slapd.conf
344 # See slapd.conf(5) for details on configuration options.
345 # This file should NOT be world readable.
347 include /etc/openldap/schema/core.schema
348 include /etc/openldap/schema/cosine.schema
349 include /etc/openldap/schema/inetorgperson.schema
350 include /etc/openldap/schema/nis.schema
351 include /etc/openldap/schema/samba3.schema
352 include /etc/openldap/schema/dhcp.schema
353 include /etc/openldap/schema/misc.schema
354 include /etc/openldap/schema/idpool.schema
355 include /etc/openldap/schema/eduperson.schema
356 include /etc/openldap/schema/commURI.schema
357 include /etc/openldap/schema/local.schema
358 include /etc/openldap/schema/courier.schema
360 pidfile /var/run/slapd/run/slapd.pid
361 argsfile /var/run/slapd/run/slapd.args
363 replogfile /data/ldap/log/slapd.replog
365 # Load dynamic backend modules:
366 modulepath /usr/lib/openldap/modules
368 #######################################################################
370 #######################################################################
373 #######################################################################
374 # SASL and TLS options
375 #######################################################################
376 sasl-host ldap.corp.abmas.org
377 sasl-realm DIGEST-MD5
379 TLSCipherSuite HIGH:MEDIUM:+SSLV2
380 TLSCertificateFile /etc/ssl/certs/private/abmas-cert.pem
381 TLSCertificateKeyFile /etc/ssl/certs/private/abmas-key.pem
383 defaultsearchbase "dc=abmas,dc=biz"
385 #######################################################################
386 # bdb database definitions
387 #######################################################################
389 suffix "dc=abmas,dc=biz"
390 rootdn "cn=manager,dc=abmas,dc=biz"
391 rootpw {SSHA}gdo/dUvoT4ZJmULz3rUt6A3H/hBEduJ5
394 # The following is for BDB to make it flush its data to disk every
395 # 500 seconds or 5kb of data
398 ## For running slapindex
401 ## Indexes for often-requested attributes
409 index sambaPrimaryGroupSID eq
410 index sambaDomainName eq
414 replica host=baa.corp.abmas.org:389
415 suffix="dc=abmas,dc=biz"
416 binddn="cn=replica,dc=abmas,dc=biz"
417 credentials=verysecret
420 replica host=ns.abmas.org:389
421 suffix="dc=abmas,dc=biz"
422 binddn="cn=replica,dc=abmas,dc=biz"
423 credentials=verysecret
427 #######################################################################
429 #######################################################################
430 ## MOST RESTRICTIVE RULES MUST GO FIRST!
431 # Admins get access to everything. This way I do not have to rename.
433 by group/groupOfUniqueNames/uniqueMember="cn=LDAP
434 Administrators,ou=groups,dc=abmas,dc=biz" write
437 ## Users can change their own passwords.
439 attrs=userPassword,sambaNTPassword,sambaLMPassword,sambaPwdLastSet,
440 sambaPwdMustChange,sambaPwdCanChange
444 ## Home contact info restricted to the logged-in user and the HR dept
445 access to attrs=hometelephoneNumber,homePostalAddress,
446 mobileTelephoneNumber,pagerTelephoneNumber
447 by group/groupOfUniqueNames/uniqueMember="cn=hr_admin,
448 ou=groups,dc=abmas,dc=biz"
453 ## Everyone can read email aliases
454 access to dn.sub="ou=Email Aliases,dc=abmas,dc=biz"
457 ## Only admins can manage email aliases
458 ## If someone is the role occupant of an alias they can change it -- this
459 ## is accomplished by the "organizationalRole" objectclass and is
460 ## pretty cool -- like a groupOfUniqueNames but for individual
462 access to dn.children="ou=Email Aliases,dc=abmas,dc=biz"
463 by dnattr=roleOccupant write
466 ## Admins and HR can add and delete users
467 access to dn.sub="ou=people,dc=abmas,dc=biz"
468 by group/groupOfUniqueNames/uniqueMember="cn=hr_admin,
469 ou=groups,dc=abmas,dc=biz"
473 ## Admins and HR can add and delete bizputers
474 access to dn.sub="ou=bizputers,dc=abmas,dc=biz"
475 by group/groupOfUniqueNames/uniqueMember="cn=hr_admin,
476 ou=groups,dc=abmas,dc=biz"
480 ## Admins and HR can add and delete groups
481 access to dn.sub="ou=groups,dc=abmas,dc=biz"
482 by group/groupOfUniqueNames/uniqueMember="cn=hr_admin,
483 ou=groups,dc=abmas,dc=biz"
487 ## This is used to quickly deactivate any LDAP object only Admins have access.
488 access to dn.sub="ou=inactive,dc=abmas,dc=biz"
491 ## This is for programs like Windows Address Book that can
492 ## detect the default search base.
493 access to attrs=namingcontexts,supportedControl
497 ## Default to read-only access
499 by dn.base="cn=replica,ou=people,dc=abmas,dc=biz" write
505 <indexterm><primary>/etc/ldap.conf</primary></indexterm>
506 The <filename>/etc/ldap.conf</filename> file used is listed in <link linkend="ch8ldap"/>.
509 <example id="ch8ldap">
510 <title>NSS LDAP Control File &smbmdash; /etc/ldap.conf</title>
513 # This file is present on every *NIX client that authenticates to LDAP.
514 # For me, most of the defaults are fine. There is an amazing amount of
515 # customization that can be done see the man page for info.
517 # Your LDAP server. Must be resolvable without using LDAP. The following
518 # is for the LDAP server all others use the FQDN of the server
521 # The distinguished name of the search base.
522 base ou=corp,dc=abmas,dc=biz
524 # The LDAP version to use (defaults to 3 if supported by client library)
527 # The distinguished name to bind to the server with if the effective
528 # user ID is root. Password is stored in /etc/ldap.secret (mode 600)
529 rootbinddn cn=Manager,dc=abmas,dc=biz
531 # Filter to AND with uid=%s
532 pam_filter objectclass=posixAccount
534 # The user ID attribute (defaults to uid)
535 pam_login_attribute uid
537 # Group member attribute
538 pam_member_attribute memberUID
540 # Use the OpenLDAP password change
541 # extended operation to update the password.
544 # OpenLDAP SSL mechanism
545 # start_tls mechanism uses the normal LDAP port, LDAPS typically 636
548 tls_cacertfile /etc/ssl/certs/private/abmas-cert.pem
554 The NSS control file <filename>/etc/nsswitch.conf</filename> has the following contents:
557 # This file controls the resolve order for system databases.
559 # the following two lines obviate the "+" entry in /etc/passwd and /etc/group.
562 # The above are all that I store in LDAP at this point. There are
563 # possibilities to store hosts, services, ethers, and lots of other things.
568 <indexterm><primary>PAM</primary></indexterm>
569 <indexterm><primary>NSS</primary></indexterm>
570 In my setup, users authenticate via PAM and NSS using LDAP-based accounts.
571 The configuration file that controls the behavior of the PAM <command>pam_unix2</command>
572 module is shown in <link linkend="sbepu2"/> file.
573 This works out of the box with the configuration files in this chapter. It
574 enables you to have no local accounts for users (it is highly advisable
575 to have a local account for the root user). Traps for the unwary include the following:
578 <example id="sbepu2">
579 <title>The PAM Control File <filename>/etc/security/pam_unix2.conf</filename></title>
581 # pam_unix2 config file
583 # This file contains options for the pam_unix2.so module.
584 # It contains a list of options for every type of management group,
585 # which will be used for authentication, account management and
586 # password management. Not all options will be used from all types of
589 # At first, pam_unix2 will read this file and then uses the local
590 # options. Not all options can be set her global.
592 # Allowed options are:
594 # debug (account, auth, password, session)
596 # md5 (password / overwrites /etc/default/passwd)
597 # bigcrypt (password / overwrites /etc/default/passwd)
598 # blowfish (password / overwrites /etc/default/passwd)
602 # call_modules=x,y,z (account, auth, password)
607 # password: nullok blowfish crypt_rounds=8
617 <indexterm><primary>LDAP</primary></indexterm>
618 <indexterm><primary>authenticate</primary></indexterm>
619 <indexterm><primary>DNS</primary></indexterm>
623 If your LDAP database goes down, nobody can authenticate except for root.
629 If failover is configured incorrectly, weird behavior can occur. For example,
630 DNS can fail to resolve.
636 I do have two LDAP slave servers configured. That subject is beyond the scope
637 of this document, and steps for implementing it are well documented.
641 The following services authenticate using LDAP:
643 <indexterm><primary>UNIX</primary></indexterm>
644 <indexterm><primary>Postfix</primary></indexterm>
645 <indexterm><primary>Courier-IMAP</primary></indexterm>
647 <member><para>UNIX login/ssh</para></member>
648 <member><para>Postfix (SMTP)</para></member>
649 <member><para>Courier-IMAP/IMAPS/POP3/POP3S</para></member>
653 <indexterm><primary>white-pages</primary></indexterm>
654 <indexterm><primary>Windows Address Book</primary></indexterm>
655 Companywide white pages can be searched using an LDAP client
656 such as the one in the Windows Address Book.
660 <indexterm><primary>LDAP</primary></indexterm>
661 <indexterm><primary>smbldap-tools</primary></indexterm>
662 Having gained a solid understanding of LDAP and a relatively workable LDAP tree
663 thus far, it was time to configure Samba. I compiled the latest stable Samba and
664 also installed the latest <command>smbldap-tools</command> from
665 <ulink url="http://idealx.com">Idealx</ulink>.
669 The Samba &smb.conf; file was configured as shown in <link linkend="ch8smbconf"/>.
672 <smbconfexample id="ch8smbconf">
673 <title>Samba Configuration File &smbmdash; smb.conf Part A</title>
674 <smbconfcomment>Global parameters</smbconfcomment>
675 <smbconfsection name="[global]"/>
676 <smbconfoption name="workgroup">MEGANET2</smbconfoption>
677 <smbconfoption name="netbios name">MASSIVE</smbconfoption>
678 <smbconfoption name="server string">Corp File Server</smbconfoption>
679 <smbconfoption name="passdb backend">ldapsam:ldap://localhost</smbconfoption>
680 <smbconfoption name="pam password change">Yes</smbconfoption>
681 <smbconfoption name="username map">/etc/samba/smbusers</smbconfoption>
682 <smbconfoption name="log level">1</smbconfoption>
683 <smbconfoption name="log file">/data/samba/log/%m.log</smbconfoption>
684 <smbconfoption name="name resolve order">wins host bcast</smbconfoption>
685 <smbconfoption name="time server">Yes</smbconfoption>
686 <smbconfoption name="printcap name">cups</smbconfoption>
687 <smbconfoption name="show add printer wizard">No</smbconfoption>
688 <smbconfoption name="cups options">Raw</smbconfoption>
689 <smbconfoption name="add user script">/opt/IDEALX/sbin/smbldap-useradd -m "%u"</smbconfoption>
690 <smbconfoption name="add group script">/opt/IDEALX/sbin/smbldap-groupadd -p "%g"</smbconfoption>
691 <smbconfoption name="add user to group script"></smbconfoption>
692 <member><parameter>/opt/IDEALX/sbin/smbldap-groupmod -m "%u" "%g"</parameter></member>
693 <smbconfoption name="delete user from group script"></smbconfoption>
694 <member><parameter>/opt/IDEALX/sbin/smbldap-groupmod -x "%u" "%g"</parameter></member>
695 <smbconfoption name="set primary group script"></smbconfoption>
696 <member><parameter>/opt/IDEALX/sbin/smbldap-usermod -g "%g" "%u"</parameter></member>
697 <smbconfoption name="add machine script">/usr/local/sbin/smbldap-useradd -w "%m"</smbconfoption>
698 <smbconfoption name="logon script">logon.bat</smbconfoption>
699 <smbconfoption name="logon path">\\%L\profiles\%U\%a</smbconfoption>
700 <smbconfoption name="logon drive">H:</smbconfoption>
701 <smbconfoption name="logon home">\\%L\%U</smbconfoption>
702 <smbconfoption name="domain logons">Yes</smbconfoption>
703 <smbconfoption name="wins support">Yes</smbconfoption>
704 <smbconfoption name="ldap admin dn">cn=Manager,dc=abmas,dc=biz</smbconfoption>
705 <smbconfoption name="ldap group suffix">ou=Groups</smbconfoption>
706 <smbconfoption name="ldap idmap suffix">ou=People</smbconfoption>
707 <smbconfoption name="ldap machine suffix">ou=People</smbconfoption>
708 <smbconfoption name="ldap passwd sync">Yes</smbconfoption>
709 <smbconfoption name="ldap suffix">ou=MEGANET2,dc=abmas,dc=biz</smbconfoption>
710 <smbconfoption name="ldap ssl">no</smbconfoption>
711 <smbconfoption name="ldap user suffix">ou=People</smbconfoption>
712 <smbconfoption name="admin users">root, "@Domain Admins"</smbconfoption>
713 <smbconfoption name="printer admin">"@Domain Admins"</smbconfoption>
714 <smbconfoption name="force printername">Yes</smbconfoption>
717 <smbconfexample id="ch8smbconf2">
718 <title>Samba Configuration File &smbmdash; smb.conf Part B</title>
719 <smbconfsection name="[netlogon]"/>
720 <smbconfoption name="comment">Network logon service</smbconfoption>
721 <smbconfoption name="path">/data/samba/netlogon</smbconfoption>
722 <smbconfoption name="write list">"@Domain Admins"</smbconfoption>
723 <smbconfoption name="guest ok">Yes</smbconfoption>
725 <smbconfsection name="[profiles]"/>
726 <smbconfoption name="comment">Roaming Profile Share</smbconfoption>
727 <smbconfoption name="path">/data/samba/profiles/</smbconfoption>
728 <smbconfoption name="read only">No</smbconfoption>
729 <smbconfoption name="profile acls">Yes</smbconfoption>
730 <smbconfoption name="veto files">desktop.ini</smbconfoption>
731 <smbconfoption name="browseable">No</smbconfoption>
733 <smbconfsection name="[homes]"/>
734 <smbconfoption name="comment">Home Directories</smbconfoption>
735 <smbconfoption name="valid users">%S</smbconfoption>
736 <smbconfoption name="read only">No</smbconfoption>
737 <smbconfoption name="create mask">0770</smbconfoption>
738 <smbconfoption name="veto files">desktop.ini</smbconfoption>
739 <smbconfoption name="hide files">desktop.ini</smbconfoption>
740 <smbconfoption name="browseable">No</smbconfoption>
742 <smbconfsection name="[software]"/>
743 <smbconfoption name="comment">Software for %a computers</smbconfoption>
744 <smbconfoption name="path">/data/samba/shares/software/%a</smbconfoption>
745 <smbconfoption name="guest ok">Yes</smbconfoption>
747 <smbconfsection name="[public]"/>
748 <smbconfoption name="comment">Public Files</smbconfoption>
749 <smbconfoption name="path">/data/samba/shares/public</smbconfoption>
750 <smbconfoption name="read only">No</smbconfoption>
751 <smbconfoption name="guest ok">Yes</smbconfoption>
753 <smbconfsection name="[PDF]"/>
754 <smbconfoption name="comment">Location of documents printed to PDFCreator printer</smbconfoption>
755 <smbconfoption name="path">/data/samba/shares/pdf</smbconfoption>
756 <smbconfoption name="guest ok">Yes</smbconfoption>
759 <smbconfexample id="ch8smbconf3">
760 <title>Samba Configuration File &smbmdash; smb.conf Part C</title>
761 <smbconfsection name="[EVERYTHING]"/>
762 <smbconfoption name="comment">All shares</smbconfoption>
763 <smbconfoption name="path">/data/samba</smbconfoption>
764 <smbconfoption name="valid users">"@Domain Admins"</smbconfoption>
765 <smbconfoption name="read only">No</smbconfoption>
767 <smbconfsection name="[CDROM]"/>
768 <smbconfoption name="comment">CD-ROM on MASSIVE</smbconfoption>
769 <smbconfoption name="path">/mnt</smbconfoption>
770 <smbconfoption name="guest ok">Yes</smbconfoption>
772 <smbconfsection name="[print$]"/>
773 <smbconfoption name="comment">Printer Drivers Share</smbconfoption>
774 <smbconfoption name="path">/data/samba/drivers</smbconfoption>
775 <smbconfoption name="write list">root</smbconfoption>
776 <smbconfoption name="browseable">No</smbconfoption>
778 <smbconfsection name="[printers]"/>
779 <smbconfoption name="comment">All Printers</smbconfoption>
780 <smbconfoption name="path">/data/samba/spool</smbconfoption>
781 <smbconfoption name="create mask">0644</smbconfoption>
782 <smbconfoption name="printable">Yes</smbconfoption>
783 <smbconfoption name="browseable">No</smbconfoption>
785 <smbconfsection name="[acct_hp8500]"/>
786 <smbconfoption name="comment">"Accounting Color Laser Printer"</smbconfoption>
787 <smbconfoption name="path">/data/samba/spool/private</smbconfoption>
788 <smbconfoption name="valid users">@acct, @acct_admin, @hr, "@Domain Admins",\</smbconfoption>
789 <member><parameter>@Receptionist, dwayne, terri, danae, jerry</parameter></member>
790 <smbconfoption name="create mask">0644</smbconfoption>
791 <smbconfoption name="printable">Yes</smbconfoption>
792 <smbconfoption name="copy">printers</smbconfoption>
794 <smbconfsection name="[plotter]"/>
795 <smbconfoption name="comment">Engineering Plotter</smbconfoption>
796 <smbconfoption name="path">/data/samba/spool</smbconfoption>
797 <smbconfoption name="create mask">0644</smbconfoption>
798 <smbconfoption name="printable">Yes</smbconfoption>
799 <smbconfoption name="use client driver">Yes</smbconfoption>
800 <smbconfoption name="copy">printers</smbconfoption>
803 <smbconfexample id="ch8smbconf4">
804 <title>Samba Configuration File &smbmdash; smb.conf Part D</title>
805 <smbconfsection name="[APPS]"/>
806 <smbconfoption name="path">/data/samba/shares/Apps</smbconfoption>
807 <smbconfoption name="force group">"Domain Users"</smbconfoption>
808 <smbconfoption name="read only">No</smbconfoption>
810 <smbconfsection name="[ACCT]"/>
811 <smbconfoption name="path">/data/samba/shares/Accounting</smbconfoption>
812 <smbconfoption name="valid users">@acct, "@Domain Admins"</smbconfoption>
813 <smbconfoption name="force group">acct</smbconfoption>
814 <smbconfoption name="read only">No</smbconfoption>
815 <smbconfoption name="create mask">0660</smbconfoption>
816 <smbconfoption name="directory mask">0770</smbconfoption>
818 <smbconfsection name="[ACCT_ADMIN]"/>
819 <smbconfoption name="path">/data/samba/shares/Acct_Admin</smbconfoption>
820 <smbconfoption name="valid users">@”acct_admin”</smbconfoption>
821 <smbconfoption name="force group">acct_admin</smbconfoption>
823 <smbconfsection name="[HR_PR]"/>
824 <smbconfoption name="path">/data/samba/shares/HR_PR</smbconfoption>
825 <smbconfoption name="valid users">@hr, @acct_admin</smbconfoption>
826 <smbconfoption name="force group">hr</smbconfoption>
828 <smbconfsection name="[ENGR]"/>
829 <smbconfoption name="path">/data/samba/shares/Engr</smbconfoption>
830 <smbconfoption name="valid users">@engr, @receptionist, @truss, "@Domain Admins", cheri</smbconfoption>
831 <smbconfoption name="force group">engr</smbconfoption>
832 <smbconfoption name="read only">No</smbconfoption>
833 <smbconfoption name="create mask">0770</smbconfoption>
835 <smbconfsection name="[DATA]"/>
836 <smbconfoption name="path">/data/samba/shares/DATA</smbconfoption>
837 <smbconfoption name="valid users">@engr, @receptionist, @truss, "@Domain Admins", cheri</smbconfoption>
838 <smbconfoption name="force group">engr</smbconfoption>
839 <smbconfoption name="read only">No</smbconfoption>
840 <smbconfoption name="create mask">0770</smbconfoption>
841 <smbconfoption name="copy">engr</smbconfoption>
844 <smbconfexample id="ch8smbconf5">
845 <title>Samba Configuration File &smbmdash; smb.conf Part E</title>
846 <smbconfsection name="[X]"/>
847 <smbconfoption name="path">/data/samba/shares/X</smbconfoption>
848 <smbconfoption name="valid users">@engr, @acct</smbconfoption>
849 <smbconfoption name="force group">engr</smbconfoption>
850 <smbconfoption name="read only">No</smbconfoption>
851 <smbconfoption name="create mask">0770</smbconfoption>
852 <smbconfoption name="copy">engr</smbconfoption>
854 <smbconfsection name="[NETWORK]"/>
855 <smbconfoption name="path">/data/samba/shares/network</smbconfoption>
856 <smbconfoption name="valid users">"@Domain Users"</smbconfoption>
857 <smbconfoption name="read only">No</smbconfoption>
858 <smbconfoption name="create mask">0770</smbconfoption>
859 <smbconfoption name="guest ok">Yes</smbconfoption>
861 <smbconfsection name="[UTILS]"/>
862 <smbconfoption name="path">/data/samba/shares/Utils</smbconfoption>
863 <smbconfoption name="write list">"@Domain Admins"</smbconfoption>
865 <smbconfsection name="[SYS]"/>
866 <smbconfoption name="path">/data/samba/shares/SYS</smbconfoption>
867 <smbconfoption name="valid users">chad</smbconfoption>
868 <smbconfoption name="read only">No</smbconfoption>
869 <smbconfoption name="browseable">No</smbconfoption>
873 <indexterm><primary>Qbasic</primary></indexterm>
874 <indexterm><primary>Rbase</primary></indexterm>
875 <indexterm><primary>drive letters</primary></indexterm>
876 Most of these shares are only used by one company group, but they are required
877 because of some ancient Qbasic and Rbase applications were that written expecting
878 their own drive letters.
882 <indexterm><primary>rsync</primary></indexterm>
883 <indexterm><primary>rsyncd.conf</primary></indexterm>
884 <indexterm><primary>synchronize</primary></indexterm>
885 Note: During the process of building the new server, I kept data files
886 up to date with the Novell server via use of <command>rsync</command>.
887 On a separate system (my workstation in fact), which could be rebooted
888 whenever necessary, I set up a mount point to the Novell server via
889 <command>ncpmount</command>. I then created a
890 <filename>rsyncd.conf</filename> to share that mount point out to my
891 new server, and synchronized once an hour. The script I used to synchronize
892 is shown in <link linkend="sbersync"/>. The files exclusion list I used
893 is shown in <link linkend="sbexcld"/>. The reason I had to have the
894 <command>rsync</command> daemon running on a system that could be
895 rebooted frequently is because <constant>ncpfs</constant>
896 (part of the MARS NetWare Emulation package) has a nasty habit of creating stale
897 mount points that cannot be recovered without a reboot. The reason for hourly
898 synchronization is because some part of the chain was very slow and
899 performance-heavy (whether <command>rsync</command> itself, the network,
900 or the Novell server, I am not sure, but it was probably the Novell server).
903 <example id="sbersync">
904 <title>Rsync Script</title>
907 # Part 1 - rsync the Novell directories to the new server
908 echo "#############################################"
909 echo "New sync operation starting at `date`"
910 if ! pgrep -fl '^rsync\> ; then
911 echo "Good, no rsync is running!"
912 echo "Synchronizing oink to BHPRO"
913 rsync -av --exclude-from=/root/excludes.txt
914 baa.corp:/BHPRO/SYS1/ /data/samba/shares/SYS1
916 [ ${retval} = 0 ] && echo "Sync operation completed at `date`"
917 echo "Fixing permissions"
918 # I had a whole lot more permission-fixing stuff here. It got
919 # pared down as groups got moved over. The problem
920 # was that the way I was mounting the directory, everything
921 # was owned by the Novell administrator which translated to
922 # Root. This is also why I could only do one-way sync because
923 # I could not fix the ACLs on the Novell side.
924 find /data/samba/shares/Engr/ -perm +770 -exec chmod 770 {} \;
925 find /data/samba/shares/Engr/ ! -group engr -exec chgrp engr {} \;
927 # This rsync took ages and ages -- I had it set to run every hour but
928 # I needed a way to prevent it running into itself.
929 echo "Oh no, rsync is already running!"
930 echo "#############################################"
935 <example id="sbexcld">
936 <title>Rsync Files Exclusion List &smbmdash; <filename>/root/excludes.txt</filename></title>
954 After Samba was configured, I initialized the LDAP database. The first
955 thing I had to do was store the LDAP password in the Samba configuration by
956 issuing the command (as root):
958 &rootprompt; smbpasswd -w verysecret
960 where <quote>verysecret</quote> is replaced by the LDAP bind password.
964 The Idealx smbldap-tools package can be configured using a script called
965 <command>configure.pl</command> that is provided as part of the tool. See <link linkend="happy"/>
966 for an example of its use. Many administrators, like Misty, choose to do this manually
967 so as to maintain greater awareness of how the tool-chain works and possibly to avoid
968 undesirable actions from occurring unnoticed.
972 Now Samba was ready for use and it was time to configure the smbldap-tools. There are two
973 relevant files, which are usually put into the directory
974 <filename>/etc/smbldap-tools</filename>. The main file,
975 <filename>smbldap.conf</filename> is shown in <link linkend="ch8ideal"/>.
978 <example id="ch8ideal">
979 <title>Idealx smbldap-tools Control File &smbmdash; Part A</title>
983 # located in /etc/smbldap-tools/smbldap.conf
985 ##############################################################################
987 # General Configuration
989 ##############################################################################
992 # to obtain this number do: net getlocalsid
993 SID="S-1-5-21-725326080-1709766072-2910717368"
995 ##############################################################################
999 ##############################################################################
1001 # Notes: to use to dual ldap servers backend for Samba, you must patch
1002 # Samba with the dual-head patch from IDEALX. If not using this patch
1003 # just use the same server for slaveLDAP and masterLDAP.
1004 # Those two servers declarations can also be used when you have
1005 # . one master LDAP server where all writing operations must be done
1006 # . one slave LDAP server where all reading operations must be done
1007 # (typically a replication directory)
1009 # Ex: slaveLDAP=127.0.0.1
1010 slaveLDAP="127.0.0.1"
1013 # Master LDAP : needed for write operations
1014 # Ex: masterLDAP=127.0.0.1
1015 masterLDAP="127.0.0.1"
1019 # If set to 1, this option will use start_tls for connection
1020 # (you should also used the port 389)
1023 # How to verify the server's certificate (none, optional or require)
1024 # see "man Net::LDAP" in start_tls section for more details
1029 <example id="ch8ideal2">
1030 <title>Idealx smbldap-tools Control File &smbmdash; Part B</title>
1033 # see "man Net::LDAP" in start_tls section for more details
1035 certificate to use to connect to the ldap server
1036 # see "man Net::LDAP" in start_tls section for more details
1039 # key certificate to use to connect to the ldap server
1040 # see "man Net::LDAP" in start_tls section for more details
1044 # Ex: suffix=dc=IDEALX,dc=ORG
1045 suffix="ou=MEGANET2,dc=abmas,dc=biz"
1047 # Where are stored Users
1048 # Ex: usersdn="ou=Users,dc=IDEALX,dc=ORG"
1049 usersdn="ou=People,${suffix}"
1051 # Where are stored Computers
1052 # Ex: computersdn="ou=Computers,dc=IDEALX,dc=ORG"
1053 computersdn="ou=People,${suffix}"
1055 # Where are stored Groups
1056 # Ex groupsdn="ou=Groups,dc=IDEALX,dc=ORG"
1057 groupsdn="ou=Groups,${suffix}"
1059 # Where are stored Idmap entries (used if samba is a domain member server)
1060 # Ex groupsdn="ou=Idmap,dc=IDEALX,dc=ORG"
1061 idmapdn="ou=Idmap,${suffix}"
1063 # Where to store next uidNumber and gidNumber available
1064 sambaUnixIdPooldn="sambaDomainName=MEGANET2,dc=abmas,dc=biz"
1066 # Default scope Used
1071 <example id="ch8ideal3">
1072 <title>Idealx smbldap-tools Control File &smbmdash; Part C</title>
1074 # Unix password encryption (CRYPT, MD5, SMD5, SSHA, SHA)
1077 # if hash_encrypt is set to CRYPT, you may set a salt format.
1078 # default is "%s", but many systems will generate MD5 hashed
1079 # passwords if you use "$1$%.8s". This parameter is optional!
1080 crypt_salt_format="%s"
1082 ##############################################################################
1084 # Unix Accounts Configuration
1086 ##############################################################################
1089 # Default Login Shell
1090 # Ex: userLoginShell="/bin/bash"
1091 userLoginShell="/bin/false"
1094 # Ex: userHome="/home/%U"
1098 userGecos="Samba User"
1100 # Default User (POSIX and Samba) GID
1101 defaultUserGid="513"
1103 # Default Computer (Samba) GID
1104 defaultComputerGid="515"
1107 skeletonDir="/etc/skel"
1109 # Default password validation time (time in days) Comment the next line if
1110 # you don't want password to be enable for defaultMaxPasswordAge days (be
1111 # careful to the sambaPwdMustChange attribute's value)
1112 defaultMaxPasswordAge="45"
1116 <example id="ch8ideal4">
1117 <title>Idealx smbldap-tools Control File &smbmdash; Part D</title>
1119 ##############################################################################
1121 # SAMBA Configuration
1123 ##############################################################################
1125 # The UNC path to home drives location (%U username substitution)
1126 # Ex: \\My-PDC-netbios-name\homes\%U
1127 # Just set it to a null string if you want to use the smb.conf 'logon home'
1128 # directive and/or disable roaming profiles
1131 # The UNC path to profiles locations (%U username substitution)
1132 # Ex: \\My-PDC-netbios-name\profiles\%U
1133 # Just set it to a null string if you want to use the smb.conf 'logon path'
1134 # directive and/or disable roaming profiles
1137 # The default Home Drive Letter mapping
1138 # (will be automatically mapped at logon time if home directory exist)
1142 # The default user netlogon script name (%U username substitution)
1143 # if not used, will be automatically username.cmd
1144 # make sure script file is edited under DOS
1146 # userScript="startup.cmd" # make sure script file is edited under DOS
1149 # Domain appended to the users "mail"-attribute
1150 # when smbldap-useradd -M is used
1151 mailDomain="abmas.org"
1153 ##############################################################################
1155 # SMBLDAP-TOOLS Configuration (default are ok for a RedHat)
1157 ##############################################################################
1158 # Allows not to use smbpasswd (if with_smbpasswd == 0 in smbldap_conf.pm) but
1159 # prefer Crypt::SmbHash library
1161 smbpasswd="/usr/bin/smbpasswd"
1166 <indexterm><primary>TLS</primary></indexterm>
1167 Note: I chose not to take advantage of the TLS capability of this.
1168 Eventually I may go back and tweak it. Also, I chose not to take advantage
1169 of the master/slave configuration as I heard horror stories that it was
1170 unstable. My slave servers are replicas only.
1174 The <filename>/etc/smbldap-tools/smbldap_bind.conf</filename> file is shown here:
1178 # This file simply tells smbldap-tools how to bind to your LDAP server.
1179 # It has to be a DN with full write access to the Samba portion of
1182 ############################
1183 # Credential Configuration #
1184 ############################
1185 # Notes: you can specify two different configurations if you use a
1186 # master ldap for writing access and a slave ldap server for reading access
1187 # By default, we will use the same DN (so it will work for standard Samba
1189 slaveDN="cn=Manager,dc=abmas,dc=biz"
1190 slavePw="verysecret"
1191 masterDN="cn=Manager,dc=abmas,dc=biz"
1192 masterPw="verysecret"
1197 The next step was to run the <command>smbldap-populate</command> command, which populates
1198 the LDAP tree with the appropriate default users, groups, and UID and GID pools.
1199 It creates a user called Administrator with UID=0 and GID=0 matching the
1200 Domain Admins group. This is fine because you can still log on as root to a Windows system,
1201 but it will break cached credentials if you need to log on as the administrator
1202 to a system that is not on the network.
1206 After the LDAP database has been preloaded, it is prudent to validate that the
1207 information needed is in the LDAP directory. This can be done done by restarting
1208 the LDAP server, then performing an LDAP search by executing:
1210 &rootprompt; ldapsearch -W -x -b "dc=abmas,dc=biz"\
1211 -D "cn=Manager,dc=abmas,dc=biz" \
1213 Enter LDAP Password:
1217 # base <dc=abmas,dc=biz> with scope sub
1218 # filter: (ObjectClass=*)
1224 objectClass: dcObject
1225 objectClass: organization
1230 dn: ou=People,dc=abmas,dc=biz
1231 objectClass: organizationalUnit
1235 dn: ou=Groups,dc=abmas,dc=biz
1236 objectClass: organizationalUnit
1240 dn: ou=Idmap,dc=abmas,dc=biz
1241 objectClass: organizationalUnit
1248 <indexterm><primary>Windows</primary></indexterm>
1249 <indexterm><primary>POSIX</primary></indexterm>
1250 <indexterm><primary>smbldap-groupadd</primary></indexterm>
1251 <indexterm><primary>RID</primary></indexterm>
1252 <indexterm><primary>sambaGroupMapping</primary></indexterm>
1253 With the LDAP directory now initialized, it was time to create the Windows and POSIX
1254 (UNIX) group accounts as well as the mappings from Windows groups to UNIX groups.
1255 The easiest way to do this was to use <command>smbldap-groupadd</command> command.
1256 It creates the group with the posixGroup and sambaGroupMapping attributes, a
1257 unique GID, and an automatically determined RID. I learned the hard way not to
1258 try to do this by hand.
1262 <indexterm><primary>group mapping</primary></indexterm>
1263 <indexterm><primary>smbldap-groupmod</primary></indexterm>
1264 <indexterm><primary>memberUID</primary></indexterm>
1265 After I had my group mappings in place, I added users to the groups (the users
1266 don't really have to exist yet). I used the <command>smbldap-groupmod</command>
1267 command to accomplish this. It can also be done manually by adding memberUID
1268 attributes to the group entries in LDAP.
1272 <indexterm><primary>sambaSamAccount</primary></indexterm>
1273 <indexterm><primary>posixAccount</primary></indexterm>
1274 <indexterm><primary>smbldap-usermod</primary></indexterm>
1275 The most monumental task of all was adding the sambaSamAccount information to each
1276 already existent posixAccount entry. I did it one at a time as I moved people onto
1277 the new server, by issuing the command:
1279 &rootprompt; smbldap-usermod -a -P username
1281 <indexterm><primary>NetWare</primary></indexterm>
1282 <indexterm><primary>LDIF</primary></indexterm>
1283 <indexterm><primary>slapcat</primary></indexterm>
1284 I completed that step for every user after asking the person what his or her current
1285 NetWare password was. The wiser way to have done it would probably have been to dump the
1286 entire database to an LDIF file. This can be done by executing:
1288 &rootprompt; slapcat > somefile.ldif
1290 <indexterm><primary>Perl</primary></indexterm>
1291 <indexterm><primary>objectClass</primary></indexterm>
1292 Then update the LDIF file created by using a Perl script to parse and add the
1293 appropriate attributes and objectClasses to each entry, followed by re-importing
1294 the entire database into the LDAP directory.
1298 Rebuilding of the LDAP directory can be done as follows:
1300 &rootprompt; rcldap stop
1301 &rootprompt; cd /data/ldap
1302 &rootprompt; rm *bdb _* log*
1303 &rootprompt; su - ldap -c "slapadd -l somefile.ldif"
1304 &rootprompt; rcldap start
1306 This can be done at any time and for any reason, with no harm to the database.
1310 I first added a test user, of course. The LDIF for this test user looks like
1311 this, to give you an idea:
1313 # Entry 1: cn=Test User,ou=people,ou=corp,dc=abmas,dc=biz
1314 dn:cn=Test User,ou=people,ou=corp,dc=abmas,dc=biz
1319 homeDirectory: /home/test.user
1326 objectClass: inetOrgPerson
1327 objectClass: posixAccount
1328 objectClass: sambaSamAccount
1335 sambaLogoffTime: 2147483647
1336 sambaKickoffTime: 2147483647
1337 sambaPwdCanChange: 0
1338 displayName: Samba User
1339 sambaSID: S-1-5-21-725326080-1709766072-2910717368-3148
1340 sambaLMPassword: 9D29C287C58448F9AAD3B435B51404EE
1342 sambaNTPassword: D062088E99C95E37D7702287BB35E770
1343 sambaPwdLastSet: 1102537694
1344 sambaPwdMustChange: 1106425694
1345 userPassword: {SSHA}UzFZ2VxRGdwUueLnTGtsTBtnsvMO1oj8
1346 loginShell: /bin/false
1351 Then I went over to a spare Windows NT machine and joined it to the MEGANET2 domain.
1352 It worked, and the machine's account entry under ou=Computers looks like this:
1354 dn:uid=w2kengrspare$,ou=Computers,ou=MEGANET2,dc=abmas,dc=biz
1356 objectClass: inetOrgPerson
1357 objectClass: posixAccount
1358 objectClass: sambaSamAccount
1364 homeDirectory: /dev/null
1365 loginShell: /bin/false
1366 description: Computer
1368 sambaSID: S-1-5-21-725326080-1709766072-2910717368-3208
1369 sambaPrimaryGroupSID: S-1-5-21-725326080-1709766072-2910717368-2031
1370 displayName: W2KENGRSPARE$
1371 sambaPwdCanChange: 1103149236
1372 sambaPwdMustChange: 2147483647
1373 sambaNTPassword: CA199C45CB6737035DB6D9D9F6CD1834
1374 sambaPwdLastSet: 1103149236
1375 sambaAcctFlags: [W ]
1380 <indexterm><primary>netlogon</primary></indexterm>
1381 So now I could log on with a test user from the machine w2kengrspare. It was all well and
1382 good, but that user was in no groups yet and so had pretty boring access. I fixed that
1383 by writing the login script! To write the login script, I used
1384 <ulink url="http://www.kixtart.org">Kixtart</ulink> because it will work
1385 with every architecture of Windows, has an active and helpful user base, and was both
1386 easier to learn and more powerful than the standard netlogon scripts I have seen.
1387 I also did not have to do a logon script per user or per group.
1391 <indexterm><primary>Kixtart</primary></indexterm>
1392 I downloaded Kixtart and put the following files in my netlogon share:
1396 KX95.dll <-- Not needed unless you are running Win9x clients.
1397 kx16.dll <-- Probably not needed unless you are running DOS clients.
1398 kxrpc.exe <-- Probably useless as it has to run on the server and can
1399 only be run on NT. It's for Windows 95 to become group-aware.
1400 We can get around the need.
1405 <indexterm><primary>logon.kix</primary></indexterm>
1406 I then wrote the <filename>logon.kix</filename> file that is shown in
1407 <link linkend="ch8kix"/>. I chose to keep it all in one file, but it
1408 can be split up and linked via include directives.
1411 <example id="ch8kix">
1412 <title>Kixtart Control File &smbmdash; File: logon.kix</title>
1414 ; This script just calls the other scripts.
1416 ; First we want to get things done for everyone.
1418 ; Second, we do first-time login stuff.
1420 ; Third, we go through the group-oriented scripts one at a time.
1423 ; We want to check for group membership here to avoid the overhead of running
1424 ; scripts which don't apply.
1425 call "\\massive\netlogon\scripts\main.kix"
1426 call "\\massive\netlogon\scripts\setup.kix"
1427 IF INGROUP("MEGANET2\ACCT")
1428 call "scripts\acct.kix"
1430 IF INGROUP("MEGANET2\ENGR","MEGANET2\RECEPTIONIST")
1431 call "\\massive\netlogon\scripts\engr.kix"
1433 IF INGROUP("MEGANET2\FURN")
1434 call "\\massive\netlogon\scripts\furn.kix"
1436 IF INGROUP("MEGANET2\TRUSS")
1437 call "\\massive\netlogon\scripts\truss.kix"
1442 <example id="ch8kix2">
1443 <title>Kixtart Control File &smbmdash; File: main.kix</title>
1447 ; Choose whether to hide the login window or not
1448 IF INGROUP("MEGANET2\Domain Admins")
1449 USE Z: \\massive\everything
1452 ; Nobody cares about seeing the login script except admins
1456 ; Delete all previously connected shares
1459 SETTITLE("Logging on @USERID to @LDOMAIN at @TIME")
1461 ; Set the time on the workstation
1462 $Timeserver = "\\massive"
1465 ; Map the home directory
1466 USE H: @HOMESHR ; connect to user's home share
1470 CD @HOMEDIR ; change directory to user's home directory
1473 ; Everyone gets the N drive
1474 USE N: \\massive\network
1478 <example id="ch8kix3">
1479 <title>Kixtart Control File &smbmdash; File: setup.kix, Part A</title>
1481 ; My setup.kix is where all of the redirection stuff happens. Note that with
1482 ; the use of registry keys, this only happens the first time they log in ,or if
1483 ; I delete the pertinent registry keys which triggers it to happen again:
1485 ; Check to see if we have written the abmas sub-key before
1486 $RETURNCODE = EXISTKEY("HKEY_CURRENT_USER\abmas")
1487 IF NOT $RETURNCODE = 0
1488 ; Add key for abmas-specific things on the first login
1489 ADDKEY("HKEY_CURRENT_USER\abmas")
1490 ; The following key gets deleted at the end of the first login
1491 ADDKEY("HKEY_CURRENT_USER\abmas\FIRST_LOGIN")
1494 ; People with laptops need My Documents to be in their profile. People with
1495 ; desktops can have My Documents redirected to their home directory to avoid
1496 ; long delays with logging out and out-of-sync files.
1498 ; Check to see if this is the first login -- doesn't make sense to do this
1499 ; at the very first login
1501 $RETURNCODE = EXISTKEY("HKEY_CURRENT_USER\abmas\FIRST_LOGIN")
1502 IF NOT $RETURNCODE = 0
1504 ; We don't want to do this stuff for people with laptops or people in the FURN
1505 ; group. (They store their profiles in a different server)
1507 IF NOT INGROUP("MASSIVE\Laptop","MASSIVE\FURN")
1508 $RETURNCODE=EXISTKEY("HKEY_CURRENT_USER\abmas\profile_copied")
1510 ; A crude way to tell what OS our profile is for and copy the "My Documents"
1511 ; to the redirected folder on the server. It works because the profiles
1512 ; are stored as \\server\profiles\user\architecture
1513 IF NOT $RETURNCODE = 0
1514 IF EXIST("\\massive\profiles\@userID\WinXP")
1515 copy "\\massive\profiles\@userID\WinXP\My Documents\*"
1516 "\\massive\@userID\"
1518 IF EXIST("\\massive\profiles\@userID\Win2K")
1519 copy "\\massive\profiles\@userID\Win2K\My Documents\*"
1520 "\\massive\@userID\"
1522 IF EXIST("\\massive\profiles\@userID\WinNT")
1523 copy "\\massive\profiles\@userID\WinNT\My Documents\*"
1524 "\\massive\@userID\"
1529 <example id="ch8kix3b">
1530 <title>Kixtart Control File &smbmdash; File: setup.kix, Part B</title>
1532 ; Now we will write the registry values to redirect the locations of "My
1534 ; and other folders.
1535 ADDKEY("HKEY_CURRENT_USER\abmas\profile_copied")
1536 WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\
1537 Windows\CurrentVersion\Explorer\User
1538 Shell Folders", "Personal","\\massive\@userID","REG_SZ")
1539 WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\
1540 Windows\CurrentVersion\Explorer\User
1541 Shell Folders", "My Pictures", "\\massive\@userID\My Pictures", "REG_SZ")
1542 IF @PRODUCTTYPE="Windows 2000 Professional" or @PRODUCTTYPE="Windows XP
1544 WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\
1545 Windows\CurrentVersion\Explorer\User
1546 Shell Folders", "My Videos", "\\massive\@userID\My Videos", "REG_SZ")
1547 WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\
1548 Windows\CurrentVersion\Explorer\User
1549 Shell Folders", "My Music", "\\massive\@userID\My Music", "REG_SZ")
1550 WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\
1551 Windows\CurrentVersion\Explorer\User
1552 Shell Folders", "My eBooks", "\\massive\@userID\My eBooks", "REG_SZ")
1557 ; Now we will delete the FIRST_LOGIN sub-key that we made before.
1558 ; Note - to run this script again you will want to delete the HKCU\abmas
1559 ; sub-key, log out, and log back in.
1560 $RETURNVALUE = EXISTKEY("HKEY_CURRENT_USER\abmas\FIRST_LOGIN")
1562 DELKEY("HKEY_CURRENT_USER\abmas\FIRST_LOGIN")
1567 <example id="ch8kix4">
1568 <title>Kixtart Control File &smbmdash; File: acct.kix</title>
1570 ; And here is one group-oriented script to show what can be
1571 ; done that way: acct.kix:
1573 IF INGROUP("MASSIVE\Acct_Admin","MASSIVE\HR")
1574 USE I: \\MEGANET2\HR_PR
1578 $RETURNVALUE = existkey("HKEY_CURRENT_USER\Printers\,,massive,acct_hp8500")
1579 IF NOT $RETURNVALUE = 0
1580 ADDPRINTERCONNECTION("\\massive\acct_hp8500")
1581 SETDEFAULTPRINTER("\\massive\acct_hp8500")
1583 ; Set up drive mappings
1584 USE M: \\massive\ACCT
1585 IF INGROUP("MEGANET2\ABRA")
1586 USE T: \\trussrv\abra
1592 As you can see in the script, I redirected the My Documents to the user's home
1593 share if he or she were not in the Laptop group. I also added printers on a
1594 group-by-group basis, and if applicable I set the group printer. For this to
1595 be effective, the print drivers must be installed on the Samba server in the
1596 <filename>[print$]</filename> share. Ample documentation exists about how to
1597 do that, so it is not covered here.
1601 I call this script via the logon.bat script in the [netlogon] directory:
1603 \\corpsrv\netlogon\kix32 \\corpsrv\netlogon\logon.kix /f
1605 I only had to fully qualify the paths for Windows 9x, as Windows NT and
1606 greater automatically add [NETLOGON] to the path.
1610 Also of note for Win9x is that the drive mappings and printer setup will not
1611 work because they rely on RPC. You merely have to put the appropriate settings
1612 into the <filename>c:\autoexec.bat</filename> file or map the drives manually.
1613 One option is to check the OS as part of the Kixtart script, and if it
1614 is Win9x and is the first login, copy a premade
1615 <filename>autoexec.bat</filename> to the <filename>C:</filename> drive. I
1616 have only three such machines, and one is going away in the very near future,
1617 so it was easier to do it by hand.
1621 <indexterm><primary>upgrade</primary></indexterm>
1622 At this point I was able to add the users. This is the part that really falls
1623 into upgrade. I moved the users over one group at a time, starting with the
1624 people who used the least amount of resources on the network. With each group
1625 that I moved, I first logged on as a standard user in that group and took
1626 careful note of the environment, mainly the printers he or she used, the PATH,
1627 and what network resources he or she had access to (most importantly, which ones
1628 the user actually needed access to).
1632 I then added the user's SambaSamAccount information as mentioned earlier,
1633 and join the computer to the domain. The very first thing I had to do was to
1634 copy the user's profile to the new server. This was very important, and I really
1635 struggled with the most effective way to do it. Here is the method that worked
1636 for every one of my users on Windows NT, 2000, and XP:
1641 Log in as the user on the domain. This creates the local copy
1642 of the user's profile and copies it to the server as he or she logs out.
1646 Reboot the computer and log in as the local machine administrator.
1650 Right-click My Computer, click Properties, and navigate to the
1651 user profiles tab (varies per version of Windows).
1655 Select the user's local profile <constant>(COMPUTERNAME\username)</constant>,
1656 and click the <command>Copy To</command> button.
1660 In the next dialog, copy it directly to the profiles share on the
1661 Samba server (\\PDCname\profiles\user\<architecture> in my
1662 case). You will have had to make a connection to the share as that
1663 user (e.g., Windows Explorer type \\PDCname\profiles\username).
1667 When the copy is complete (it can take a while) log out, and log back in
1668 as the user. All of his or her settings and all contents of My Documents,
1669 Favorites, and the registry should have been copied successfully.
1673 If it doesn't look right (the dead giveaway is the desktop background),
1674 shut down the computer without logging out (power cycle) and try logging
1675 in as the user again. If it still doesn't work, repeat the steps above.
1676 I only had to ever repeat it once.
1687 If the user was anything other than a standard user on his or her system
1688 before, you will save yourself some headaches by giving him or her identical
1689 permissions (on the local machine) as his or her domain account <emphasis>before</emphasis>
1690 copying the profile over. Do this through the User Administrator
1691 in the Control Panel, after joining the computer to the domain and
1692 before logging on as that user for the first time. Otherwise the user will
1693 have trouble with permissions on his or her registry keys.
1697 If any application was installed for the user only, rather than for
1698 the entire system, it will probably not work without being reinstalled.
1703 After all these steps are accomplished, only cleanup details are left. Make sure user's
1704 shortcuts and Network Places point to the appropriate place on the new server, check
1705 the important applications to be sure they work as expected and troubleshoot any problems
1706 that might arise, and check to be sure the user's printers are present and working. By the
1707 way, if there are any network printers installed as system printers (the Novell way),
1708 you will need to log in as a local administrator and delete them.
1712 For my non-laptop systems, I would then log in and out a couple times as the user
1713 to be sure that his or her registry settings were modified, and then I was finished.
1717 Some compatibility issues that cropped up included the following:
1721 Blackberry client: It did not like having its registry settings moved around
1722 and so had to be reinstalled. Also, it needed write permissions to a portion of
1723 the hard drive, and I had to give it those manually on the one system where
1728 CAMedia: Digital camera software for Canon cameras caused all kinds of trouble
1729 with the registry. I had to use the Run as service to open the registry of
1730 the local user while logged in as the domain user, and give the domain user
1731 the appropriate permissions to some registry keys, then export that portion
1732 of the registry to a file. Then, as the domain user, I had to import that file
1737 Crystal Reports version 7: More registry problems that were solved by recopying
1742 Printing from legacy applications: I found out that Novell sends its jobs to
1743 the printer in a raw format. CUPS sends them in PostScript by default. I had
1744 to make a second printer definition for one printer and tell CUPS specifically
1745 to send raw data to the printer, then assign this printer to the LPT port with
1746 Kixtart's version of the net use command.
1750 These were all eventually solved by elbow grease, queries to the Samba mailing
1751 list and others, and diligence. The complete migration took about 5 weeks.
1752 My userbase is relatively small but includes multiple versions of Windows,
1753 multiple Linux member servers, a mechanized saw, a pen plotter, and legacy
1754 applications written in Qbasic and R:Base, just to name a few. I actually
1755 ended up making some of these applications work better (or work again, as
1756 some of them had stopped functioning on the old server) because as part of
1757 the process I had to find out how things were supposed to work.
1761 The one thing I have not been able to get working is a very old database that
1762 we had around for reference purposes; it uses Novell's Btrieve engine.
1766 As the resources compare, I went from 95 percent disk usage to just around 10 percent.
1767 I went from a very high load on the server to an average load of between one
1768 and two runnable processes on the server. I have improved the security and
1769 robustness of the system. I have also implemented
1770 <ulink url="http://www.clamav.net">ClamAV</ulink> antivirus software,
1771 which scans the entire Samba server for viruses every 2 hours and
1772 quarantines them. I have found it much less problematic than our ancient
1773 version of Norton Antivirus Corporate Edition, and much more up-to-date.
1777 In short, my users are much happier now that the new server is running, and that
1778 is what is important to me.