sort out some include dependencies
[ira/wip.git] / docs / htmldocs / Samba-HOWTO-Collection.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>SAMBA Project Documentation</title><link rel="stylesheet" href="samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.59.1"><meta name="description" content="
2 This book is a collection of HOWTOs added to Samba documentation over the years.
3 Samba is always under development, and so is its' documentation. This release of the
4 documentation represents a major revision or layout as well as contents.
5 The most recent version of this document can be found at
6 http://www.samba.org/
7 on the &quot;Documentation&quot; page.  Please send updates to
8 Jelmer Venrooij,
9 John Terpstra or
10 Gerald (Jerry) Carter.
11  
12 The Samba-Team would like to express sincere thanks to the many people who have with
13 or without their knowledge contributed to this update. The size and scope of this
14 project would not have been possible without significant community contribution. A not
15 insignificant number of ideas for inclusion (if not content itself) has been obtained
16 from a number of Unofficial HOWTOs - to each such author a big &quot;Thank-you&quot; is also offered.
17 Please keep publishing your Unofficial HOWTO's - they are a source of inspiration and
18 application knowledge that is most to be desired by many Samba users and administrators.
19 "></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book" lang="en"><div class="titlepage"><div><h1 class="title"><a name="Samba-HOWTO-Collection"></a>SAMBA Project Documentation</h1></div><div><div class="author"><h3 class="author">SAMBA Team</h3><div class="affiliation"><div class="address"><p><tt>&lt;<a href="mailto:samba@samba.org">samba@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="legalnotice"><p>
20 This documentation is distributed under the GNU General Public License (GPL) 
21 version 2.  A copy of the license is included with the Samba source
22 distribution.  A copy can be found on-line at <a href="http://www.fsf.org/licenses/gpl.txt" target="_top">http://www.fsf.org/licenses/gpl.txt</a>
23 </p></div></div><div><p class="pubdate">Monday April 21, 2003</p></div><div><div class="abstract"><p class="title"><b>Abstract</b></p><p>
24 This book is a collection of HOWTOs added to Samba documentation over the years.
25 Samba is always under development, and so is its' documentation. This release of the
26 documentation represents a major revision or layout as well as contents.
27 The most recent version of this document can be found at
28 <a href="http://www.samba.org/" target="_top">http://www.samba.org/</a>
29 on the &quot;Documentation&quot; page.  Please send updates to
30 <a href="mailto:jelmer@samba.org" target="_top">Jelmer Venrooij</a>,
31 <a href="mailto:jht@samba.org" target="_top">John Terpstra</a> or
32 <a href="mailto:jerry@samba.org" target="_top">Gerald (Jerry) Carter</a>.
33 </p><p>
34 The Samba-Team would like to express sincere thanks to the many people who have with
35 or without their knowledge contributed to this update. The size and scope of this
36 project would not have been possible without significant community contribution. A not
37 insignificant number of ideas for inclusion (if not content itself) has been obtained
38 from a number of Unofficial HOWTOs - to each such author a big &quot;Thank-you&quot; is also offered.
39 Please keep publishing your Unofficial HOWTO's - they are a source of inspiration and
40 application knowledge that is most to be desired by many Samba users and administrators.
41 </p></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>I. <a href="#introduction">General Installation</a></dt><dd><dl><dt>1. <a href="#IntroSMB">Introduction to Samba</a></dt><dd><dl><dt><a href="#id2794048">Background</a></dt><dt><a href="#id2794106">Terminology</a></dt><dt><a href="#id2795149">Related Projects</a></dt><dt><a href="#id2845311">SMB Methodology</a></dt><dt><a href="#id2790901">Additional Resources</a></dt><dt><a href="#id2793926">Epilogue</a></dt><dt><a href="#id2844986">Miscellaneous</a></dt></dl></dd><dt>2. <a href="#install">How to Install and Test SAMBA</a></dt><dd><dl><dt><a href="#id2844847">Obtaining and installing samba</a></dt><dt><a href="#id2845201">Configuring samba</a></dt><dd><dl><dt><a href="#id2844744">Editing the smb.conf file</a></dt><dt><a href="#id2858916">SWAT</a></dt></dl></dd><dt><a href="#id2858954">Try listing the shares available on your 
42         server</a></dt><dt><a href="#id2859005">Try connecting with the unix client</a></dt><dt><a href="#id2859108">Try connecting from a DOS, WfWg, Win9x, WinNT, 
43         Win2k, OS/2, etc... client</a></dt><dt><a href="#id2859169">What If Things Don't Work?</a></dt></dl></dd></dl></dd><dt>II. <a href="#type">Server Configuration Basics</a></dt><dd><dl><dt>3. <a href="#ServerType">Nomenclature of Server Types</a></dt><dd><dl><dt><a href="#id2845139">Stand Alone Server</a></dt><dt><a href="#id2859402">Domain Member Server</a></dt><dt><a href="#id2859442">Domain Controller</a></dt><dd><dl><dt><a href="#id2859458">Domain Controller Types</a></dt></dl></dd></dl></dd><dt>4. <a href="#securitylevels">Samba as Stand-Alone Server</a></dt><dd><dl><dt><a href="#id2859216">User and Share security level</a></dt><dd><dl><dt><a href="#id2859238">User Level Security</a></dt><dt><a href="#id2859720">Share Level Security</a></dt><dt><a href="#id2859774">Server Level Security</a></dt><dt><a href="#id2860095">Domain Level Security</a></dt><dt><a href="#id2860234">ADS Level Security</a></dt></dl></dd></dl></dd><dt>5. <a href="#samba-pdc">
44 Samba as an NT4 or Win2k Primary Domain Controller
45 </a></dt><dd><dl><dt><a href="#id2859583">Prerequisite Reading</a></dt><dt><a href="#id2859607">
46 Background
47 </a></dt><dt><a href="#id2860563">Configuring the Samba Domain Controller</a></dt><dt><a href="#id2860863">Creating Machine Trust Accounts and Joining Clients to the Domain</a></dt><dd><dl><dt><a href="#id2861132">Manual Creation of Machine Trust Accounts</a></dt><dt><a href="#id2861366">&quot;On-the-Fly&quot; Creation of Machine Trust Accounts</a></dt><dt><a href="#id2861423">Joining the Client to the Domain</a></dt></dl></dd><dt><a href="#id2861529">Common Problems and Errors</a></dt><dd><dl><dt><a href="#id2861536">I cannot include a '$' in a machine name</a></dt><dt><a href="#id2861574">I get told &quot;You already have a connection to the Domain....&quot; 
48 or &quot;Cannot join domain, the credentials supplied conflict with an 
49 existing set..&quot; when creating a machine trust account.</a></dt><dt><a href="#id2861621">The system can not log you on (C000019B)....</a></dt><dt><a href="#id2861672">The machine trust account for this computer either does not 
50 exist or is not accessible.</a></dt><dt><a href="#id2861721">When I attempt to login to a Samba Domain from a NT4/W2K workstation,
51 I get a message about my account being disabled.</a></dt></dl></dd><dt><a href="#id2861746">Domain Control for Windows 9x/ME</a></dt><dd><dl><dt><a href="#id2861910">Configuration Instructions:       Network Logons</a></dt></dl></dd></dl></dd><dt>6. <a href="#samba-bdc">
52 Samba Backup Domain Controller to Samba Domain Control
53 </a></dt><dd><dl><dt><a href="#id2845056">Prerequisite Reading</a></dt><dt><a href="#id2860294">Background</a></dt><dt><a href="#id2862166">What qualifies a Domain Controller on the network?</a></dt><dd><dl><dt><a href="#id2862187">How does a Workstation find its domain controller?</a></dt><dt><a href="#id2862212">When is the PDC needed?</a></dt></dl></dd><dt><a href="#id2862231">Can Samba be a Backup Domain Controller to an NT PDC?</a></dt><dt><a href="#id2862264">How do I set up a Samba BDC?</a></dt><dd><dl><dt><a href="#id2862361">How do I replicate the smbpasswd file?</a></dt><dt><a href="#id2862390">Can I do this all with LDAP?</a></dt></dl></dd></dl></dd><dt>7. <a href="#ADS">Samba as a ADS domain member</a></dt><dd><dl><dt><a href="#id2862021">Setup your smb.conf</a></dt><dt><a href="#id2862571">Setup your /etc/krb5.conf</a></dt><dt><a href="#ads-create-machine-account">Create the computer account</a></dt><dd><dl><dt><a href="#id2862765">Possible errors</a></dt></dl></dd><dt><a href="#ads-test-server">Test your server setup</a></dt><dt><a href="#ads-test-smbclient">Testing with smbclient</a></dt><dt><a href="#id2862919">Notes</a></dt></dl></dd><dt>8. <a href="#domain-member">Samba as a NT4 or Win2k domain member</a></dt><dd><dl><dt><a href="#id2862413">Joining an NT Domain with Samba 3.0</a></dt><dt><a href="#id2863318">Why is this better than security = server?</a></dt></dl></dd></dl></dd><dt>III. <a href="#optional">Advanced Configuration</a></dt><dd><dl><dt>9. <a href="#NetworkBrowsing">Samba / MS Windows Network Browsing Guide</a></dt><dd><dl><dt><a href="#id2862996">What is Browsing?</a></dt><dt><a href="#id2863646">Discussion</a></dt><dt><a href="#id2863809">How Browsing Functions</a></dt><dd><dl><dt><a href="#id2863936">Setting up WORKGROUP Browsing</a></dt><dt><a href="#id2864124">Setting up DOMAIN Browsing</a></dt><dt><a href="#browse-force-master">Forcing samba to be the master</a></dt><dt><a href="#id2864390">Making samba the domain master</a></dt><dt><a href="#id2864538">Note about broadcast addresses</a></dt><dt><a href="#id2864555">Multiple interfaces</a></dt><dt><a href="#id2864584">Use of the Remote Announce parameter</a></dt><dt><a href="#id2864695">Use of the Remote Browse Sync parameter</a></dt></dl></dd><dt><a href="#id2864763">WINS - The Windows Internetworking Name Server</a></dt><dd><dl><dt><a href="#id2863586">Setting up a WINS server</a></dt><dt><a href="#id2865218">WINS Replication</a></dt><dt><a href="#id2865243">Static WINS Entries</a></dt></dl></dd><dt><a href="#id2865274">Helpful Hints</a></dt><dd><dl><dt><a href="#id2865287">Windows Networking Protocols</a></dt><dt><a href="#id2865354">Name Resolution Order</a></dt></dl></dd><dt><a href="#id2865470">Technical Overview of browsing</a></dt><dd><dl><dt><a href="#id2865517">Browsing support in samba</a></dt><dt><a href="#id2865624">Problem resolution</a></dt><dt><a href="#id2865703">Browsing across subnets</a></dt></dl></dd></dl></dd><dt>10. <a href="#passdb">User information database</a></dt><dd><dl><dt><a href="#id2866099">Introduction</a></dt><dt><a href="#id2866152">Important Notes About Security</a></dt><dd><dl><dt><a href="#id2866314">Advantages of SMB Encryption</a></dt><dt><a href="#id2866353">Advantages of non-encrypted passwords</a></dt></dl></dd><dt><a href="#id2866388">The smbpasswd Command</a></dt><dt><a href="#id2866568">Plain text</a></dt><dt><a href="#id2866597">TDB</a></dt><dt><a href="#id2866613">LDAP</a></dt><dd><dl><dt><a href="#id2866621">Introduction</a></dt><dt><a href="#id2866721">Encrypted Password Database</a></dt><dt><a href="#id2866860">Supported LDAP Servers</a></dt><dt><a href="#id2866898">Schema and Relationship to the RFC 2307 posixAccount</a></dt><dt><a href="#id2867008">Configuring Samba with LDAP</a></dt><dt><a href="#id2867304">Accounts and Groups management</a></dt><dt><a href="#id2867341">Security and sambaAccount</a></dt><dt><a href="#id2867456">LDAP specials attributes for sambaAccounts</a></dt><dt><a href="#id2867737">Example LDIF Entries for a sambaAccount</a></dt></dl></dd><dt><a href="#id2867793">MySQL</a></dt><dd><dl><dt><a href="#id2867800">Creating the database</a></dt><dt><a href="#id2867854">Configuring</a></dt><dt><a href="#id2867999">Using plaintext passwords or encrypted password</a></dt><dt><a href="#id2868029">Getting non-column data from the table</a></dt></dl></dd><dt><a href="#id2868072">XML</a></dt></dl></dd><dt>11. <a href="#unix-permissions">UNIX Permission Bits and Windows NT Access Control Lists</a></dt><dd><dl><dt><a href="#id2865054">Viewing and changing UNIX permissions using the NT 
54         security dialogs</a></dt><dt><a href="#id2864937">How to view file security on a Samba share</a></dt><dt><a href="#id2868280">Viewing file ownership</a></dt><dt><a href="#id2868401">Viewing file or directory permissions</a></dt><dd><dl><dt><a href="#id2868484">File Permissions</a></dt><dt><a href="#id2868587">Directory Permissions</a></dt></dl></dd><dt><a href="#id2868637">Modifying file or directory permissions</a></dt><dt><a href="#id2868797">Interaction with the standard Samba create mask 
55         parameters</a></dt><dt><a href="#id2869113">Interaction with the standard Samba file attribute 
56         mapping</a></dt></dl></dd><dt>12. <a href="#groupmapping">Configuring Group Mapping</a></dt><dt>13. <a href="#printing">Printing Support</a></dt><dd><dl><dt><a href="#id2869498">Introduction</a></dt><dt><a href="#id2869614">Configuration</a></dt><dd><dl><dt><a href="#id2869661">Creating [print$]</a></dt><dt><a href="#id2869893">Setting Drivers for Existing Printers</a></dt><dt><a href="#id2869992">Support a large number of printers</a></dt><dt><a href="#id2870099">Adding New Printers via the Windows NT APW</a></dt><dt><a href="#id2870231">Samba and Printer Ports</a></dt></dl></dd><dt><a href="#id2869233">The Imprints Toolset</a></dt><dd><dl><dt><a href="#id2869259">What is Imprints?</a></dt><dt><a href="#id2870336">Creating Printer Driver Packages</a></dt><dt><a href="#id2870355">The Imprints server</a></dt><dt><a href="#id2870379">The Installation Client</a></dt></dl></dd><dt><a href="#id2869340">Diagnosis</a></dt><dd><dl><dt><a href="#id2869347">Introduction</a></dt><dt><a href="#id2870552">Debugging printer problems</a></dt><dt><a href="#id2870619">What printers do I have?</a></dt><dt><a href="#id2870661">Setting up printcap and print servers</a></dt><dt><a href="#id2870795">Job sent, no output</a></dt><dt><a href="#id2871344">Job sent, strange output</a></dt><dt><a href="#id2871420">Raw PostScript printed</a></dt><dt><a href="#id2871438">Advanced Printing</a></dt><dt><a href="#id2871464">Real debugging</a></dt></dl></dd></dl></dd><dt>14. <a href="#CUPS-printing">CUPS Printing Support</a></dt><dd><dl><dt><a href="#id2871008">Introduction</a></dt><dt><a href="#id2871067">Configuring smb.conf for CUPS</a></dt><dt><a href="#id2871607">CUPS - RAW Print Through Mode</a></dt><dt><a href="#id2871091">CUPS as a network PostScript RIP</a></dt><dt><a href="#id2872272">Windows Terminal Servers (WTS) as CUPS clients</a></dt><dt><a href="#id2872314">Setting up CUPS for driver download</a></dt><dt><a href="#id2872401">Sources of CUPS drivers / PPDs</a></dt><dd><dl><dt><a href="#id2872566">cupsaddsmb</a></dt></dl></dd><dt><a href="#id2872915">The CUPS Filter Chains</a></dt><dt><a href="#id2873302">CUPS Print Drivers and Devices</a></dt><dd><dl><dt><a href="#id2873339">Further printing steps</a></dt></dl></dd><dt><a href="#id2873758">Limiting the number of pages users can print</a></dt><dt><a href="#id2874367">Advanced Postscript Printing from MS Windows</a></dt><dt><a href="#id2874473">Auto-Deletion of CUPS spool files</a></dt></dl></dd><dt>15. <a href="#winbind">Unified Logons between Windows NT and UNIX using Winbind</a></dt><dd><dl><dt><a href="#id2874714">Abstract</a></dt><dt><a href="#id2874743">Introduction</a></dt><dt><a href="#id2874814">What Winbind Provides</a></dt><dd><dl><dt><a href="#id2872076">Target Uses</a></dt></dl></dd><dt><a href="#id2872107">How Winbind Works</a></dt><dd><dl><dt><a href="#id2872135">Microsoft Remote Procedure Calls</a></dt><dt><a href="#id2872170">Microsoft Active Directory Services</a></dt><dt><a href="#id2872192">Name Service Switch</a></dt><dt><a href="#id2875280">Pluggable Authentication Modules</a></dt><dt><a href="#id2875352">User and Group ID Allocation</a></dt><dt><a href="#id2875387">Result Caching</a></dt></dl></dd><dt><a href="#id2875414">Installation and Configuration</a></dt><dd><dl><dt><a href="#id2875442">Introduction</a></dt><dt><a href="#id2875518">Requirements</a></dt><dt><a href="#id2875611">Testing Things Out</a></dt></dl></dd><dt><a href="#id2877210">Limitations</a></dt><dt><a href="#id2877264">Conclusion</a></dt></dl></dd><dt>16. <a href="#AdvancedNetworkManagement">Advanced Network Manangement</a></dt><dd><dl><dt><a href="#id2875143">Configuring Samba Share Access Controls</a></dt><dd><dl><dt><a href="#id2874905">Share Permissions Management</a></dt></dl></dd><dt><a href="#id2874974">Remote Server Administration</a></dt><dt><a href="#id2875057">Network Logon Script Magic</a></dt><dd><dl><dt><a href="#id2877889">Adding printers without user intervention</a></dt></dl></dd></dl></dd><dt>17. <a href="#PolicyMgmt">System and Account Policies</a></dt><dd><dl><dt><a href="#id2877672">Creating and Managing System Policies</a></dt><dd><dl><dt><a href="#id2877925">Windows 9x/Me Policies</a></dt><dt><a href="#id2878014">Windows NT4 Style Policy Files</a></dt><dt><a href="#id2878140">MS Windows 200x / XP Professional Policies</a></dt></dl></dd><dt><a href="#id2878344">Managing Account/User Policies</a></dt><dd><dl><dt><a href="#id2878457">With Windows NT4/200x</a></dt><dt><a href="#id2878478">With a Samba PDC</a></dt></dl></dd><dt><a href="#id2878502">System Startup and Logon Processing Overview</a></dt></dl></dd><dt>18. <a href="#ProfileMgmt">Desktop Profile Management</a></dt><dd><dl><dt><a href="#id2877599">Roaming Profiles</a></dt><dd><dl><dt><a href="#id2877483">Samba Configuration for Profile Handling</a></dt><dt><a href="#id2879080">Windows Client Profile Configuration Information</a></dt><dt><a href="#id2879695">Sharing Profiles between W9x/Me and NT4/200x/XP workstations</a></dt><dt><a href="#id2879742">Profile Migration from Windows NT4/200x Server to Samba</a></dt></dl></dd><dt><a href="#id2879925">Mandatory profiles</a></dt><dt><a href="#id2879970">Creating/Managing Group Profiles</a></dt><dt><a href="#id2880011">Default Profile for Windows Users</a></dt><dd><dl><dt><a href="#id2880040">MS Windows 9x/Me</a></dt><dt><a href="#id2880129">MS Windows NT4 Workstation</a></dt><dt><a href="#id2880513">MS Windows 200x/XP</a></dt></dl></dd></dl></dd><dt>19. <a href="#InterdomainTrusts">Interdomain Trust Relationships</a></dt><dd><dl><dt><a href="#id2878684">Trust Relationship Background</a></dt><dt><a href="#id2881006">Native MS Windows NT4 Trusts Configuration</a></dt><dd><dl><dt><a href="#id2881019">NT4 as the Trusting Domain (ie. creating the trusted account)</a></dt><dt><a href="#id2881063">NT4 as the Trusted Domain (ie. creating trusted account's password)</a></dt></dl></dd><dt><a href="#id2881087">Configuring Samba NT-style Domain Trusts</a></dt><dd><dl><dt><a href="#id2881114">Samba-3 as the Trusting Domain</a></dt><dt><a href="#id2881210">Samba-3 as the Trusted Domain</a></dt></dl></dd></dl></dd><dt>20. <a href="#pam">PAM Configuration for Centrally Managed Authentication</a></dt><dd><dl><dt><a href="#id2880956">Samba and PAM</a></dt><dd><dl><dt><a href="#id2881738">PAM Configuration in smb.conf</a></dt><dt><a href="#id2881795">Password Synchronisation using pam_smbpass.so</a></dt></dl></dd><dt><a href="#id2882047">Distributed Authentication</a></dt></dl></dd><dt>21. <a href="#VFS">Stackable VFS modules</a></dt><dd><dl><dt><a href="#id2881331">Introduction and configuration</a></dt><dt><a href="#id2882249">Included modules</a></dt><dd><dl><dt><a href="#id2882256">audit</a></dt><dt><a href="#id2882295">extd_audit</a></dt><dt><a href="#id2882416">recycle</a></dt><dt><a href="#id2882554">netatalk</a></dt></dl></dd><dt><a href="#id2882592">VFS modules available elsewhere</a></dt><dd><dl><dt><a href="#id2882614">DatabaseFS</a></dt><dt><a href="#id2882669">vscan</a></dt></dl></dd></dl></dd><dt>22. <a href="#msdfs">Hosting a Microsoft Distributed File System tree on Samba</a></dt><dd><dl><dt><a href="#id2882214">Instructions</a></dt><dd><dl><dt><a href="#id2882961">Notes</a></dt></dl></dd></dl></dd><dt>23. <a href="#integrate-ms-networks">Integrating MS Windows networks with Samba</a></dt><dd><dl><dt><a href="#id2882745">Name Resolution in a pure Unix/Linux world</a></dt><dd><dl><dt><a href="#id2883178">/etc/hosts</a></dt><dt><a href="#id2883316">/etc/resolv.conf</a></dt><dt><a href="#id2883360">/etc/host.conf</a></dt><dt><a href="#id2883403">/etc/nsswitch.conf</a></dt></dl></dd><dt><a href="#id2883498">Name resolution as used within MS Windows networking</a></dt><dd><dl><dt><a href="#id2883030">The NetBIOS Name Cache</a></dt><dt><a href="#id2883069">The LMHOSTS file</a></dt><dt><a href="#id2883112">HOSTS file</a></dt><dt><a href="#id2883144">DNS Lookup</a></dt><dt><a href="#id2883156">WINS Lookup</a></dt></dl></dd></dl></dd><dt>24. <a href="#securing-samba">Securing Samba</a></dt><dd><dl><dt><a href="#id2883603">Introduction</a></dt><dt><a href="#id2883619">Using host based protection</a></dt><dt><a href="#id2884070">Using interface protection</a></dt><dt><a href="#id2884122">Using a firewall</a></dt><dt><a href="#id2884164">Using a IPC$ share deny</a></dt><dt><a href="#id2883724">NTLMv2 Security</a></dt><dt><a href="#id2883760">Upgrading Samba</a></dt></dl></dd><dt>25. <a href="#unicode">Unicode/Charsets</a></dt><dd><dl><dt><a href="#id2884358">What are charsets and unicode?</a></dt><dt><a href="#id2884428">Samba and charsets</a></dt><dt><a href="#id2884517">Conversion from old names</a></dt><dt><a href="#id2884562">Japanese charsets</a></dt></dl></dd><dt>26. <a href="#locking">File and Record Locking</a></dt><dd><dl><dt><a href="#id2884210">Discussion</a></dt><dt><a href="#id2884872">Samba Opportunistic Locking Control</a></dt><dt><a href="#id2884987">MS Windows Opportunistic Locking and Caching Controls</a></dt><dd><dl><dt><a href="#id2885212">Workstation Service Entries</a></dt><dt><a href="#id2885239">Server Service Entries</a></dt></dl></dd><dt><a href="#id2885320">Persistent Data Corruption</a></dt><dt><a href="#id2885350">Additional Reading</a></dt></dl></dd></dl></dd><dt>IV. <a href="#troubleshooting">Troubleshooting</a></dt><dd><dl><dt>27. <a href="#diagnosis">The samba checklist</a></dt><dd><dl><dt><a href="#id2884776">Introduction</a></dt><dt><a href="#id2884810">Assumptions</a></dt><dt><a href="#id2793401">The tests</a></dt><dt><a href="#id2886854">Still having troubles?</a></dt></dl></dd><dt>28. <a href="#problems">Analysing and solving samba problems</a></dt><dd><dl><dt><a href="#id2790687">Diagnostics tools</a></dt><dt><a href="#id2887096">Installing 'Network Monitor' on an NT Workstation or a Windows 9x box</a></dt><dt><a href="#id2887237">Useful URL's</a></dt><dt><a href="#id2887343">Getting help from the mailing lists</a></dt><dt><a href="#id2887497">How to get off the mailinglists</a></dt></dl></dd><dt>29. <a href="#bugreport">Reporting Bugs</a></dt><dd><dl><dt><a href="#id2887016">Introduction</a></dt><dt><a href="#id2886937">General info</a></dt><dt><a href="#id2887713">Debug levels</a></dt><dt><a href="#id2887849">Internal errors</a></dt><dt><a href="#id2887942">Attaching to a running process</a></dt><dt><a href="#id2887989">Patches</a></dt></dl></dd></dl></dd><dt>V. <a href="#Appendixes">Appendixes</a></dt><dd><dl><dt>30. <a href="#compiling">How to compile SAMBA</a></dt><dd><dl><dt><a href="#id2887580">Access Samba source code via CVS</a></dt><dd><dl><dt><a href="#id2887587">Introduction</a></dt><dt><a href="#id2887620">CVS Access to samba.org</a></dt></dl></dd><dt><a href="#id2888377">Accessing the samba sources via rsync and ftp</a></dt><dt><a href="#id2888418">Verifying Samba's PGP signature</a></dt><dt><a href="#id2888501">Building the Binaries</a></dt><dd><dl><dt><a href="#id2888639">Compiling samba with Active Directory support</a></dt></dl></dd><dt><a href="#id2888786">Starting the smbd and nmbd</a></dt><dd><dl><dt><a href="#id2888853">Starting from inetd.conf</a></dt><dt><a href="#id2889045">Alternative: starting it as a daemon</a></dt></dl></dd></dl></dd><dt>31. <a href="#NT4Migration">Migration from NT4 PDC to Samba-3 PDC</a></dt><dd><dl><dt><a href="#id2888159">Planning and Getting Started</a></dt><dd><dl><dt><a href="#id2888028">Objectives</a></dt><dt><a href="#id2889725">Steps In Migration Process</a></dt></dl></dd><dt><a href="#id2889980">Migration Options</a></dt><dd><dl><dt><a href="#id2890062">Planning for Success</a></dt><dt><a href="#id2890304">Samba Implementation Choices</a></dt></dl></dd></dl></dd><dt>32. <a href="#Portability">Portability</a></dt><dd><dl><dt><a href="#id2889273">HPUX</a></dt><dt><a href="#id2889171">SCO Unix</a></dt><dt><a href="#id2889194">DNIX</a></dt><dt><a href="#id2890671">RedHat Linux Rembrandt-II</a></dt><dt><a href="#id2890709">AIX</a></dt><dd><dl><dt><a href="#id2890716">Sequential Read Ahead</a></dt></dl></dd><dt><a href="#id2890741">Solaris</a></dt><dd><dl><dt><a href="#id2890748">Locking improvements</a></dt><dt><a href="#winbind-solaris9">Winbind on Solaris 9</a></dt></dl></dd></dl></dd><dt>33. <a href="#Other-Clients">Samba and other CIFS clients</a></dt><dd><dl><dt><a href="#id2890402">Macintosh clients?</a></dt><dt><a href="#id2890976">OS2 Client</a></dt><dd><dl><dt><a href="#id2890983">How can I configure OS/2 Warp Connect or 
57                 OS/2 Warp 4 as a client for Samba?</a></dt><dt><a href="#id2891066">How can I configure OS/2 Warp 3 (not Connect), 
58                 OS/2 1.2, 1.3 or 2.x for Samba?</a></dt><dt><a href="#id2891126">Are there any other issues when OS/2 (any version) 
59                 is used as a client?</a></dt><dt><a href="#id2891155">How do I get printer driver download working 
60                 for OS/2 clients?</a></dt></dl></dd><dt><a href="#id2891218">Windows for Workgroups</a></dt><dd><dl><dt><a href="#id2891226">Use latest TCP/IP stack from Microsoft</a></dt><dt><a href="#id2891257">Delete .pwl files after password change</a></dt><dt><a href="#id2891287">Configure WfW password handling</a></dt><dt><a href="#id2891313">Case handling of passwords</a></dt><dt><a href="#id2891344">Use TCP/IP as default protocol</a></dt><dt><a href="#id2891361">Speed improvement</a></dt></dl></dd><dt><a href="#id2891388">Windows '95/'98</a></dt><dd><dl><dt><a href="#id2891458">Speed improvement</a></dt></dl></dd><dt><a href="#id2891475">Windows 2000 Service Pack 2</a></dt><dt><a href="#id2891585">Windows NT 3.1</a></dt></dl></dd><dt>34. <a href="#SWAT">SWAT - The Samba Web Admininistration Tool</a></dt><dd><dl><dt><a href="#id2890961">SWAT Features and Benefits</a></dt><dd><dl><dt><a href="#id2890837">Enabling SWAT for use</a></dt><dt><a href="#id2891873">Securing SWAT through SSL</a></dt><dt><a href="#id2891946">The SWAT Home Page</a></dt><dt><a href="#id2892010">Global Settings</a></dt><dt><a href="#id2892118">Share Settings</a></dt><dt><a href="#id2892167">Printers Settings</a></dt><dt><a href="#id2892216">The SWAT Wizard</a></dt><dt><a href="#id2892261">The Status Page</a></dt><dt><a href="#id2892300">The View Page</a></dt><dt><a href="#id2892316">The Password Change Page</a></dt></dl></dd></dl></dd><dt>35. <a href="#speed">Samba performance issues</a></dt><dd><dl><dt><a href="#id2891608">Comparisons</a></dt><dt><a href="#id2891653">Socket options</a></dt><dt><a href="#id2892541">Read size</a></dt><dt><a href="#id2892584">Max xmit</a></dt><dt><a href="#id2892637">Log level</a></dt><dt><a href="#id2892660">Read raw</a></dt><dt><a href="#id2892717">Write raw</a></dt><dt><a href="#id2892759">Slow Logins</a></dt><dt><a href="#id2892781">Client tuning</a></dt></dl></dd></dl></dd></dl></div><div class="list-of-tables"><p><b>List of Tables</b></p><dl><dt>21.1. <a href="#id2882333">Extended Auditing Log Information</a></dt><dt>31.1. <a href="#id2889997">The 3 Major Site Types</a></dt><dt>31.2. <a href="#id2890135">Nature of the Conversion Choices</a></dt></dl></div><div class="part" lang="en"><div class="titlepage"><div><h1 class="title"><a name="introduction"></a>General Installation</h1></div></div><div class="partintro" lang="en"><div><div><h1 class="title"><a name="id2789774"></a>Preparing Samba for Configuration</h1></div></div><p>This section of the Samba-HOWTO-Collection contains general info on how to install samba 
61 and how to configure the parts of samba you will most likely need.
62 PLEASE read this.</p><div class="toc"><p><b>Table of Contents</b></p><dl><dt>1. <a href="#IntroSMB">Introduction to Samba</a></dt><dd><dl><dt><a href="#id2794048">Background</a></dt><dt><a href="#id2794106">Terminology</a></dt><dt><a href="#id2795149">Related Projects</a></dt><dt><a href="#id2845311">SMB Methodology</a></dt><dt><a href="#id2790901">Additional Resources</a></dt><dt><a href="#id2793926">Epilogue</a></dt><dt><a href="#id2844986">Miscellaneous</a></dt></dl></dd><dt>2. <a href="#install">How to Install and Test SAMBA</a></dt><dd><dl><dt><a href="#id2844847">Obtaining and installing samba</a></dt><dt><a href="#id2845201">Configuring samba</a></dt><dd><dl><dt><a href="#id2844744">Editing the smb.conf file</a></dt><dt><a href="#id2858916">SWAT</a></dt></dl></dd><dt><a href="#id2858954">Try listing the shares available on your 
63         server</a></dt><dt><a href="#id2859005">Try connecting with the unix client</a></dt><dt><a href="#id2859108">Try connecting from a DOS, WfWg, Win9x, WinNT, 
64         Win2k, OS/2, etc... client</a></dt><dt><a href="#id2859169">What If Things Don't Work?</a></dt></dl></dd></dl></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="IntroSMB"></a>Chapter 1. Introduction to Samba</h2></div><div><div class="author"><h3 class="author">David Lechnyr</h3><div class="affiliation"><span class="orgname">Unofficial HOWTO<br></span><div class="address"><p><tt>&lt;<a href="mailto:david@lechnyr.com">david@lechnyr.com</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">April 14, 2003</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2794048">Background</a></dt><dt><a href="#id2794106">Terminology</a></dt><dt><a href="#id2795149">Related Projects</a></dt><dt><a href="#id2845311">SMB Methodology</a></dt><dt><a href="#id2790901">Additional Resources</a></dt><dt><a href="#id2793926">Epilogue</a></dt><dt><a href="#id2844986">Miscellaneous</a></dt></dl></div><p><span class="emphasis"><em>
65 &quot;If you understand what you're doing, you're not learning anything.&quot; 
66 -- Anonymous
67 </em></span></p><p>
68 Samba is a file and print server for Windows-based clients using TCP/IP as the underlying
69 transport protocol. In fact, it can support any SMB/CIFS-enabled client. One of Samba's big
70 strengths is that you can use it to blend your mix of Windows and Linux machines together
71 without requiring a separate Windows NT/2000/2003 Server.  Samba is actively being developed
72 by a global team of about 30 active programmers and was originally developed by Andrew Tridgell.
73 </p><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2794048"></a>Background</h2></div></div><p>
74 Once long ago, there was a buzzword referred to as DCE/RPC. This stood for Distributed
75 Computing Environment/Remote Procedure Calls and conceptually was a good idea. It was
76 originally developed by Apollo/HP as NCA 1.0 (Network Computing Architecture) and only
77 ran over UDP. When there was a need to run it over TCP so that it would be compatible
78 with DECnet 3.0, it was redesigned, submitted to The Open Group, and officially became
79 known as DCE/RPC. Microsoft came along and decided, rather than pay $20 per seat to
80 license this technology, to reimplement DCE/RPC themselves as MSRPC. From this, the
81 concept continued in the form of SMB (Server Message Block, or the &quot;what&quot;) using the
82 NetBIOS (Network Basic Input/Output System, or the &quot;how&quot;) compatibility layer. You can
83 run SMB (i.e., transport) over several different protocols; many different implementations
84 arose as a result, including NBIPX (NetBIOS over IPX, NwLnkNb, or NWNBLink) and NBT
85 (NetBIOS over TCP/IP, or NetBT). As the years passed, NBT became the most common form
86 of implementation until the advance of &quot;Direct-Hosted TCP&quot; -- the Microsoft marketing
87 term for eliminating NetBIOS entirely and running SMB by itself across TCP port 445
88 only. As of yet, direct-hosted TCP has yet to catch on.
89 </p><p>
90 Perhaps the best summary of the origins of SMB are voiced in the 1997 article titled, CIFS:
91 Common Insecurities Fail Scrutiny:
92 </p><p><span class="emphasis"><em>
93 Several megabytes of NT-security archives, random whitepapers, RFCs, the CIFS spec, the Samba
94 stuff, a few MS knowledge-base articles, strings extracted from binaries, and packet dumps have
95 been dutifully waded through during the information-gathering stages of this project, and there
96 are *still* many missing pieces... While often tedious, at least the way has been generously
97 littered with occurrences of clapping hand to forehead and muttering 'crikey, what are they
98 thinking?
99 </em></span></p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2794106"></a>Terminology</h2></div></div><div class="itemizedlist"><ul type="disc"><li><p>
100         SMB: Acronym for &quot;Server Message Block&quot;. This is Microsoft's file and printer sharing protocol.
101         </p></li><li><p>
102         CIFS: Acronym for &quot;Common Internet File System&quot;. Around 1996, Microsoft apparently
103         decided that SMB needed the word &quot;Internet&quot; in it, so they changed it to CIFS.  
104         </p></li><li><p>
105         Direct-Hosted: A method of providing file/printer sharing services over port 445/tcp
106         only using DNS for name resolution instead of WINS.
107         </p></li><li><p>
108         IPC: Acronym for &quot;Inter-Process Communication&quot;. A method to communicate specific
109         information between programs.
110         </p></li><li><p>
111         Marshalling: - A method of serializing (i.e., sequential ordering of) variable data
112         suitable for transmission via a network connection or storing in a file. The source
113         data can be re-created using a similar process called unmarshalling.
114         </p></li><li><p>
115         NetBIOS: Acronym for &quot;Network Basic Input/Output System&quot;. This is not a protocol;
116         it is a method of communication across an existing protocol. This is a standard which
117         was originally developed for IBM by Sytek in 1983. To exaggerate the analogy a bit,
118         it can help to think of this in comparison your computer's BIOS -- it controls the
119         essential functions of your input/output hardware -- whereas NetBIOS controls the
120         essential functions of your input/output traffic via the network. Again, this is a bit
121         of an exaggeration but it should help that paradigm shift. What is important to realize
122         is that NetBIOS is a transport standard, not a protocol. Unfortunately, even technically
123         brilliant people tend to interchange NetBIOS with terms like NetBEUI without a second
124         thought; this will cause no end (and no doubt) of confusion.
125         </p></li><li><p>
126         NetBEUI: Acronym for the &quot;NetBIOS Extended User Interface&quot;. Unlike NetBIOS, NetBEUI
127         is a protocol, not a standard. It is also not routable, so traffic on one side of a
128         router will be unable to communicate with the other side. Understanding NetBEUI is
129         not essential to deciphering SMB; however it helps to point out that it is not the
130         same as NetBIOS and to improve your score in trivia at parties. NetBEUI was originally
131         referred to by Microsoft as &quot;NBF&quot;, or &quot;The Windows NT NetBEUI Frame protocol driver&quot;.
132         It is not often heard from these days.
133         </p></li><li><p>
134         NBT: Acronym for &quot;NetBIOS over TCP&quot;; also known as &quot;NetBT&quot;. Allows the continued use
135         of NetBIOS traffic proxied over TCP/IP. As a result, NetBIOS names are made 
136         to IP addresses and NetBIOS name types are conceptually equivalent to TCP/IP ports.
137         This is how file and printer sharing are accomplished in Windows 95/98/ME. They 
138         traditionally rely on three ports: NetBIOS Name Service (nbname) via UDP port 137, 
139         NetBIOS Datagram Service (nbdatagram) via UDP port 138, and NetBIOS Session Service 
140         (nbsession) via TCP port 139. All name resolution is done via WINS, NetBIOS broadcasts, 
141         and DNS. NetBIOS over TCP is documented in RFC 1001 (Concepts and methods) and RFC 1002 
142         (Detailed specifications).
143         </p></li><li><p>
144         W2K: Acronym for Windows 2000 Professional or Server
145         </p></li><li><p>
146         W3K: Acronym for Windows 2003 Server
147         </p></li></ul></div><p>If you plan on getting help, make sure to subscribe to the Samba Mailing List (available at 
148 http://www.samba.org).  Optionally, you could just search mailing.unix.samba at http://groups.google.com
149 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2795149"></a>Related Projects</h2></div></div><p>
150 There are currently two network filesystem client projects for Linux that are directly
151 related to Samba: SMBFS and CIFS VFS.  These are both available in the Linux kernel itself.
152 </p><div class="itemizedlist"><ul type="disc"><li><p>
153         SMBFS (Server Message Block File System) allows you to mount SMB shares (the protocol
154         that Microsoft Windows and OS/2 Lan Manager use to share files and printers 
155         over local networks) and access them just like any other Unix directory. This is useful 
156         if you just want to mount such filesystems without being a SMBFS server.
157         </p></li><li><p>
158         CIFS VFS (Common Internet File System Virtual File System) is the successor to SMBFS, and
159         is being actively developed for the upcoming version of the Linux kernel. The intent of this module
160         is to provide advanced network file system functionality including support for dfs (heirarchical
161         name space), secure per-user session establishment, safe distributed caching (oplock), 
162         optional packet signing, Unicode and other internationalization improvements, and optional 
163         Winbind (nsswitch) integration.
164         </p></li></ul></div><p>
165 Again, it's important to note that these are implementations for client filesystems, and have
166 nothing to do with acting as a file and print server for SMB/CIFS clients.
167 </p><p>
168 There are other Open Source CIFS client implementations, such as the jCIFS project
169 (jcifs.samba.org) which provides an SMB client toolkit written in Java.
170 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2845311"></a>SMB Methodology</h2></div></div><p>
171 Traditionally, SMB uses UDP port 137 (NetBIOS name service, or netbios-ns),
172 UDP port 138 (NetBIOS datagram service, or netbios-dgm), and TCP port 139 (NetBIOS
173 session service, or netbios-ssn). Anyone looking at their network with a good
174 packet sniffer will be amazed at the amount of traffic generated by just opening
175 up a single file. In general, SMB sessions are established in the following order:
176 </p><div class="itemizedlist"><ul type="disc"><li><p>
177         &quot;TCP Connection&quot; - establish 3-way handshake (connection) to port 139/tcp
178     or 445/tcp.
179         </p></li><li><p>
180         &quot;NetBIOS Session Request&quot; - using the following &quot;Calling Names&quot;: The local
181     machine's NetBIOS name plus the 16th character 0x00; The server's NetBIOS
182     name plus the 16th character 0x20
183         </p></li><li><p>
184         &quot;SMB Negotiate Protocol&quot; - determine the protocol dialect to use, which will
185     be one of the following: PC Network Program 1.0 (Core) - share level security
186     mode only; Microsoft Networks 1.03 (Core Plus) - share level security
187     mode only; Lanman1.0 (LAN Manager 1.0) - uses Challenge/Response
188     Authentication; Lanman2.1 (LAN Manager 2.1) - uses Challenge/Response
189     Authentication; NT LM 0.12 (NT LM 0.12) - uses Challenge/Response
190     Authentication
191         </p></li><li><p>
192         SMB Session Startup. Passwords are encrypted (or not) according to one of
193     the following methods: Null (no encryption); Cleartext (no encryption); LM
194     and NTLM; NTLM; NTLMv2
195         </p></li><li><p>
196         SMB Tree Connect: Connect to a share name (e.g., \\servername\share); Connect
197     to a service type (e.g., IPC$ named pipe)
198         </p></li></ul></div><p>
199 A good way to examine this process in depth is to try out SecurityFriday's SWB program
200 at http://www.securityfriday.com/ToolDownload/SWB/swb_doc.html.  It allows you to
201 walk through the establishment of a SMB/CIFS session step by step.
202 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2790901"></a>Additional Resources</h2></div></div><div class="itemizedlist"><ul type="disc"><li><p>
203         <a href="http://hr.uoregon.edu/davidrl/cifs.txt" target="_top">
204         <span class="emphasis"><em>CIFS: Common Insecurities Fail Scrutiny</em></span> by &quot;Hobbit&quot;</a>
205         </p></li><li><p>
206         <a href="http://afr.com/it/2002/10/01/FFXDF43AP6D.html" target="_top">
207         <span class="emphasis"><em>Doing the Samba on Windows</em></span> by Financial Review
208         </a>
209         </p></li><li><p>
210         <a href="http://ubiqx.org/cifs/" target="_top">
211         <span class="emphasis"><em>Implementing CIFS</em></span> by Christopher R. Hertel
212         </a>
213         </p></li><li><p>
214         <a href="http://samba.anu.edu.au/cifs/docs/what-is-smb.html" target="_top">
215         <span class="emphasis"><em>Just What Is SMB?</em></span> by Richard Sharpe
216         </a>
217         </p></li><li><p>
218         <a href="http://www.linux-mag.com/1999-05/samba_01.html" target="_top">
219         <span class="emphasis"><em>Opening Windows Everywhere</em></span> by Mike Warfield
220         </a>
221         </p></li><li><p>
222         <a href="http://www.tldp.org/HOWTO/SMB-HOWTO.html" target="_top">
223         <span class="emphasis"><em>SMB HOWTO</em></span> by David Wood
224         </a>
225         </p></li><li><p>
226         <a href="http://www.phrack.org/phrack/60/p60-0x0b.txt" target="_top">
227         <span class="emphasis"><em>SMB/CIFS by The Root</em></span> by &quot;ledin&quot;
228         </a>
229         </p></li><li><p>
230         <a href="http://www.linux-mag.com/1999-09/samba_01.html" target="_top">
231         <span class="emphasis"><em>The Story of Samba</em></span> by Christopher R. Hertel
232         </a>
233         </p></li><li><p>
234         <a href="http://hr.uoregon.edu/davidrl/samba/" target="_top">
235         <span class="emphasis"><em>The Unofficial Samba HOWTO</em></span> by David Lechnyr
236         </a>
237         </p></li><li><p>
238         <a href="http://www.linux-mag.com/2001-05/smb_01.html" target="_top">
239         <span class="emphasis"><em>Understanding the Network Neighborhood</em></span> by Christopher R. Hertel
240         </a>
241         </p></li><li><p>
242         <a href="http://www.linux-mag.com/2002-02/samba_01.html" target="_top">
243         <span class="emphasis"><em>Using Samba as a PDC</em></span> by Andrew Bartlett
244         </a>
245         </p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2793926"></a>Epilogue</h2></div></div><p><span class="emphasis"><em>
246 &quot;What's fundamentally wrong is that nobody ever had any taste when they
247 did it. Microsoft has been very much into making the user interface look good,
248 but internally it's just a complete mess. And even people who program for Microsoft
249 and who have had years of experience, just don't know how it works internally.
250 Worse, nobody dares change it. Nobody dares to fix bugs because it's such a
251 mess that fixing one bug might just break a hundred programs that depend on
252 that bug. And Microsoft isn't interested in anyone fixing bugs -- they're interested
253 in making money. They don't have anybody who takes pride in Windows 95 as an
254 operating system.
255 </em></span></p><p><span class="emphasis"><em>
256 People inside Microsoft know it's a bad operating system and they still
257 continue obviously working on it because they want to get the next version out
258 because they want to have all these new features to sell more copies of the
259 system.
260 </em></span></p><p><span class="emphasis"><em>
261 The problem with that is that over time, when you have this kind of approach,
262 and because nobody understands it, because nobody REALLY fixes bugs (other than
263 when they're really obvious), the end result is really messy. You can't trust
264 it because under certain circumstances it just spontaneously reboots or just
265 halts in the middle of something that shouldn't be strange. Normally it works
266 fine and then once in a blue moon for some completely unknown reason, it's dead,
267 and nobody knows why. Not Microsoft, not the experienced user and certainly
268 not the completely clueless user who probably sits there shivering thinking
269 &quot;What did I do wrong?&quot; when they didn't do anything wrong at all.
270 </em></span></p><p><span class="emphasis"><em>
271 That's what's really irritating to me.&quot;
272 </em></span></p><p>-- 
273 <a href="http://hr.uoregon.edu/davidrl/boot.txt" target="_top">Linus Torvalds, from an interview with BOOT Magazine, Sept 1998</a>
274 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2844986"></a>Miscellaneous</h2></div></div><p>
275 This chapter was lovingly handcrafted on a Dell Latitude C400 laptop running Slackware Linux 9.0,
276 in case anyone asks.
277 </p><p>
278 This chapter is Copyright © 2003 David Lechnyr (david at lechnyr dot com).
279 Permission is granted to copy, distribute and/or modify this document under the terms
280 of the GNU Free Documentation License, Version 1.2 or any later version published by the Free
281 Software Foundation. A copy of the license is available at http://www.gnu.org/licenses/fdl.txt.
282 </p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="install"></a>Chapter 2. How to Install and Test SAMBA</h2></div><div><div class="author"><h3 class="author">Andrew Tridgell</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:tridge@samba.org">tridge@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Jelmer R. Vernooij</h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Karl Auer</h3></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2844847">Obtaining and installing samba</a></dt><dt><a href="#id2845201">Configuring samba</a></dt><dd><dl><dt><a href="#id2844744">Editing the smb.conf file</a></dt><dt><a href="#id2858916">SWAT</a></dt></dl></dd><dt><a href="#id2858954">Try listing the shares available on your 
283         server</a></dt><dt><a href="#id2859005">Try connecting with the unix client</a></dt><dt><a href="#id2859108">Try connecting from a DOS, WfWg, Win9x, WinNT, 
284         Win2k, OS/2, etc... client</a></dt><dt><a href="#id2859169">What If Things Don't Work?</a></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2844847"></a>Obtaining and installing samba</h2></div></div><p>Binary packages of samba are included in almost any Linux or 
285         Unix distribution. There are also some packages available at 
286         <a href="http://samba.org/" target="_top">the samba homepage</a>.
287         </p><p>If you need to compile samba from source, check the 
288         <a href="#compiling" title="Chapter 30. How to compile SAMBA">appropriate appendix chapter</a>.</p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2845201"></a>Configuring samba</h2></div></div><p>Samba's configuration is stored in the smb.conf file, 
289         that usually resides in <tt>/etc/samba/smb.conf</tt> 
290         or <tt>/usr/local/samba/lib/smb.conf</tt>. You can either 
291         edit this file yourself or do it using one of the many graphical 
292         tools that are available, such as the web-based interface swat, that 
293         is included with samba.</p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2844744"></a>Editing the <tt>smb.conf</tt> file</h3></div></div><p>There are sample configuration files in the examples 
294         subdirectory in the distribution. I suggest you read them 
295         carefully so you can see how the options go together in 
296         practice. See the man page for all the options.</p><p>The simplest useful configuration file would be 
297         something like this:</p><pre class="programlisting">
298 [global]
299         workgroup = MYGROUP
300
301 [homes]
302         guest ok = no
303         read only = no
304         </pre><p>which would allow connections by anyone with an 
305         account on the server, using either their login name or 
306         &quot;<b>homes</b>&quot; as the service name. (Note that I also set the 
307         workgroup that Samba is part of. See BROWSING.txt for details)</p><p>Make sure you put the <tt>smb.conf</tt> file in the same place 
308         you specified in the<tt>Makefile</tt> (the default is to 
309         look for it in <tt>/usr/local/samba/lib/</tt>).</p><p>For more information about security settings for the 
310         <b>[homes]</b> share please refer to the chapter 
311         <a href="#securing-samba" title="Chapter 24. Securing Samba">Securing Samba</a>.</p><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2858862"></a>Test your config file with 
312         <b>testparm</b></h4></div></div><p>It's important that you test the validity of your
313         <tt>smb.conf</tt> file using the testparm program. 
314         If testparm runs OK then it will list the loaded services. If 
315         not it will give an error message.</p><p>Make sure it runs OK and that the services look 
316         reasonable before proceeding. </p><p>Always run testparm again when you change 
317         <tt>smb.conf</tt>!</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2858916"></a>SWAT</h3></div></div><p>
318         SWAT is a web-based interface that helps you configure samba. 
319         SWAT might not be available in the samba package on your platform, 
320         but in a separate package. Please read the swat manpage 
321         on compiling, installing and configuring swat from source.
322         </p><p>To launch SWAT just run your favorite web browser and 
323         point it at &quot;http://localhost:901/&quot;. Replace <i><tt>localhost</tt></i> with the name of the computer you are running samba on if you 
324         are running samba on a different computer than your browser.</p><p>Note that you can attach to SWAT from any IP connected 
325         machine but connecting from a remote machine leaves your 
326         connection open to password sniffing as passwords will be sent 
327         in the clear over the wire. </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2858954"></a>Try listing the shares available on your 
328         server</h2></div></div><p><tt>$ </tt><b><tt>smbclient -L 
329         <i><tt>yourhostname</tt></i></tt></b></p><p>You should get back a list of shares available on 
330         your server. If you don't then something is incorrectly setup. 
331         Note that this method can also be used to see what shares 
332         are available on other LanManager clients (such as WfWg).</p><p>If you choose user level security then you may find 
333         that Samba requests a password before it will list the shares. 
334         See the <b>smbclient</b> man page for details. (you 
335         can force it to list the shares without a password by
336         adding the option -U% to the command line. This will not work 
337         with non-Samba servers)</p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2859005"></a>Try connecting with the unix client</h2></div></div><p><tt>$ </tt><b><tt>smbclient <i><tt>
338         //yourhostname/aservice</tt></i></tt></b></p><p>Typically the <i><tt>yourhostname</tt></i> 
339         would be the name of the host where you installed smbd. 
340         The <i><tt>aservice</tt></i> is 
341         any service you have defined in the <tt>smb.conf</tt>
342         file. Try your user name if you just have a <b>[homes]</b>
343         section
344         in <tt>smb.conf</tt>.</p><p>For example if your unix host is <i><tt>bambi</tt></i>
345         and your login name is <i><tt>fred</tt></i> you would type:</p><p><tt>$ </tt><b><tt>smbclient //<i><tt>bambi</tt></i>/<i><tt>fred</tt></i>
346         </tt></b></p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2859108"></a>Try connecting from a DOS, WfWg, Win9x, WinNT, 
347         Win2k, OS/2, etc... client</h2></div></div><p>Try mounting disks. eg:</p><p><tt>C:\WINDOWS\&gt; </tt><b><tt>net use d: \\servername\service
348         </tt></b></p><p>Try printing. eg:</p><p><tt>C:\WINDOWS\&gt; </tt><b><tt>net use lpt1:
349         \\servername\spoolservice</tt></b></p><p><tt>C:\WINDOWS\&gt; </tt><b><tt>print filename
350         </tt></b></p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2859169"></a>What If Things Don't Work?</h2></div></div><p>Then you might read the file chapter 
351         <a href="#diagnosis" title="Chapter 27. The samba checklist">Diagnosis</a> and the 
352         FAQ. If you are still stuck then try to follow 
353         the <a href="#problems" title="Chapter 28. Analysing and solving samba problems">Analysing and Solving Problems chapter</a>
354         Samba has been successfully installed at thousands of sites worldwide,
355         so maybe someone else has hit your problem and has overcome it. </p></div></div></div><div class="part" lang="en"><div class="titlepage"><div><h1 class="title"><a name="type"></a>Server Configuration Basics</h1></div></div><div class="partintro" lang="en"><div><div><h1 class="title"><a name="id2845027"></a>First Steps in Server Configuration</h1></div></div><p>
356 Samba can operate in various modes within SMB networks. This HOWTO section contains information on
357 configuring samba to function as the type of server your network requires. Please read this
358 section carefully.
359 </p><div class="toc"><p><b>Table of Contents</b></p><dl><dt>3. <a href="#ServerType">Nomenclature of Server Types</a></dt><dd><dl><dt><a href="#id2845139">Stand Alone Server</a></dt><dt><a href="#id2859402">Domain Member Server</a></dt><dt><a href="#id2859442">Domain Controller</a></dt><dd><dl><dt><a href="#id2859458">Domain Controller Types</a></dt></dl></dd></dl></dd><dt>4. <a href="#securitylevels">Samba as Stand-Alone Server</a></dt><dd><dl><dt><a href="#id2859216">User and Share security level</a></dt><dd><dl><dt><a href="#id2859238">User Level Security</a></dt><dt><a href="#id2859720">Share Level Security</a></dt><dt><a href="#id2859774">Server Level Security</a></dt><dt><a href="#id2860095">Domain Level Security</a></dt><dt><a href="#id2860234">ADS Level Security</a></dt></dl></dd></dl></dd><dt>5. <a href="#samba-pdc">
360 Samba as an NT4 or Win2k Primary Domain Controller
361 </a></dt><dd><dl><dt><a href="#id2859583">Prerequisite Reading</a></dt><dt><a href="#id2859607">
362 Background
363 </a></dt><dt><a href="#id2860563">Configuring the Samba Domain Controller</a></dt><dt><a href="#id2860863">Creating Machine Trust Accounts and Joining Clients to the Domain</a></dt><dd><dl><dt><a href="#id2861132">Manual Creation of Machine Trust Accounts</a></dt><dt><a href="#id2861366">&quot;On-the-Fly&quot; Creation of Machine Trust Accounts</a></dt><dt><a href="#id2861423">Joining the Client to the Domain</a></dt></dl></dd><dt><a href="#id2861529">Common Problems and Errors</a></dt><dd><dl><dt><a href="#id2861536">I cannot include a '$' in a machine name</a></dt><dt><a href="#id2861574">I get told &quot;You already have a connection to the Domain....&quot; 
364 or &quot;Cannot join domain, the credentials supplied conflict with an 
365 existing set..&quot; when creating a machine trust account.</a></dt><dt><a href="#id2861621">The system can not log you on (C000019B)....</a></dt><dt><a href="#id2861672">The machine trust account for this computer either does not 
366 exist or is not accessible.</a></dt><dt><a href="#id2861721">When I attempt to login to a Samba Domain from a NT4/W2K workstation,
367 I get a message about my account being disabled.</a></dt></dl></dd><dt><a href="#id2861746">Domain Control for Windows 9x/ME</a></dt><dd><dl><dt><a href="#id2861910">Configuration Instructions:       Network Logons</a></dt></dl></dd></dl></dd><dt>6. <a href="#samba-bdc">
368 Samba Backup Domain Controller to Samba Domain Control
369 </a></dt><dd><dl><dt><a href="#id2845056">Prerequisite Reading</a></dt><dt><a href="#id2860294">Background</a></dt><dt><a href="#id2862166">What qualifies a Domain Controller on the network?</a></dt><dd><dl><dt><a href="#id2862187">How does a Workstation find its domain controller?</a></dt><dt><a href="#id2862212">When is the PDC needed?</a></dt></dl></dd><dt><a href="#id2862231">Can Samba be a Backup Domain Controller to an NT PDC?</a></dt><dt><a href="#id2862264">How do I set up a Samba BDC?</a></dt><dd><dl><dt><a href="#id2862361">How do I replicate the smbpasswd file?</a></dt><dt><a href="#id2862390">Can I do this all with LDAP?</a></dt></dl></dd></dl></dd><dt>7. <a href="#ADS">Samba as a ADS domain member</a></dt><dd><dl><dt><a href="#id2862021">Setup your smb.conf</a></dt><dt><a href="#id2862571">Setup your /etc/krb5.conf</a></dt><dt><a href="#ads-create-machine-account">Create the computer account</a></dt><dd><dl><dt><a href="#id2862765">Possible errors</a></dt></dl></dd><dt><a href="#ads-test-server">Test your server setup</a></dt><dt><a href="#ads-test-smbclient">Testing with smbclient</a></dt><dt><a href="#id2862919">Notes</a></dt></dl></dd><dt>8. <a href="#domain-member">Samba as a NT4 or Win2k domain member</a></dt><dd><dl><dt><a href="#id2862413">Joining an NT Domain with Samba 3.0</a></dt><dt><a href="#id2863318">Why is this better than security = server?</a></dt></dl></dd></dl></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="ServerType"></a>Chapter 3. Nomenclature of Server Types</h2></div><div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2845139">Stand Alone Server</a></dt><dt><a href="#id2859402">Domain Member Server</a></dt><dt><a href="#id2859442">Domain Controller</a></dt><dd><dl><dt><a href="#id2859458">Domain Controller Types</a></dt></dl></dd></dl></div><p>Adminstrators of Microsoft networks often refer to there being three
370 different type of servers:</p><div class="itemizedlist"><ul type="disc"><li><p>Stand Alone Server</p></li><li><p>Domain Member Server</p></li><li><p>Domain Controller</p><div class="itemizedlist"><ul type="circle"><li><p>Primary Domain Controller</p></li><li><p>Backup Domain Controller</p></li><li><p>ADS Domain Controller</p></li></ul></div></li></ul></div><p>A network administrator who is familiar with these terms and who
371 wishes to migrate to or use Samba will want to know what these terms mean
372 within a Samba context.</p><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2845139"></a>Stand Alone Server</h2></div></div><p>
373 The term <span class="emphasis"><em>stand alone server</em></span> means that the server
374 will provide local authentication and access control for all resources
375 that are available from it. In general this means that there will be a
376 local user database. In more technical terms, it means that resources
377 on the machine will either be made available in either SHARE mode or in
378 USER mode. SHARE mode and USER mode security are documented under
379 discussions regarding &quot;security mode&quot;. The smb.conf configuration parameters
380 that control security mode are: &quot;security = user&quot; and &quot;security = share&quot;.
381 </p><p>
382 No special action is needed other than to create user accounts. Stand-alone
383 servers do NOT provide network logon services, meaning that machines that
384 use this server do NOT perform a domain logon but instead make use only of
385 the MS Windows logon which is local to the MS Windows workstation/server.
386 </p><p>
387 Samba tends to blur the distinction a little in respect of what is
388 a stand alone server. This is because the authentication database may be
389 local or on a remote server, even if from the samba protocol perspective
390 the samba server is NOT a member of a domain security context.
391 </p><p>
392 Through the use of PAM (Pluggable Authentication Modules) and nsswitch
393 (the name service switcher) the source of authentication may reside on 
394 another server. We would be inclined to call this the authentication server.
395 This means that the samba server may use the local Unix/Linux system
396 password database (/etc/passwd or /etc/shadow), may use a local smbpasswd
397 file (/etc/samba/smbpasswd or /usr/local/samba/lib/private/smbpasswd), or
398 may use an LDAP back end, or even via PAM and Winbind another CIFS/SMB
399 server for authentication.
400 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2859402"></a>Domain Member Server</h2></div></div><p>
401 This mode of server operation involves the samba machine being made a member
402 of a domain security context. This means by definition that all user authentication
403 will be done from a centrally defined authentication regime. The authentication
404 regime may come from an NT3/4 style (old domain technology) server, or it may be
405 provided from an Active Directory server (ADS) running on MS Windows 2000 or later.
406 </p><p><span class="emphasis"><em>
407 Of course it should be clear that the authentication back end itself could be from any
408 distributed directory architecture server that is supported by Samba. This can be
409 LDAP (from OpenLDAP), or Sun's iPlanet, of NetWare Directory Server, etc.
410 </em></span></p><p>
411 Please refer to the section on Howto configure Samba as a Primary Domain Controller
412 and for more information regarding how to create a domain machine account for a
413 domain member server as well as for information regarding how to enable the samba
414 domain member machine to join the domain and to be fully trusted by it.
415 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2859442"></a>Domain Controller</h2></div></div><p>
416 Over the years public perceptions of what Domain Control really is has taken on an
417 almost mystical nature. Before we branch into a brief overview of what Domain Control
418 is the following types of controller are known:
419 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2859458"></a>Domain Controller Types</h3></div></div><table class="simplelist" border="0" summary="Simple list"><tr><td>Primary Domain Controller</td></tr><tr><td>Backup Domain Controller</td></tr><tr><td>ADS Domain Controller</td></tr></table><p>
420 The <span class="emphasis"><em>Primary Domain Controller</em></span> or PDC plays an important role in the MS 
421 Windows NT3 and NT4 Domain Control architecture, but not in the manner that so many
422 expect. The PDC seeds the Domain Control database (a part of the Windows registry) and
423 it plays a key part in synchronisation of the domain authentication database. 
424 </p><p>
425 New to Samba-3.0.0 is the ability to use a back-end file that holds the same type of data as
426 the NT4 style SAM (Security Account Manager) database (one of the registry files).
427 The samba-3.0.0 SAM can be specified via the smb.conf file parameter &quot;passwd backend&quot; and
428 valid options include <span class="emphasis"><em> smbpasswd tdbsam ldapsam nisplussam plugin unixsam</em></span>.
429 The smbpasswd, tdbsam and ldapsam options can have a &quot;_nua&quot; suffix to indicate that No Unix
430 Accounts need to be created. In other words, the Samba SAM will be independant of Unix/Linux
431 system accounts, provided a uid range is defined from which SAM accounts can be created.
432 </p><p>
433 The <span class="emphasis"><em>Backup Domain Controller</em></span> or BDC plays a key role in servicing network
434 authentication requests. The BDC is biased to answer logon requests so that on a network segment
435 that has a BDC and a PDC the BDC will be most likely to service network logon requests. The PDC will
436 answer network logon requests when the BDC is too busy (high load). A BDC can be promoted to
437 a PDC. If the PDC is on line at the time that the BDC is promoted to PDC the previous PDC is
438 automatically demoted to a BDC.
439 </p><p>
440 At this time Samba is NOT capable of acting as an <span class="emphasis"><em>ADS Domain Controller</em></span>.
441 </p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="securitylevels"></a>Chapter 4. Samba as Stand-Alone Server</h2></div><div><div class="author"><h3 class="author">Andrew Tridgell</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:tridge@samba.org">tridge@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Jelmer R. Vernooij</h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2859216">User and Share security level</a></dt><dd><dl><dt><a href="#id2859238">User Level Security</a></dt><dt><a href="#id2859720">Share Level Security</a></dt><dt><a href="#id2859774">Server Level Security</a></dt><dt><a href="#id2860095">Domain Level Security</a></dt><dt><a href="#id2860234">ADS Level Security</a></dt></dl></dd></dl></div><p>
442 In this section the function and purpose of Samba's <span class="emphasis"><em>security</em></span>
443 modes are described.
444 </p><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2859216"></a>User and Share security level</h2></div></div><p>
445 A SMB server tells the client at startup what &quot;security level&quot; it is
446 running. There are two options &quot;share level&quot; and &quot;user level&quot;. Which
447 of these two the client receives affects the way the client then tries
448 to authenticate itself. It does not directly affect (to any great
449 extent) the way the Samba server does security. I know this is
450 strange, but it fits in with the client/server approach of SMB. In SMB
451 everything is initiated and controlled by the client, and the server
452 can only tell the client what is available and whether an action is
453 allowed. 
454 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2859238"></a>User Level Security</h3></div></div><p>
455 I'll describe user level security first, as its simpler. In user level
456 security the client will send a &quot;session setup&quot; command directly after
457 the protocol negotiation. This contains a username and password. The
458 server can either accept or reject that username/password
459 combination. Note that at this stage the server has no idea what
460 share the client will eventually try to connect to, so it can't base
461 the &quot;accept/reject&quot; on anything other than:
462 </p><div class="orderedlist"><ol type="1"><li><p>the username/password</p></li><li><p>the machine that the client is coming from</p></li></ol></div><p>
463 If the server accepts the username/password then the client expects to
464 be able to mount any share (using a &quot;tree connection&quot;) without
465 specifying a password. It expects that all access rights will be as
466 the username/password specified in the &quot;session setup&quot;. 
467 </p><p>
468 It is also possible for a client to send multiple &quot;session setup&quot;
469 requests. When the server responds it gives the client a &quot;uid&quot; to use
470 as an authentication tag for that username/password. The client can
471 maintain multiple authentication contexts in this way (WinDD is an
472 example of an application that does this)
473 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2859720"></a>Share Level Security</h3></div></div><p>
474 Ok, now for share level security. In share level security the client
475 authenticates itself separately for each share. It will send a
476 password along with each &quot;tree connection&quot; (share mount). It does not
477 explicitly send a username with this operation. The client is
478 expecting a password to be associated with each share, independent of
479 the user. This means that samba has to work out what username the
480 client probably wants to use. It is never explicitly sent the
481 username. Some commercial SMB servers such as NT actually associate
482 passwords directly with shares in share level security, but samba
483 always uses the unix authentication scheme where it is a
484 username/password that is authenticated, not a &quot;share/password&quot;.
485 </p><p>
486 Many clients send a &quot;session setup&quot; even if the server is in share
487 level security. They normally send a valid username but no
488 password. Samba records this username in a list of &quot;possible
489 usernames&quot;. When the client then does a &quot;tree connection&quot; it also adds
490 to this list the name of the share they try to connect to (useful for
491 home directories) and any users listed in the <b>user =</b> <tt>smb.conf</tt>
492 line. The password is then checked in turn against these &quot;possible
493 usernames&quot;. If a match is found then the client is authenticated as
494 that user.
495 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2859774"></a>Server Level Security</h3></div></div><p>
496 Finally &quot;server level&quot; security. In server level security the samba
497 server reports to the client that it is in user level security. The
498 client then does a &quot;session setup&quot; as described earlier. The samba
499 server takes the username/password that the client sends and attempts
500 to login to the &quot;password server&quot; by sending exactly the same
501 username/password that it got from the client. If that server is in
502 user level security and accepts the password then samba accepts the
503 clients connection. This allows the samba server to use another SMB
504 server as the &quot;password server&quot;. 
505 </p><p>
506 You should also note that at the very start of all this, where the
507 server tells the client what security level it is in, it also tells
508 the client if it supports encryption. If it does then it supplies the
509 client with a random &quot;cryptkey&quot;. The client will then send all
510 passwords in encrypted form. You have to compile samba with encryption
511 enabled to support this feature, and you have to maintain a separate
512 smbpasswd file with SMB style encrypted passwords. It is
513 cryptographically impossible to translate from unix style encryption
514 to SMB style encryption, although there are some fairly simple management
515 schemes by which the two could be kept in sync.
516 </p><p>
517 &quot;security = server&quot; means that Samba reports to clients that
518 it is running in &quot;user mode&quot; but actually passes off all authentication
519 requests to another &quot;user mode&quot; server. This requires an additional
520 parameter &quot;password server =&quot; that points to the real authentication server.
521 That real authentication server can be another Samba server or can be a
522 Windows NT server, the later natively capable of encrypted password support.
523 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
524 <span class="emphasis"><em>Server</em></span> level security is incompatible with what is known 
525 as <span class="emphasis"><em>schannel</em></span> or &quot;sign and seal&quot; protocols. This means that
526 if you want to use <span class="emphasis"><em>server</em></span> level security you must disable
527 the use of &quot;sign and seal&quot; on all machines on your network.
528 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2859859"></a>Configuring Samba for Seemless Windows Network Integration</h4></div></div><p>
529 MS Windows clients may use encrypted passwords as part of a challenege/response
530 authentication model (a.k.a. NTLMv1) or alone, or clear text strings for simple
531 password based authentication. It should be realized that with the SMB protocol
532 the password is passed over the network either in plain text or encrypted, but
533 not both in the same authentication request.
534 </p><p>
535 When encrypted passwords are used a password that has been entered by the user
536 is encrypted in two ways:
537 </p><div class="itemizedlist"><ul type="disc"><li><p>An MD4 hash of the UNICODE of the password
538         string.  This is known as the NT hash.
539         </p></li><li><p>The password is converted to upper case,
540         and then padded or trucated to 14 bytes.  This string is 
541         then appended with 5 bytes of NULL characters and split to
542         form two 56 bit DES keys to encrypt a &quot;magic&quot; 8 byte value.
543         The resulting 16 bytes for the LanMan hash.
544         </p></li></ul></div><p>
545 MS Windows 95 pre-service pack 1, MS Windows NT versions 3.x and version 4.0
546 pre-service pack 3 will use either mode of password authentication. All
547 versions of MS Windows that follow these versions no longer support plain
548 text passwords by default.
549 </p><p>
550 MS Windows clients have a habit of dropping network mappings that have been idle
551 for 10 minutes or longer. When the user attempts to use the mapped drive
552 connection that has been dropped, the client re-establishes the connection using
553 a cached copy of the password.
554 </p><p>
555 When Microsoft changed the default password mode, support was dropped for caching
556 of the plain text password. This means that when the registry parameter is changed
557 to re-enable use of plain text passwords it appears to work, but when a dropped
558 service connection mapping attempts to revalidate it will fail if the remote
559 authentication server does not support encrypted passwords.  This means that it
560 is definitely not a good idea to re-enable plain text password support in such clients.
561 </p><p>
562 The following parameters can be used to work around the issue of Windows 9x client
563 upper casing usernames and password before transmitting them to the SMB server
564 when using clear text authentication.
565 </p><pre class="programlisting">
566         <a href="smb.conf.5.html#PASSWORDLEVEL" target="_top">passsword level</a> = <i><tt>integer</tt></i>
567         <a href="smb.conf.5.html#USERNAMELEVEL" target="_top">username level</a> = <i><tt>integer</tt></i>
568 </pre><p>
569 By default Samba will lower case the username before attempting to lookup the user
570 in the database of local system accounts.  Because UNIX usernames conventionally
571 only contain lower case character, the <i><tt>username level</tt></i> parameter
572 is rarely needed.
573 </p><p>
574 However, passwords on UNIX systems often make use of mixed case characters. 
575 This means that in order for a user on a Windows 9x client to connect to a Samba
576 server using clear text authentication, the <i><tt>password level</tt></i>
577 must be set to the maximum number of upper case letter which <span class="emphasis"><em>could</em></span>
578 appear is a password.  Note that the server OS uses the traditional DES version
579 of crypt(), a <i><tt>password level</tt></i> of 8 will result in case
580 insensitive passwords as seen from Windows users.  This will also result in longer
581 login times as Samba has to compute the permutations of the password string and 
582 try them one by one until a match is located (or all combinations fail).
583 </p><p>
584 The best option to adopt is to enable support for encrypted passwords 
585 where ever Samba is used. There are three configuration possibilities 
586 for support of encrypted passwords:
587 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2860034"></a>Use MS Windows NT as an authentication server</h4></div></div><p>
588 This method involves the additions of the following parameters in the <tt>smb.conf</tt> file:
589 </p><pre class="programlisting">
590         encrypt passwords = Yes
591         security = server
592         password server = &quot;NetBIOS_name_of_PDC&quot;
593 </pre><p>
594 There are two ways of identifying whether or not a username and 
595 password pair was valid or not. One uses the reply information provided 
596 as part of the authentication messaging process, the other uses 
597 just an error code.
598 </p><p>
599 The down-side of this mode of configuration is the fact that 
600 for security reasons Samba will send the password server a bogus 
601 username and a bogus password and if the remote server fails to 
602 reject the username and password pair then an alternative mode 
603 of identification of validation is used. Where a site uses password 
604 lock out after a certain number of failed authentication attempts 
605 this will result in user lockouts.
606 </p><p>
607 Use of this mode of authentication does require there to be 
608 a standard Unix account for the user, this account can be blocked 
609 to prevent logons by other than MS Windows clients.
610 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2860095"></a>Domain Level Security</h3></div></div><p>
611 When samba is operating in <span class="emphasis"><em>security = domain</em></span> mode this means that
612 the Samba server has a domain security trust account (a machine account) and will cause
613 all authentication requests to be passed through to the domain controllers.
614 </p><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2860115"></a>Samba as a member of an MS Windows NT security domain</h4></div></div><p>
615 This method involves addition of the following parameters in the <tt>smb.conf</tt> file:
616 </p><pre class="programlisting">
617         encrypt passwords = Yes
618         security = domain
619         workgroup = &quot;name of NT domain&quot;
620         password server = *
621 </pre><p>
622 The use of the &quot;*&quot; argument to <b>password server</b> will cause samba to locate the
623 domain controller in a way analogous to the way this is done within MS Windows NT.
624 This is the default behaviour.
625 </p><p>
626 In order for this method to work the Samba server needs to join the 
627 MS Windows NT security domain. This is done as follows:
628 </p><div class="itemizedlist"><ul type="disc"><li><p>On the MS Windows NT domain controller using 
629         the Server Manager add a machine account for the Samba server.
630         </p></li><li><p>Next, on the Linux system execute: 
631         <b>smbpasswd -r PDC_NAME -j DOMAIN_NAME</b> (samba 2.x)
632
633         <b>net join -U administrator%password</b>   (samba-3)
634         </p></li></ul></div><p>
635 Use of this mode of authentication does require there to be a standard Unix account
636 for the user in order to assign a uid once the account has been authenticated by
637 the remote Windows DC.  This account can be blocked to prevent logons by clients other than
638 MS Windows through things such as setting an invalid shell in the
639 <tt>/etc/passwd</tt> entry. 
640 </p><p>
641 An alternative to assigning UIDs to Windows users on a Samba member server is
642 presented in the <a href="#winbind" title="Chapter 15. Unified Logons between Windows NT and UNIX using Winbind">Winbind Overview</a> chapter
643 in this HOWTO collection.
644 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2860234"></a>ADS Level Security</h3></div></div><p>
645 For information about the configuration option please refer to the entire section entitled
646 <span class="emphasis"><em>Samba as an ADS Domain Member.</em></span>
647 </p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="samba-pdc"></a>Chapter 5. 
648 Samba as an NT4 or Win2k Primary Domain Controller
649 </h2></div><div><div class="author"><h3 class="author">Gerald (Jerry) Carter</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jerry@samba.org">jerry@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">David Bannon</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:dbannon@samba.org">dbannon@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate"> (26 Apr 2001) </p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2859583">Prerequisite Reading</a></dt><dt><a href="#id2859607">
650 Background
651 </a></dt><dt><a href="#id2860563">Configuring the Samba Domain Controller</a></dt><dt><a href="#id2860863">Creating Machine Trust Accounts and Joining Clients to the Domain</a></dt><dd><dl><dt><a href="#id2861132">Manual Creation of Machine Trust Accounts</a></dt><dt><a href="#id2861366">&quot;On-the-Fly&quot; Creation of Machine Trust Accounts</a></dt><dt><a href="#id2861423">Joining the Client to the Domain</a></dt></dl></dd><dt><a href="#id2861529">Common Problems and Errors</a></dt><dd><dl><dt><a href="#id2861536">I cannot include a '$' in a machine name</a></dt><dt><a href="#id2861574">I get told &quot;You already have a connection to the Domain....&quot; 
652 or &quot;Cannot join domain, the credentials supplied conflict with an 
653 existing set..&quot; when creating a machine trust account.</a></dt><dt><a href="#id2861621">The system can not log you on (C000019B)....</a></dt><dt><a href="#id2861672">The machine trust account for this computer either does not 
654 exist or is not accessible.</a></dt><dt><a href="#id2861721">When I attempt to login to a Samba Domain from a NT4/W2K workstation,
655 I get a message about my account being disabled.</a></dt></dl></dd><dt><a href="#id2861746">Domain Control for Windows 9x/ME</a></dt><dd><dl><dt><a href="#id2861910">Configuration Instructions:       Network Logons</a></dt></dl></dd></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2859583"></a>Prerequisite Reading</h2></div></div><p>
656 Before you continue reading in this chapter, please make sure 
657 that you are comfortable with configuring basic files services
658 in smb.conf and how to enable and administer password 
659 encryption in Samba.  Theses two topics are covered in the
660 <tt>smb.conf</tt> manpage.
661 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2859607"></a>
662 Background
663 </h2></div></div><p>
664 This article outlines the steps necessary for configuring Samba as a PDC.
665 It is necessary to have a working Samba server prior to implementing the
666 PDC functionality.
667 </p><div class="itemizedlist"><ul type="disc"><li><p>
668         Domain logons for Windows NT 4.0 / 200x / XP Professional clients.
669         </p></li><li><p>
670         Placing Windows 9x / Me clients in user level security
671         </p></li><li><p>
672         Retrieving a list of users and groups from a Samba PDC to
673         Windows 9x / Me / NT / 200x / XP Professional clients
674         </p></li><li><p>
675         Roaming Profiles
676         </p></li><li><p>
677         Network/System Policies
678         </p></li></ul></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
679 Roaming Profiles and System/Network policies are advanced network administration topics
680 that are covered separately in this document.
681 </p></div><p>
682 The following functionalities are new to the Samba 3.0 release:
683 </p><div class="itemizedlist"><ul type="disc"><li><p>
684         Windows NT 4 domain trusts
685         </p></li><li><p>
686         Adding users via the User Manager for Domains
687         </p></li></ul></div><p>
688 The following functionalities are NOT provided by Samba 3.0:
689 </p><div class="itemizedlist"><ul type="disc"><li><p>
690         SAM replication with Windows NT 4.0 Domain Controllers
691         (i.e. a Samba PDC and a Windows NT BDC or vice versa) 
692         </p></li><li><p>
693         Acting as a Windows 2000 Domain Controller (i.e. Kerberos and 
694         Active Directory)
695         </p></li></ul></div><p>
696 Please note that Windows 9x / Me / XP Home clients are not true members of a domain
697 for reasons outlined in this article.  Therefore the protocol for
698 support of Windows 9x-style domain logons is completely different
699 from NT4 / Win2k type domain logons and has been officially supported for some 
700 time.
701 </p><p><span class="emphasis"><em>
702 MS Windows XP Home edition is NOT able to join a domain and does not permit
703 the use of domain logons.</em></span>
704 </p><p>
705 Implementing a Samba PDC can basically be divided into 3 broad
706 steps.
707 </p><div class="orderedlist"><ol type="1"><li><p>
708         Configuring the Samba PDC
709         </p></li><li><p>
710         Creating machine trust accounts and joining clients to the domain
711         </p></li><li><p>
712         Adding and managing domain user accounts
713         </p></li></ol></div><p>
714 There are other minor details such as user profiles, system
715 policies, etc...  However, these are not necessarily specific
716 to a Samba PDC as much as they are related to Windows NT networking
717 concepts.
718 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2860563"></a>Configuring the Samba Domain Controller</h2></div></div><p>
719 The first step in creating a working Samba PDC is to 
720 understand the parameters necessary in smb.conf. Here we
721 attempt to explain the parameters that are covered in
722 the <tt>smb.conf</tt> man page.
723 </p><p>
724 Here is an example <tt>smb.conf</tt> for acting as a PDC:
725 </p><pre class="programlisting">
726 [global]
727     ; Basic server settings
728     <a href="smb.conf.5.html#NETBIOSNAME" target="_top">netbios name</a> = <i><tt>POGO</tt></i>
729     <a href="smb.conf.5.html#WORKGROUP" target="_top">workgroup</a> = <i><tt>NARNIA</tt></i>
730
731     ; User and Machine Account Backends
732     ; Choices are: tdbsam, tdbsam_nua, smbpasswd, smbpasswd_nua, ldapsam, ldapsam_nua, ...
733     ;              mysqlsam, xmlsam, guest
734     <a href="smb.conf.5.html#PASSDBBACKEND" target="_top">passdb backend</a> = ldapsam, guest
735
736     ; we should act as the domain and local master browser
737     <a href="smb.conf.5.html#OSLEVEL" target="_top">os level</a> = 64
738     <a href="smb.conf.5.html#PERFERREDMASTER" target="_top">preferred master</a> = yes
739     <a href="smb.conf.5.html#DOMAINMASTER" target="_top">domain master</a> = yes
740     <a href="smb.conf.5.html#LOCALMASTER" target="_top">local master</a> = yes
741     
742     ; security settings (must user security = user)
743     <a href="smb.conf.5.html#SECURITYEQUALSUSER" target="_top">security</a> = user
744     
745     ; encrypted passwords are a requirement for a PDC
746     <a href="smb.conf.5.html#ENCRYPTPASSWORDS" target="_top">encrypt passwords</a> = yes
747     
748     ; support domain logons
749     <a href="smb.conf.5.html#DOMAINLOGONS" target="_top">domain logons</a> = yes
750     
751     ; where to store user profiles?
752     <a href="smb.conf.5.html#LOGONPATH" target="_top">logon path</a> = \\%N\profiles\%u
753     
754     ; where is a user's home directory and where should it be mounted at?
755     <a href="smb.conf.5.html#LOGONDRIVE" target="_top">logon drive</a> = H:
756     <a href="smb.conf.5.html#LOGONHOME" target="_top">logon home</a> = \\homeserver\%u
757     
758     ; specify a generic logon script for all users
759     ; this is a relative **DOS** path to the [netlogon] share
760     <a href="smb.conf.5.html#LOGONSCRIPT" target="_top">logon script</a> = logon.cmd
761
762 ; necessary share for domain controller
763 [netlogon]
764     <a href="smb.conf.5.html#PATH" target="_top">path</a> = /usr/local/samba/lib/netlogon
765     <a href="smb.conf.5.html#READONLY" target="_top">read only</a> = yes
766     <a href="smb.conf.5.html#WRITELIST" target="_top">write list</a> = <i><tt>ntadmin</tt></i>
767     
768 ; share for storing user profiles
769 [profiles]
770     <a href="smb.conf.5.html#PATH" target="_top">path</a> = /export/smb/ntprofile
771     <a href="smb.conf.5.html#READONLY" target="_top">read only</a> = no
772     <a href="smb.conf.5.html#CREATEMASK" target="_top">create mask</a> = 0600
773     <a href="smb.conf.5.html#DIRECTORYMASK" target="_top">directory mask</a> = 0700
774 </pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
775 The above parameters make for a full set of parameters that may define the server's mode
776 of operation. The following parameters are the essentials alone:
777
778 </p><pre class="programlisting">
779         workgroup = NARNIA
780         domain logons = Yes
781         security = User
782 </pre><p>
783
784 The additional parameters shown in the longer listing above just makes for a
785 more complete environment.
786 </p></div><p>
787 There are a couple of points to emphasize in the above configuration.
788 </p><div class="itemizedlist"><ul type="disc"><li><p>
789         Encrypted passwords must be enabled.  For more details on how 
790         to do this, refer to <a href="#passdb" title="Chapter 10. User information database">the User Database chapter</a>.
791         </p></li><li><p>
792         The server must support domain logons and a
793         <tt>[netlogon]</tt> share
794         </p></li><li><p>
795         The server must be the domain master browser in order for Windows 
796         client to locate the server as a DC.  Please refer to the various 
797         Network Browsing documentation included with this distribution for 
798         details.
799         </p></li></ul></div><p>
800 Samba 3.0 offers a complete implementation of group mapping
801 between Windows NT groups and Unix groups (this is really quite
802 complicated to explain in a short space).
803 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2860863"></a>Creating Machine Trust Accounts and Joining Clients to the Domain</h2></div></div><p>
804 A machine trust account is a Samba account that is used to
805 authenticate a client machine (rather than a user) to the Samba
806 server.  In Windows terminology, this is known as a &quot;Computer
807 Account.&quot;</p><p>
808 The password of a machine trust account acts as the shared secret for
809 secure communication with the Domain Controller.  This is a security
810 feature to prevent an unauthorized machine with the same NetBIOS name
811 from joining the domain and gaining access to domain user/group
812 accounts.  Windows NT, 200x, XP Professional clients use machine trust
813 accounts, but Windows 9x / Me / XP Home clients do not.  Hence, a
814 Windows 9x / Me / XP Home  client is never a true member of a domain
815 because it does not possess a machine trust account, and thus has no
816 shared secret with the domain controller.
817 </p><p>A Windows PDC stores each machine trust account in the Windows
818 Registry. A Samba-3 PDC also has to store machine trust account information
819 in a suitable backend data store. With Samba-3 there can be multiple back-ends
820 for this including:
821 </p><div class="itemizedlist"><ul type="disc"><li><p>
822         <span class="emphasis"><em>smbpasswd</em></span> - the plain ascii file stored used by
823         earlier versions of Samba. This file configuration option requires
824         a Unix/Linux system account for EVERY entry (ie: both for user and for
825         machine accounts). This file will be located in the <span class="emphasis"><em>private</em></span>
826         directory (default is /usr/local/samba/lib/private or on linux /etc/samba).
827         </p></li><li><p>
828         <span class="emphasis"><em>smbpasswd_nua</em></span> - This file is independant of the
829         system wide user accounts. The use of this back-end option requires
830         specification of the &quot;non unix account range&quot; option also. It is called
831         smbpasswd and will be located in the <tt>private</tt> directory.
832         </p></li><li><p>
833         <span class="emphasis"><em>tdbsam</em></span> - a binary database backend that will be
834         stored in the <span class="emphasis"><em>private</em></span> directory in a file called
835         <span class="emphasis"><em>passwd.tdb</em></span>. The key benefit of this binary format
836         file is that it can store binary objects that can not be accomodated
837         in the traditional plain text smbpasswd file.
838         </p></li><li><p>
839         <span class="emphasis"><em>tdbsam_nua</em></span> like the smbpasswd_nua option above, this
840         file allows the creation of arbitrary user and machine accounts without
841         requiring that account to be added to the system (/etc/passwd) file. It
842         too requires the specification of the &quot;non unix account range&quot; option
843         in the [globals] section of the <tt>smb.conf</tt> file.
844         </p></li><li><p>
845         <span class="emphasis"><em>ldapsam</em></span> - An LDAP based back-end. Permits the
846         LDAP server to be specified. eg: ldap://localhost or ldap://frodo.murphy.com
847         </p></li><li><p>
848         <span class="emphasis"><em>ldapsam_nua</em></span> - LDAP based back-end with no unix
849         account requirement, like smbpasswd_nua and tdbsam_nua above.
850         </p></li></ul></div><p>Read the chapter about the <a href="#passdb" title="Chapter 10. User information database">User Database</a> 
851 for details.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
852 The new tdbsam and ldapsam account backends store vastly more information than
853 smbpasswd is capable of. The new backend database includes capacity to specify
854 per user settings for many parameters, over-riding global settings given in the
855 <tt>smb.conf</tt> file. eg: logon drive, logon home, logon path, etc.
856 </p></div><p>
857 A Samba PDC, however, stores each machine trust account in two parts,
858 as follows:
859
860 </p><div class="itemizedlist"><ul type="disc"><li><p>A Samba account, stored in the same location as user
861     LanMan and NT password hashes (currently
862     <tt>smbpasswd</tt>). The Samba account 
863     possesses and uses only the NT password hash.</p></li><li><p>A corresponding Unix account, typically stored in
864     <tt>/etc/passwd</tt>. (Future releases will alleviate the need to
865     create <tt>/etc/passwd</tt> entries.) </p></li></ul></div><p>
866 </p><p>
867 There are two ways to create machine trust accounts:
868 </p><div class="itemizedlist"><ul type="disc"><li><p> Manual creation. Both the Samba and corresponding
869         Unix account are created by hand.</p></li><li><p> &quot;On-the-fly&quot; creation. The Samba machine trust
870         account is automatically created by Samba at the time the client
871         is joined to the domain. (For security, this is the
872         recommended method.) The corresponding Unix account may be
873         created automatically or manually. </p></li></ul></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2861132"></a>Manual Creation of Machine Trust Accounts</h3></div></div><p>
874 The first step in manually creating a machine trust account is to
875 manually create the corresponding Unix account in
876 <tt>/etc/passwd</tt>.  This can be done using
877 <b>vipw</b> or other 'add user' command that is normally
878 used to create new Unix accounts.  The following is an example for a
879 Linux based Samba server:
880 </p><p>
881   <tt>root# </tt><b>/usr/sbin/useradd -g 100 -d /dev/null -c <i><tt>&quot;machine 
882 nickname&quot;</tt></i> -s /bin/false <i><tt>machine_name</tt></i>$ </b>
883 </p><p>
884 <tt>root# </tt><b>passwd -l <i><tt>machine_name</tt></i>$</b>
885 </p><p>On *BSD systems, this can be done using the 'chpass' utility:</p><p>
886 <tt>root# </tt><b>chpass -a &quot;<i><tt>machine_name</tt></i>$:*:101:100::0:0:Workstation <i><tt>machine_name</tt></i>:/dev/null:/sbin/nologin&quot;</b>
887 </p><p>
888 The <tt>/etc/passwd</tt> entry will list the machine name 
889 with a &quot;$&quot; appended, won't have a password, will have a null shell and no 
890 home directory. For example a machine named 'doppy' would have an 
891 <tt>/etc/passwd</tt> entry like this:
892 </p><pre class="programlisting">
893 doppy$:x:505:501:<i><tt>machine_nickname</tt></i>:/dev/null:/bin/false
894 </pre><p>
895 Above, <i><tt>machine_nickname</tt></i> can be any
896 descriptive name for the client, i.e., BasementComputer.
897 <i><tt>machine_name</tt></i> absolutely must be the NetBIOS
898 name of the client to be joined to the domain.  The &quot;$&quot; must be
899 appended to the NetBIOS name of the client or Samba will not recognize
900 this as a machine trust account.
901 </p><p>
902 Now that the corresponding Unix account has been created, the next step is to create 
903 the Samba account for the client containing the well-known initial 
904 machine trust account password.  This can be done using the <a href="smbpasswd.8.html" target="_top"><b>smbpasswd(8)</b></a> command 
905 as shown here:
906 </p><p>
907 <tt>root# </tt><b><tt>smbpasswd -a -m <i><tt>machine_name</tt></i></tt></b>
908 </p><p>
909 where <i><tt>machine_name</tt></i> is the machine's NetBIOS
910 name.  The RID of the new machine account is generated from the UID of 
911 the corresponding Unix account.
912 </p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Join the client to the domain immediately</h3><p>
913         Manually creating a machine trust account using this method is the 
914         equivalent of creating a machine trust account on a Windows NT PDC using 
915         the &quot;Server Manager&quot;.  From the time at which the account is created
916         to the time which the client joins the domain and changes the password,
917         your domain is vulnerable to an intruder joining your domain using
918         a machine with the same NetBIOS name.  A PDC inherently trusts
919         members of the domain and will serve out a large degree of user 
920         information to such clients.  You have been warned!
921         </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2861366"></a>&quot;On-the-Fly&quot; Creation of Machine Trust Accounts</h3></div></div><p>
922 The second (and recommended) way of creating machine trust accounts is
923 simply to allow the Samba server to create them as needed when the client
924 is joined to the domain. </p><p>Since each Samba machine trust account requires a corresponding
925 Unix account, a method for automatically creating the
926 Unix account is usually supplied; this requires configuration of the
927 <a href="smb.conf.5.html#ADDUSERSCRIPT" target="_top">add user script</a> 
928 option in <tt>smb.conf</tt>.  This
929 method is not required, however; corresponding Unix accounts may also
930 be created manually.
931 </p><p>Below is an example for a RedHat 6.2 Linux system.
932 </p><pre class="programlisting">
933 [global]
934    # &lt;...remainder of parameters...&gt;
935    add user script = /usr/sbin/useradd -d /dev/null -g 100 -s /bin/false -M %u 
936 </pre></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2861423"></a>Joining the Client to the Domain</h3></div></div><p>
937 The procedure for joining a client to the domain varies with the
938 version of Windows.
939 </p><div class="itemizedlist"><ul type="disc"><li><p><span class="emphasis"><em>Windows 2000</em></span></p><p>
940         When the user elects to join the client to a domain, Windows prompts for
941         an account and password that is privileged to join the domain. A Samba administrative
942         account (i.e., a Samba account that has root privileges on the Samba server) must be
943         entered here; the operation will fail if an ordinary user account is given. 
944         The password for this account should be set to a different password than the associated
945         <tt>/etc/passwd</tt> entry, for security reasons.
946         </p><p>
947         The session key of the Samba administrative account acts as an
948         encryption key for setting the password of the machine trust
949         account. The machine trust account will be created on-the-fly, or
950         updated if it already exists.
951         </p></li><li><p><span class="emphasis"><em>Windows NT</em></span></p><p> If the machine trust account was created manually, on the
952         Identification Changes menu enter the domain name, but do not
953         check the box &quot;Create a Computer Account in the Domain.&quot;  In this case,
954         the existing machine trust account is used to join the machine to
955         the domain.</p><p> If the machine trust account is to be created
956         on-the-fly, on the Identification Changes menu enter the domain
957         name, and check the box &quot;Create a Computer Account in the Domain.&quot;  In
958         this case, joining the domain proceeds as above for Windows 2000
959         (i.e., you must supply a Samba administrative account when
960         prompted).</p></li><li><p><span class="emphasis"><em>Samba</em></span></p><p>Joining a samba client to a domain is documented in 
961         the <a href="#domain-member" title="Chapter 8. Samba as a NT4 or Win2k domain member">Domain Member</a> chapter.
962 </p></li></ul></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2861529"></a>Common Problems and Errors</h2></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2861536"></a>I cannot include a '$' in a machine name</h3></div></div><p>
963 A 'machine name' in (typically) <tt>/etc/passwd</tt>    
964 of the machine name with a '$' appended. FreeBSD (and other BSD 
965 systems?) won't create a user with a '$' in their name.
966 </p><p>
967 The problem is only in the program used to make the entry. Once made, it works perfectly.
968 Create a user without the '$' using <b>vipw</b> to edit the entry, adding
969 the '$'. Or create the whole entry with vipw if you like, make sure you use a unique User ID!
970 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2861574"></a>I get told &quot;You already have a connection to the Domain....&quot; 
971 or &quot;Cannot join domain, the credentials supplied conflict with an 
972 existing set..&quot; when creating a machine trust account.</h3></div></div><p>
973 This happens if you try to create a machine trust account from the 
974 machine itself and already have a connection (e.g. mapped drive) 
975 to a share (or IPC$) on the Samba PDC.  The following command
976 will remove all network drive connections:
977 </p><p>
978 <tt>C:\WINNT\&gt;</tt> <b>net use * /d</b>
979 </p><p>
980 Further, if the machine is already a 'member of a workgroup' that 
981 is the same name as the domain you are joining (bad idea) you will 
982 get this message.  Change the workgroup name to something else, it 
983 does not matter what, reboot, and try again.
984 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2861621"></a>The system can not log you on (C000019B)....</h3></div></div><p>I joined the domain successfully but after upgrading 
985 to a newer version of the Samba code I get the message, &quot;The system 
986 can not log you on (C000019B), Please try again or consult your 
987 system administrator&quot; when attempting to logon.
988 </p><p>
989 This occurs when the domain SID stored in the secrets.tdb database
990 is changed. The most common cause of a change in domain SID is when
991 the domain name and/or the server name (netbios name) is changed.
992 The only way to correct the problem is to restore the original domain 
993 SID or remove the domain client from the domain and rejoin. The domain
994 SID may be reset using either the net or rpcclient utilities.
995 </p><p>
996 The reset or change the domain SID you can use the net command as follows:
997
998 </p><pre class="programlisting">
999         net getlocalsid 'OLDNAME'
1000         net setlocalsid 'SID'
1001 </pre><p>
1002 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2861672"></a>The machine trust account for this computer either does not 
1003 exist or is not accessible.</h3></div></div><p>
1004 When I try to join the domain I get the message &quot;The machine account 
1005 for this computer either does not exist or is not accessible&quot;. What's 
1006 wrong?
1007 </p><p>
1008 This problem is caused by the PDC not having a suitable machine trust account. 
1009 If you are using the <i><tt>add user script</tt></i> method to create 
1010 accounts then this would indicate that it has not worked. Ensure the domain 
1011 admin user system is working.
1012 </p><p>
1013 Alternatively if you are creating account entries manually then they 
1014 have not been created correctly. Make sure that you have the entry 
1015 correct for the machine trust account in smbpasswd file on the Samba PDC. 
1016 If you added the account using an editor rather than using the smbpasswd 
1017 utility, make sure that the account name is the machine NetBIOS name 
1018 with a '$' appended to it ( i.e. computer_name$ ). There must be an entry 
1019 in both /etc/passwd and the smbpasswd file. Some people have reported 
1020 that inconsistent subnet masks between the Samba server and the NT 
1021 client have caused this problem.   Make sure that these are consistent 
1022 for both client and server.
1023 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2861721"></a>When I attempt to login to a Samba Domain from a NT4/W2K workstation,
1024 I get a message about my account being disabled.</h3></div></div><p>
1025 At first be ensure to enable the useraccounts with <b>smbpasswd -e 
1026 %user%</b>, this is normally done, when you create an account.
1027 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2861746"></a>Domain Control for Windows 9x/ME</h2></div></div><p>
1028 A domain and a workgroup are exactly the same thing in terms of network
1029 browsing.  The difference is that a distributable authentication
1030 database is associated with a domain, for secure login access to a
1031 network.  Also, different access rights can be granted to users if they
1032 successfully authenticate against a domain logon server. Samba-3 does this
1033 now in the same way that MS Windows NT/2K.
1034 </p><p>
1035 The SMB client logging on to a domain has an expectation that every other
1036 server in the domain should accept the same authentication information.
1037 Network browsing functionality of domains and workgroups is identical and
1038 is explained in this documentation under the browsing discussions.
1039 It should be noted, that browsing is totally orthogonal to logon support.
1040 </p><p>
1041 Issues related to the single-logon network model are discussed in this
1042 section.  Samba supports domain logons, network logon scripts, and user
1043 profiles for MS Windows for workgroups and MS Windows 9X/ME clients
1044 which are the focus of this section.
1045 </p><p>
1046 When an SMB client in a domain wishes to logon it broadcast requests for a
1047 logon server.  The first one to reply gets the job, and validates its
1048 password using whatever mechanism the Samba administrator has installed.
1049 It is possible (but very stupid) to create a domain where the user
1050 database is not shared between servers, i.e. they are effectively workgroup
1051 servers advertising themselves as participating in a domain.  This
1052 demonstrates how authentication is quite different from but closely
1053 involved with domains.
1054 </p><p>
1055 Using these features you can make your clients verify their logon via
1056 the Samba server; make clients run a batch file when they logon to
1057 the network and download their preferences, desktop and start menu.
1058 </p><p>
1059 Before launching into the configuration instructions, it is 
1060 worthwhile to look at how a Windows 9x/ME client performs a logon:
1061 </p><div class="orderedlist"><ol type="1"><li><p>
1062         The client broadcasts (to the IP broadcast address of the subnet it is in)
1063         a NetLogon request. This is sent to the NetBIOS name DOMAIN&lt;1c&gt; at the
1064         NetBIOS layer.  The client chooses the first response it receives, which
1065         contains the NetBIOS name of the logon server to use in the format of 
1066         \\SERVER.
1067         </p></li><li><p>
1068         The client then connects to that server, logs on (does an SMBsessetupX) and
1069         then connects to the IPC$ share (using an SMBtconX).
1070         </p></li><li><p>
1071         The client then does a NetWkstaUserLogon request, which retrieves the name
1072         of the user's logon script. 
1073         </p></li><li><p>
1074         The client then connects to the NetLogon share and searches for this    
1075         and if it is found and can be read, is retrieved and executed by the client.
1076         After this, the client disconnects from the NetLogon share.
1077         </p></li><li><p>
1078         The client then sends a NetUserGetInfo request to the server, to retrieve
1079         the user's home share, which is used to search for profiles. Since the
1080         response to the NetUserGetInfo request does not contain much more then  
1081         the user's home share, profiles for Win9X clients MUST reside in the user
1082         home directory.
1083         </p></li><li><p>
1084         The client then connects to the user's home share and searches for the 
1085         user's profile. As it turns out, you can specify the user's home share as
1086         a sharename and path. For example, \\server\fred\.profile.
1087         If the profiles are found, they are implemented.
1088         </p></li><li><p>
1089         The client then disconnects from the user's home share, and reconnects to
1090         the NetLogon share and looks for CONFIG.POL, the policies file. If this is
1091         found, it is read and implemented.
1092         </p></li></ol></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2861910"></a>Configuration Instructions:      Network Logons</h3></div></div><p>
1093 The main difference between a PDC and a Windows 9x logon 
1094 server configuration is that
1095 </p><div class="itemizedlist"><ul type="disc"><li><p>
1096 Password encryption is not required for a Windows 9x logon server.
1097 </p></li><li><p>
1098 Windows 9x/ME clients do not possess machine trust accounts.
1099 </p></li></ul></div><p>
1100 Therefore, a Samba PDC will also act as a Windows 9x logon 
1101 server.
1102 </p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">security mode and master browsers</h3><p>
1103 There are a few comments to make in order to tie up some 
1104 loose ends.  There has been much debate over the issue of whether
1105 or not it is ok to configure Samba as a Domain Controller in security
1106 modes other than <tt>USER</tt>.  The only security mode 
1107 which  will not work due to technical reasons is <tt>SHARE</tt>
1108 mode security.  <tt>DOMAIN</tt> and <tt>SERVER</tt>
1109 mode security is really just a variation on SMB user level security.
1110 </p><p>
1111 Actually, this issue is also closely tied to the debate on whether 
1112 or not Samba must be the domain master browser for its workgroup
1113 when operating as a DC.  While it may technically be possible
1114 to configure a server as such (after all, browsing and domain logons
1115 are two distinctly different functions), it is not a good idea to do
1116 so.  You should remember that the DC must register the DOMAIN#1b NetBIOS 
1117 name.  This is the name used by Windows clients to locate the DC.
1118 Windows clients do not distinguish between the DC and the DMB.
1119 For this reason, it is very wise to configure the Samba DC as the DMB.
1120 </p><p>
1121 Now back to the issue of configuring a Samba DC to use a mode other
1122 than &quot;security = user&quot;.  If a Samba host is configured to use 
1123 another SMB server or DC in order to validate user connection 
1124 requests, then it is a fact that some other machine on the network 
1125 (the &quot;password server&quot;) knows more about the user than the Samba host.
1126 99% of the time, this other host is a domain controller.  Now 
1127 in order to operate in domain mode security, the &quot;workgroup&quot; parameter
1128 must be set to the name of the Windows NT domain (which already 
1129 has a domain controller, right?)
1130 </p><p>
1131 Therefore configuring a Samba box as a DC for a domain that 
1132 already by definition has a PDC is asking for trouble.
1133 Therefore, you should always configure the Samba DC to be the DMB
1134 for its domain.
1135 </p></div></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="samba-bdc"></a>Chapter 6. 
1136 Samba Backup Domain Controller to Samba Domain Control
1137 </h2></div><div><div class="author"><h3 class="author">Volker Lendecke</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:Volker.Lendecke@SerNet.DE">Volker.Lendecke@SerNet.DE</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate"> (26 Apr 2001) </p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2845056">Prerequisite Reading</a></dt><dt><a href="#id2860294">Background</a></dt><dt><a href="#id2862166">What qualifies a Domain Controller on the network?</a></dt><dd><dl><dt><a href="#id2862187">How does a Workstation find its domain controller?</a></dt><dt><a href="#id2862212">When is the PDC needed?</a></dt></dl></dd><dt><a href="#id2862231">Can Samba be a Backup Domain Controller to an NT PDC?</a></dt><dt><a href="#id2862264">How do I set up a Samba BDC?</a></dt><dd><dl><dt><a href="#id2862361">How do I replicate the smbpasswd file?</a></dt><dt><a href="#id2862390">Can I do this all with LDAP?</a></dt></dl></dd></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2845056"></a>Prerequisite Reading</h2></div></div><p>
1138 Before you continue reading in this chapter, please make sure
1139 that you are comfortable with configuring a Samba PDC
1140 as described in the <a href="Samba-PDC-HOWTO.html" target="_top">Samba-PDC-HOWTO</a>.
1141 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2860294"></a>Background</h2></div></div><p>
1142 What is a Domain Controller? It is a machine that is able to answer
1143 logon requests from workstations in a Windows NT Domain. Whenever a
1144 user logs into a Windows NT Workstation, the workstation connects to a
1145 Domain Controller and asks him whether the username and password the
1146 user typed in is correct.  The Domain Controller replies with a lot of
1147 information about the user, for example the place where the users
1148 profile is stored, the users full name of the user. All this
1149 information is stored in the NT user database, the so-called SAM.
1150 </p><p>
1151 There are two kinds of Domain Controller in a NT 4 compatible Domain:
1152 A Primary Domain Controller (PDC) and one or more Backup Domain
1153 Controllers (BDC). The PDC contains the master copy of the
1154 SAM. Whenever the SAM has to change, for example when a user changes
1155 his password, this change has to be done on the PDC. A Backup Domain
1156 Controller is a machine that maintains a read-only copy of the
1157 SAM. This way it is able to reply to logon requests and authenticate
1158 users in case the PDC is not available. During this time no changes to
1159 the SAM are possible. Whenever changes to the SAM are done on the PDC,
1160 all BDC receive the changes from the PDC.
1161 </p><p>
1162 Since version 2.2 Samba officially supports domain logons for all
1163 current Windows Clients, including Windows 2000 and XP. This text
1164 assumes the domain to be named SAMBA. To be able to act as a PDC, some
1165 parameters in the [global]-section of the smb.conf have to be set:
1166 </p><pre class="programlisting">
1167         workgroup = SAMBA
1168         domain master = yes
1169         domain logons = yes
1170 </pre><p>
1171 Several other things like a [homes] and a [netlogon] share also may be
1172 set along with settings for the profile path, the users home drive and
1173 others. This will not be covered in this document.
1174 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2862166"></a>What qualifies a Domain Controller on the network?</h2></div></div><p>
1175 Every machine that is a Domain Controller for the domain SAMBA has to
1176 register the NetBIOS group name SAMBA#1c with the WINS server and/or
1177 by broadcast on the local network. The PDC also registers the unique
1178 NetBIOS name SAMBA#1b with the WINS server. The name type #1b is
1179 normally reserved for the domain master browser, a role that has
1180 nothing to do with anything related to authentication, but the
1181 Microsoft Domain implementation requires the domain master browser to
1182 be on the same machine as the PDC.
1183 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2862187"></a>How does a Workstation find its domain controller?</h3></div></div><p>
1184 A NT workstation in the domain SAMBA that wants a local user to be
1185 authenticated has to find the domain controller for SAMBA. It does
1186 this by doing a NetBIOS name query for the group name SAMBA#1c. It
1187 assumes that each of the machines it gets back from the queries is a
1188 domain controller and can answer logon requests. To not open security
1189 holes both the workstation and the selected (TODO: How is the DC
1190 chosen) domain controller authenticate each other. After that the
1191 workstation sends the user's credentials (his name and password) to
1192 the domain controller, asking for approval.
1193 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2862212"></a>When is the PDC needed?</h3></div></div><p>
1194 Whenever a user wants to change his password, this has to be done on
1195 the PDC. To find the PDC, the workstation does a NetBIOS name query
1196 for SAMBA#1b, assuming this machine maintains the master copy of the
1197 SAM. The workstation contacts the PDC, both mutually authenticate and
1198 the password change is done.
1199 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2862231"></a>Can Samba be a Backup Domain Controller to an NT PDC?</h2></div></div><p>
1200 With version 2.2, no. The native NT SAM replication protocols have
1201 not yet been fully implemented. The Samba Team is working on
1202 understanding and implementing the protocols, but this work has not
1203 been finished for version 2.2.
1204 </p><p>
1205 With version 3.0, the work on both the replication protocols and a
1206 suitable storage mechanism has progressed, and some form of NT4 BDC
1207 support is expected soon.
1208 </p><p>
1209 Can I get the benefits of a BDC with Samba?  Yes. The main reason for
1210 implementing a BDC is availability. If the PDC is a Samba machine,
1211 a second Samba machine can be set up to
1212 service logon requests whenever the PDC is down.
1213 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2862264"></a>How do I set up a Samba BDC?</h2></div></div><p>
1214 Several things have to be done:
1215 </p><div class="itemizedlist"><ul type="disc"><li><p>
1216 The domain SID has to be the same on the PDC and the BDC. This used to
1217 be stored in the file private/MACHINE.SID. This file is not created
1218 anymore since Samba 2.2.5 or even earlier. Nowadays the domain SID is
1219 stored in the file private/secrets.tdb. Simply copying the secrets.tdb
1220 from the PDC to the BDC does not work, as the BDC would
1221 generate a new SID for itself and override the domain SID with this
1222 new BDC SID.</p><p>
1223 To retrieve the domain SID from the PDC or an existing BDC and store it in the
1224 secrets.tdb, execute 'net rpc getsid' on the BDC.
1225 </p></li><li><p>
1226 The Unix user database has to be synchronized from the PDC to the
1227 BDC. This means that both the /etc/passwd and /etc/group have to be
1228 replicated from the PDC to the BDC. This can be done manually
1229 whenever changes are made, or the PDC is set up as a NIS master
1230 server and the BDC as a NIS slave server. To set up the BDC as a
1231 mere NIS client would not be enough, as the BDC would not be able to
1232 access its user database in case of a PDC failure.
1233 </p></li><li><p>
1234 The Samba password database in the file private/smbpasswd has to be
1235 replicated from the PDC to the BDC. This is a bit tricky, see the
1236 next section.
1237 </p></li><li><p>
1238 Any netlogon share has to be replicated from the PDC to the
1239 BDC. This can be done manually whenever login scripts are changed,
1240 or it can be done automatically together with the smbpasswd
1241 synchronization.
1242 </p></li></ul></div><p>
1243 Finally, the BDC has to be found by the workstations. This can be done
1244 by setting
1245 </p><pre class="programlisting">
1246         workgroup = samba
1247         domain master = no
1248         domain logons = yes
1249 </pre><p>
1250 in the [global]-section of the smb.conf of the BDC. This makes the BDC
1251 only register the name SAMBA#1c with the WINS server. This is no
1252 problem as the name SAMBA#1c is a NetBIOS group name that is meant to
1253 be registered by more than one machine. The parameter 'domain master =
1254 no' forces the BDC not to register SAMBA#1b which as a unique NetBIOS
1255 name is reserved for the Primary Domain Controller.
1256 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2862361"></a>How do I replicate the smbpasswd file?</h3></div></div><p>
1257 Replication of the smbpasswd file is sensitive. It has to be done
1258 whenever changes to the SAM are made. Every user's password change is
1259 done in the smbpasswd file and has to be replicated to the BDC. So
1260 replicating the smbpasswd file very often is necessary.
1261 </p><p>
1262 As the smbpasswd file contains plain text password equivalents, it
1263 must not be sent unencrypted over the wire. The best way to set up
1264 smbpasswd replication from the PDC to the BDC is to use the utility
1265 rsync. rsync can use ssh as a transport. ssh itself can be set up to
1266 accept *only* rsync transfer without requiring the user to type a
1267 password.
1268 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2862390"></a>Can I do this all with LDAP?</h3></div></div><p>The simple answer is YES.  Samba's pdb_ldap code supports
1269 binding to a replica LDAP server, and will also follow referrals and
1270 rebind to the master if it ever needs to make a modification to the
1271 database.  (Normally BDCs are read only, so this will not occur
1272 often).
1273 </p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="ADS"></a>Chapter 7. Samba as a ADS domain member</h2></div><div><div class="author"><h3 class="author">Andrew Tridgell</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:tridge@samba.org">tridge@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Jelmer R. Vernooij</h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">2002/2003</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2862021">Setup your smb.conf</a></dt><dt><a href="#id2862571">Setup your /etc/krb5.conf</a></dt><dt><a href="#ads-create-machine-account">Create the computer account</a></dt><dd><dl><dt><a href="#id2862765">Possible errors</a></dt></dl></dd><dt><a href="#ads-test-server">Test your server setup</a></dt><dt><a href="#ads-test-smbclient">Testing with smbclient</a></dt><dt><a href="#id2862919">Notes</a></dt></dl></div><p>
1274 This is a rough guide to setting up Samba 3.0 with kerberos authentication against a
1275 Windows2000 KDC. 
1276 </p><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2862021"></a>Setup your <tt>smb.conf</tt></h2></div></div><p>You must use at least the following 3 options in smb.conf:</p><pre class="programlisting">
1277         realm = YOUR.KERBEROS.REALM
1278         security = ADS
1279         encrypt passwords = yes
1280 </pre><p>
1281 In case samba can't figure out your ads server using your realm name, use the 
1282 <b>ads server</b> option in <tt>smb.conf</tt>:
1283 </p><pre class="programlisting">
1284         ads server = your.kerberos.server
1285 </pre><p>
1286 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>You do *not* need a smbpasswd file, and older clients will
1287   be authenticated as if <b>security = domain</b>,
1288   although it won't do any harm
1289   and allows you to have local users not in the domain.
1290   I expect that the above required options will change soon when we get better
1291   active directory integration.</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2862571"></a>Setup your <tt>/etc/krb5.conf</tt></h2></div></div><p>Note: you will need the krb5 workstation, devel, and libs installed</p><p>The minimal configuration for <tt>krb5.conf</tt> is:</p><pre class="programlisting">
1292         [realms]
1293             YOUR.KERBEROS.REALM = {
1294                 kdc = your.kerberos.server
1295             }
1296 </pre><p>Test your config by doing a <b><tt>kinit
1297 <i><tt>USERNAME</tt></i>@<i><tt>REALM</tt></i></tt></b> and
1298 making sure that your password is accepted by the Win2000 KDC.
1299 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The realm must be uppercase or you will get &quot;Cannot find KDC for requested
1300 realm while getting initial credentials&quot; error </p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Time between the two servers must be synchronized.  You will get a
1301 &quot;kinit(v5): Clock skew too great while getting initial credentials&quot; if the time
1302 difference is more than five minutes. </p></div><p>
1303 You also must ensure that you can do a reverse DNS lookup on the IP
1304 address of your KDC. Also, the name that this reverse lookup maps to
1305 must either be the netbios name of the KDC (ie. the hostname with no
1306 domain attached) or it can alternatively be the netbios name
1307 followed by the realm. 
1308 </p><p>
1309 The easiest way to ensure you get this right is to add a 
1310 <tt>/etc/hosts</tt> entry mapping the IP address of your KDC to 
1311 its netbios name. If you don't get this right then you will get a 
1312 &quot;local error&quot; when you try to join the realm.
1313 </p><p>
1314 If all you want is kerberos support in smbclient then you can skip
1315 straight to <a href="#ads-test-smbclient" title="Testing with smbclient">Test with smbclient</a> now. 
1316 <a href="#ads-create-machine-account" title="Create the computer account">Creating a computer account</a> 
1317 and <a href="#ads-test-server" title="Test your server setup">testing your servers</a>
1318 is only needed if you want kerberos support for smbd and winbindd.
1319 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="ads-create-machine-account"></a>Create the computer account</h2></div></div><p>
1320 As a user that has write permission on the Samba private directory
1321 (usually root) run:
1322 </p><pre class="programlisting">
1323         <b><tt>net join -U Administrator%password</tt></b>
1324 </pre><p>
1325 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2862765"></a>Possible errors</h3></div></div><p>
1326 </p><div class="variablelist"><dl><dt><span class="term">&quot;ADS support not compiled in&quot;</span></dt><dd><p>Samba must be reconfigured (remove config.cache) and recompiled
1327         (make clean all install) after the kerberos libs and headers are installed.
1328         </p></dd><dt><span class="term">net join prompts for user name</span></dt><dd><p>You need to login to the domain using <b><tt>kinit
1329         <i><tt>USERNAME</tt></i>@<i><tt>REALM</tt></i></tt></b>.
1330         <i><tt>USERNAME</tt></i> must be a user who has rights to add a machine
1331         to the domain.  </p></dd></dl></div><p>
1332 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="ads-test-server"></a>Test your server setup</h2></div></div><p>
1333 If the join was successful, you will see a new computer account with the
1334 NetBIOS name of your Samba server in Active Directory (in the &quot;Computers&quot;
1335 folder under Users and Computers.
1336 </p><p>
1337 On a Windows 2000 client try <b><tt>net use * \\server\share</tt></b>. You should
1338 be logged in with kerberos without needing to know a password. If
1339 this fails then run <b><tt>klist tickets</tt></b>. Did you get a ticket for the
1340 server? Does it have an encoding type of DES-CBC-MD5 ? 
1341 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="ads-test-smbclient"></a>Testing with smbclient</h2></div></div><p>
1342 On your Samba server try to login to a Win2000 server or your Samba
1343 server using smbclient and kerberos. Use smbclient as usual, but
1344 specify the <i><tt>-k</tt></i> option to choose kerberos authentication.
1345 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2862919"></a>Notes</h2></div></div><p>You must change administrator password at least once after DC 
1346 install, to create the right encoding types</p><p>w2k doesn't seem to create the _kerberos._udp and _ldap._tcp in
1347    their defaults DNS setup. Maybe fixed in service packs?</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="domain-member"></a>Chapter 8. Samba as a NT4 or Win2k domain member</h2></div><div><div class="author"><h3 class="author">Jeremy Allison</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jra@samba.org">jra@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Gerald (Jerry) Carter</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jerry@samba.org">jerry@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">16 Apr 2001</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2862413">Joining an NT Domain with Samba 3.0</a></dt><dt><a href="#id2863318">Why is this better than security = server?</a></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2862413"></a>Joining an NT Domain with Samba 3.0</h2></div></div><p><span class="emphasis"><em>Assumptions:</em></span>
1348         </p><pre class="programlisting">
1349                 NetBIOS name: SERV1
1350                 Win2K/NT domain name: DOM
1351                 Domain's PDC NetBIOS name: DOMPDC
1352                 Domain's BDC NetBIOS names: DOMBDC1 and DOMBDC2
1353         </pre><p>
1354         </p><p>First, you must edit your <tt>smb.conf</tt> file to tell Samba it should
1355         now use domain security.</p><p>Change (or add) your <a href="smb.conf.5.html#SECURITY" target="_top">
1356         <i><tt>security =</tt></i></a> line in the [global] section 
1357         of your <tt>smb.conf</tt> to read:</p><p><b>security = domain</b></p><p>Next change the <a href="smb.conf.5.html#WORKGROUP" target="_top"><i><tt>
1358         workgroup =</tt></i></a> line in the [global] section to read: </p><p><b>workgroup = DOM</b></p><p>as this is the name of the domain we are joining. </p><p>You must also have the parameter <a href="smb.conf.5.html#ENCRYPTPASSWORDS" target="_top">
1359         <i><tt>encrypt passwords</tt></i></a> set to <tt>yes
1360         </tt> in order for your users to authenticate to the NT PDC.</p><p>Finally, add (or modify) a <a href="smb.conf.5.html#PASSWORDSERVER" target="_top">
1361         <i><tt>password server =</tt></i></a> line in the [global]
1362         section to read: </p><p><b>password server = DOMPDC DOMBDC1 DOMBDC2</b></p><p>These are the primary and backup domain controllers Samba 
1363         will attempt to contact in order to authenticate users. Samba will 
1364         try to contact each of these servers in order, so you may want to 
1365         rearrange this list in order to spread out the authentication load 
1366         among domain controllers.</p><p>Alternatively, if you want smbd to automatically determine 
1367         the list of Domain controllers to use for authentication, you may 
1368         set this line to be :</p><p><b>password server = *</b></p><p>This method, allows Samba to use exactly the same
1369         mechanism that NT does. This 
1370         method either broadcasts or uses a WINS database in order to
1371         find domain controllers to authenticate against.</p><p>In order to actually join the domain, you must run this
1372         command:</p><p><tt>root# </tt><b><tt>net join -S DOMPDC
1373         -U<i><tt>Administrator%password</tt></i></tt></b></p><p>
1374         If the <b><tt>-S DOMPDC</tt></b> argument is not given then
1375         the domain name will be obtained from smb.conf.
1376         </p><p>as we are joining the domain DOM and the PDC for that domain 
1377         (the only machine that has write access to the domain SAM database) 
1378         is DOMPDC. The <i><tt>Administrator%password</tt></i> is 
1379         the login name and password for an account which has the necessary 
1380         privilege to add machines to the domain.  If this is successful 
1381         you will see the message:</p><p><tt>Joined domain DOM.</tt>
1382         or <tt>Joined 'SERV1' to realm 'MYREALM'</tt>
1383         </p><p>in your terminal window. See the <a href="net.8.html" target="_top">
1384         net(8)</a> man page for more details.</p><p>This process joins the server to the domain
1385         without having to create the machine trust account on the PDC
1386         beforehand.</p><p>This command goes through the machine account password 
1387         change protocol, then writes the new (random) machine account 
1388         password for this Samba server into a file in the same directory 
1389         in which an smbpasswd file would be stored - normally :</p><p><tt>/usr/local/samba/private/secrets.tdb</tt></p><p>This file is created and owned by root and is not 
1390         readable by any other user. It is the key to the domain-level 
1391         security for your system, and should be treated as carefully 
1392         as a shadow password file.</p><p>Finally, restart your Samba daemons and get ready for 
1393         clients to begin using domain security!</p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2863318"></a>Why is this better than security = server?</h2></div></div><p>Currently, domain security in Samba doesn't free you from 
1394         having to create local Unix users to represent the users attaching 
1395         to your server. This means that if domain user <tt>DOM\fred
1396         </tt> attaches to your domain security Samba server, there needs 
1397         to be a local Unix user fred to represent that user in the Unix 
1398         filesystem. This is very similar to the older Samba security mode 
1399         <a href="smb.conf.5.html#SECURITYEQUALSSERVER" target="_top">security = server</a>, 
1400         where Samba would pass through the authentication request to a Windows 
1401         NT server in the same way as a Windows 95 or Windows 98 server would.
1402         </p><p>Please refer to the <a href="winbind.html" target="_top">Winbind 
1403         paper</a> for information on a system to automatically
1404         assign UNIX uids and gids to Windows NT Domain users and groups.
1405         </p><p>The advantage to domain-level security is that the 
1406         authentication in domain-level security is passed down the authenticated 
1407         RPC channel in exactly the same way that an NT server would do it. This 
1408         means Samba servers now participate in domain trust relationships in 
1409         exactly the same way NT servers do (i.e., you can add Samba servers into 
1410         a resource domain and have the authentication passed on from a resource
1411         domain PDC to an account domain PDC).</p><p>In addition, with <b>security = server</b> every Samba 
1412         daemon on a server has to keep a connection open to the 
1413         authenticating server for as long as that daemon lasts. This can drain 
1414         the connection resources on a Microsoft NT server and cause it to run 
1415         out of available connections. With <b>security = domain</b>, 
1416         however, the Samba daemons connect to the PDC/BDC only for as long 
1417         as is necessary to authenticate the user, and then drop the connection, 
1418         thus conserving PDC connection resources.</p><p>And finally, acting in the same manner as an NT server 
1419         authenticating to a PDC means that as part of the authentication 
1420         reply, the Samba server gets the user identification information such 
1421         as the user SID, the list of NT groups the user belongs to, etc. </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> Much of the text of this document 
1422         was first published in the Web magazine <a href="http://www.linuxworld.com" target="_top">      
1423         LinuxWorld</a> as the article <a href="http://www.linuxworld.com/linuxworld/lw-1998-10/lw-10-samba.html" target="_top">Doing 
1424         the NIS/NT Samba</a>.</p></div></div></div></div><div class="part" lang="en"><div class="titlepage"><div><h1 class="title"><a name="optional"></a>Advanced Configuration</h1></div></div><div class="partintro" lang="en"><div><div><h1 class="title"><a name="id2859626"></a>Valuable Nuts and Bolts Information</h1></div></div><p>
1425 Samba has several features that you might want or might not want to use. The chapters in this part each cover specific Samba features.
1426 </p><div class="toc"><p><b>Table of Contents</b></p><dl><dt>9. <a href="#NetworkBrowsing">Samba / MS Windows Network Browsing Guide</a></dt><dd><dl><dt><a href="#id2862996">What is Browsing?</a></dt><dt><a href="#id2863646">Discussion</a></dt><dt><a href="#id2863809">How Browsing Functions</a></dt><dd><dl><dt><a href="#id2863936">Setting up WORKGROUP Browsing</a></dt><dt><a href="#id2864124">Setting up DOMAIN Browsing</a></dt><dt><a href="#browse-force-master">Forcing samba to be the master</a></dt><dt><a href="#id2864390">Making samba the domain master</a></dt><dt><a href="#id2864538">Note about broadcast addresses</a></dt><dt><a href="#id2864555">Multiple interfaces</a></dt><dt><a href="#id2864584">Use of the Remote Announce parameter</a></dt><dt><a href="#id2864695">Use of the Remote Browse Sync parameter</a></dt></dl></dd><dt><a href="#id2864763">WINS - The Windows Internetworking Name Server</a></dt><dd><dl><dt><a href="#id2863586">Setting up a WINS server</a></dt><dt><a href="#id2865218">WINS Replication</a></dt><dt><a href="#id2865243">Static WINS Entries</a></dt></dl></dd><dt><a href="#id2865274">Helpful Hints</a></dt><dd><dl><dt><a href="#id2865287">Windows Networking Protocols</a></dt><dt><a href="#id2865354">Name Resolution Order</a></dt></dl></dd><dt><a href="#id2865470">Technical Overview of browsing</a></dt><dd><dl><dt><a href="#id2865517">Browsing support in samba</a></dt><dt><a href="#id2865624">Problem resolution</a></dt><dt><a href="#id2865703">Browsing across subnets</a></dt></dl></dd></dl></dd><dt>10. <a href="#passdb">User information database</a></dt><dd><dl><dt><a href="#id2866099">Introduction</a></dt><dt><a href="#id2866152">Important Notes About Security</a></dt><dd><dl><dt><a href="#id2866314">Advantages of SMB Encryption</a></dt><dt><a href="#id2866353">Advantages of non-encrypted passwords</a></dt></dl></dd><dt><a href="#id2866388">The smbpasswd Command</a></dt><dt><a href="#id2866568">Plain text</a></dt><dt><a href="#id2866597">TDB</a></dt><dt><a href="#id2866613">LDAP</a></dt><dd><dl><dt><a href="#id2866621">Introduction</a></dt><dt><a href="#id2866721">Encrypted Password Database</a></dt><dt><a href="#id2866860">Supported LDAP Servers</a></dt><dt><a href="#id2866898">Schema and Relationship to the RFC 2307 posixAccount</a></dt><dt><a href="#id2867008">Configuring Samba with LDAP</a></dt><dt><a href="#id2867304">Accounts and Groups management</a></dt><dt><a href="#id2867341">Security and sambaAccount</a></dt><dt><a href="#id2867456">LDAP specials attributes for sambaAccounts</a></dt><dt><a href="#id2867737">Example LDIF Entries for a sambaAccount</a></dt></dl></dd><dt><a href="#id2867793">MySQL</a></dt><dd><dl><dt><a href="#id2867800">Creating the database</a></dt><dt><a href="#id2867854">Configuring</a></dt><dt><a href="#id2867999">Using plaintext passwords or encrypted password</a></dt><dt><a href="#id2868029">Getting non-column data from the table</a></dt></dl></dd><dt><a href="#id2868072">XML</a></dt></dl></dd><dt>11. <a href="#unix-permissions">UNIX Permission Bits and Windows NT Access Control Lists</a></dt><dd><dl><dt><a href="#id2865054">Viewing and changing UNIX permissions using the NT 
1427         security dialogs</a></dt><dt><a href="#id2864937">How to view file security on a Samba share</a></dt><dt><a href="#id2868280">Viewing file ownership</a></dt><dt><a href="#id2868401">Viewing file or directory permissions</a></dt><dd><dl><dt><a href="#id2868484">File Permissions</a></dt><dt><a href="#id2868587">Directory Permissions</a></dt></dl></dd><dt><a href="#id2868637">Modifying file or directory permissions</a></dt><dt><a href="#id2868797">Interaction with the standard Samba create mask 
1428         parameters</a></dt><dt><a href="#id2869113">Interaction with the standard Samba file attribute 
1429         mapping</a></dt></dl></dd><dt>12. <a href="#groupmapping">Configuring Group Mapping</a></dt><dt>13. <a href="#printing">Printing Support</a></dt><dd><dl><dt><a href="#id2869498">Introduction</a></dt><dt><a href="#id2869614">Configuration</a></dt><dd><dl><dt><a href="#id2869661">Creating [print$]</a></dt><dt><a href="#id2869893">Setting Drivers for Existing Printers</a></dt><dt><a href="#id2869992">Support a large number of printers</a></dt><dt><a href="#id2870099">Adding New Printers via the Windows NT APW</a></dt><dt><a href="#id2870231">Samba and Printer Ports</a></dt></dl></dd><dt><a href="#id2869233">The Imprints Toolset</a></dt><dd><dl><dt><a href="#id2869259">What is Imprints?</a></dt><dt><a href="#id2870336">Creating Printer Driver Packages</a></dt><dt><a href="#id2870355">The Imprints server</a></dt><dt><a href="#id2870379">The Installation Client</a></dt></dl></dd><dt><a href="#id2869340">Diagnosis</a></dt><dd><dl><dt><a href="#id2869347">Introduction</a></dt><dt><a href="#id2870552">Debugging printer problems</a></dt><dt><a href="#id2870619">What printers do I have?</a></dt><dt><a href="#id2870661">Setting up printcap and print servers</a></dt><dt><a href="#id2870795">Job sent, no output</a></dt><dt><a href="#id2871344">Job sent, strange output</a></dt><dt><a href="#id2871420">Raw PostScript printed</a></dt><dt><a href="#id2871438">Advanced Printing</a></dt><dt><a href="#id2871464">Real debugging</a></dt></dl></dd></dl></dd><dt>14. <a href="#CUPS-printing">CUPS Printing Support</a></dt><dd><dl><dt><a href="#id2871008">Introduction</a></dt><dt><a href="#id2871067">Configuring smb.conf for CUPS</a></dt><dt><a href="#id2871607">CUPS - RAW Print Through Mode</a></dt><dt><a href="#id2871091">CUPS as a network PostScript RIP</a></dt><dt><a href="#id2872272">Windows Terminal Servers (WTS) as CUPS clients</a></dt><dt><a href="#id2872314">Setting up CUPS for driver download</a></dt><dt><a href="#id2872401">Sources of CUPS drivers / PPDs</a></dt><dd><dl><dt><a href="#id2872566">cupsaddsmb</a></dt></dl></dd><dt><a href="#id2872915">The CUPS Filter Chains</a></dt><dt><a href="#id2873302">CUPS Print Drivers and Devices</a></dt><dd><dl><dt><a href="#id2873339">Further printing steps</a></dt></dl></dd><dt><a href="#id2873758">Limiting the number of pages users can print</a></dt><dt><a href="#id2874367">Advanced Postscript Printing from MS Windows</a></dt><dt><a href="#id2874473">Auto-Deletion of CUPS spool files</a></dt></dl></dd><dt>15. <a href="#winbind">Unified Logons between Windows NT and UNIX using Winbind</a></dt><dd><dl><dt><a href="#id2874714">Abstract</a></dt><dt><a href="#id2874743">Introduction</a></dt><dt><a href="#id2874814">What Winbind Provides</a></dt><dd><dl><dt><a href="#id2872076">Target Uses</a></dt></dl></dd><dt><a href="#id2872107">How Winbind Works</a></dt><dd><dl><dt><a href="#id2872135">Microsoft Remote Procedure Calls</a></dt><dt><a href="#id2872170">Microsoft Active Directory Services</a></dt><dt><a href="#id2872192">Name Service Switch</a></dt><dt><a href="#id2875280">Pluggable Authentication Modules</a></dt><dt><a href="#id2875352">User and Group ID Allocation</a></dt><dt><a href="#id2875387">Result Caching</a></dt></dl></dd><dt><a href="#id2875414">Installation and Configuration</a></dt><dd><dl><dt><a href="#id2875442">Introduction</a></dt><dt><a href="#id2875518">Requirements</a></dt><dt><a href="#id2875611">Testing Things Out</a></dt></dl></dd><dt><a href="#id2877210">Limitations</a></dt><dt><a href="#id2877264">Conclusion</a></dt></dl></dd><dt>16. <a href="#AdvancedNetworkManagement">Advanced Network Manangement</a></dt><dd><dl><dt><a href="#id2875143">Configuring Samba Share Access Controls</a></dt><dd><dl><dt><a href="#id2874905">Share Permissions Management</a></dt></dl></dd><dt><a href="#id2874974">Remote Server Administration</a></dt><dt><a href="#id2875057">Network Logon Script Magic</a></dt><dd><dl><dt><a href="#id2877889">Adding printers without user intervention</a></dt></dl></dd></dl></dd><dt>17. <a href="#PolicyMgmt">System and Account Policies</a></dt><dd><dl><dt><a href="#id2877672">Creating and Managing System Policies</a></dt><dd><dl><dt><a href="#id2877925">Windows 9x/Me Policies</a></dt><dt><a href="#id2878014">Windows NT4 Style Policy Files</a></dt><dt><a href="#id2878140">MS Windows 200x / XP Professional Policies</a></dt></dl></dd><dt><a href="#id2878344">Managing Account/User Policies</a></dt><dd><dl><dt><a href="#id2878457">With Windows NT4/200x</a></dt><dt><a href="#id2878478">With a Samba PDC</a></dt></dl></dd><dt><a href="#id2878502">System Startup and Logon Processing Overview</a></dt></dl></dd><dt>18. <a href="#ProfileMgmt">Desktop Profile Management</a></dt><dd><dl><dt><a href="#id2877599">Roaming Profiles</a></dt><dd><dl><dt><a href="#id2877483">Samba Configuration for Profile Handling</a></dt><dt><a href="#id2879080">Windows Client Profile Configuration Information</a></dt><dt><a href="#id2879695">Sharing Profiles between W9x/Me and NT4/200x/XP workstations</a></dt><dt><a href="#id2879742">Profile Migration from Windows NT4/200x Server to Samba</a></dt></dl></dd><dt><a href="#id2879925">Mandatory profiles</a></dt><dt><a href="#id2879970">Creating/Managing Group Profiles</a></dt><dt><a href="#id2880011">Default Profile for Windows Users</a></dt><dd><dl><dt><a href="#id2880040">MS Windows 9x/Me</a></dt><dt><a href="#id2880129">MS Windows NT4 Workstation</a></dt><dt><a href="#id2880513">MS Windows 200x/XP</a></dt></dl></dd></dl></dd><dt>19. <a href="#InterdomainTrusts">Interdomain Trust Relationships</a></dt><dd><dl><dt><a href="#id2878684">Trust Relationship Background</a></dt><dt><a href="#id2881006">Native MS Windows NT4 Trusts Configuration</a></dt><dd><dl><dt><a href="#id2881019">NT4 as the Trusting Domain (ie. creating the trusted account)</a></dt><dt><a href="#id2881063">NT4 as the Trusted Domain (ie. creating trusted account's password)</a></dt></dl></dd><dt><a href="#id2881087">Configuring Samba NT-style Domain Trusts</a></dt><dd><dl><dt><a href="#id2881114">Samba-3 as the Trusting Domain</a></dt><dt><a href="#id2881210">Samba-3 as the Trusted Domain</a></dt></dl></dd></dl></dd><dt>20. <a href="#pam">PAM Configuration for Centrally Managed Authentication</a></dt><dd><dl><dt><a href="#id2880956">Samba and PAM</a></dt><dd><dl><dt><a href="#id2881738">PAM Configuration in smb.conf</a></dt><dt><a href="#id2881795">Password Synchronisation using pam_smbpass.so</a></dt></dl></dd><dt><a href="#id2882047">Distributed Authentication</a></dt></dl></dd><dt>21. <a href="#VFS">Stackable VFS modules</a></dt><dd><dl><dt><a href="#id2881331">Introduction and configuration</a></dt><dt><a href="#id2882249">Included modules</a></dt><dd><dl><dt><a href="#id2882256">audit</a></dt><dt><a href="#id2882295">extd_audit</a></dt><dt><a href="#id2882416">recycle</a></dt><dt><a href="#id2882554">netatalk</a></dt></dl></dd><dt><a href="#id2882592">VFS modules available elsewhere</a></dt><dd><dl><dt><a href="#id2882614">DatabaseFS</a></dt><dt><a href="#id2882669">vscan</a></dt></dl></dd></dl></dd><dt>22. <a href="#msdfs">Hosting a Microsoft Distributed File System tree on Samba</a></dt><dd><dl><dt><a href="#id2882214">Instructions</a></dt><dd><dl><dt><a href="#id2882961">Notes</a></dt></dl></dd></dl></dd><dt>23. <a href="#integrate-ms-networks">Integrating MS Windows networks with Samba</a></dt><dd><dl><dt><a href="#id2882745">Name Resolution in a pure Unix/Linux world</a></dt><dd><dl><dt><a href="#id2883178">/etc/hosts</a></dt><dt><a href="#id2883316">/etc/resolv.conf</a></dt><dt><a href="#id2883360">/etc/host.conf</a></dt><dt><a href="#id2883403">/etc/nsswitch.conf</a></dt></dl></dd><dt><a href="#id2883498">Name resolution as used within MS Windows networking</a></dt><dd><dl><dt><a href="#id2883030">The NetBIOS Name Cache</a></dt><dt><a href="#id2883069">The LMHOSTS file</a></dt><dt><a href="#id2883112">HOSTS file</a></dt><dt><a href="#id2883144">DNS Lookup</a></dt><dt><a href="#id2883156">WINS Lookup</a></dt></dl></dd></dl></dd><dt>24. <a href="#securing-samba">Securing Samba</a></dt><dd><dl><dt><a href="#id2883603">Introduction</a></dt><dt><a href="#id2883619">Using host based protection</a></dt><dt><a href="#id2884070">Using interface protection</a></dt><dt><a href="#id2884122">Using a firewall</a></dt><dt><a href="#id2884164">Using a IPC$ share deny</a></dt><dt><a href="#id2883724">NTLMv2 Security</a></dt><dt><a href="#id2883760">Upgrading Samba</a></dt></dl></dd><dt>25. <a href="#unicode">Unicode/Charsets</a></dt><dd><dl><dt><a href="#id2884358">What are charsets and unicode?</a></dt><dt><a href="#id2884428">Samba and charsets</a></dt><dt><a href="#id2884517">Conversion from old names</a></dt><dt><a href="#id2884562">Japanese charsets</a></dt></dl></dd><dt>26. <a href="#locking">File and Record Locking</a></dt><dd><dl><dt><a href="#id2884210">Discussion</a></dt><dt><a href="#id2884872">Samba Opportunistic Locking Control</a></dt><dt><a href="#id2884987">MS Windows Opportunistic Locking and Caching Controls</a></dt><dd><dl><dt><a href="#id2885212">Workstation Service Entries</a></dt><dt><a href="#id2885239">Server Service Entries</a></dt></dl></dd><dt><a href="#id2885320">Persistent Data Corruption</a></dt><dt><a href="#id2885350">Additional Reading</a></dt></dl></dd></dl></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="NetworkBrowsing"></a>Chapter 9. Samba / MS Windows Network Browsing Guide</h2></div><div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">July 5, 1998</p></div><div><p class="pubdate">Updated: April 21, 2003</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2862996">What is Browsing?</a></dt><dt><a href="#id2863646">Discussion</a></dt><dt><a href="#id2863809">How Browsing Functions</a></dt><dd><dl><dt><a href="#id2863936">Setting up WORKGROUP Browsing</a></dt><dt><a href="#id2864124">Setting up DOMAIN Browsing</a></dt><dt><a href="#browse-force-master">Forcing samba to be the master</a></dt><dt><a href="#id2864390">Making samba the domain master</a></dt><dt><a href="#id2864538">Note about broadcast addresses</a></dt><dt><a href="#id2864555">Multiple interfaces</a></dt><dt><a href="#id2864584">Use of the Remote Announce parameter</a></dt><dt><a href="#id2864695">Use of the Remote Browse Sync parameter</a></dt></dl></dd><dt><a href="#id2864763">WINS - The Windows Internetworking Name Server</a></dt><dd><dl><dt><a href="#id2863586">Setting up a WINS server</a></dt><dt><a href="#id2865218">WINS Replication</a></dt><dt><a href="#id2865243">Static WINS Entries</a></dt></dl></dd><dt><a href="#id2865274">Helpful Hints</a></dt><dd><dl><dt><a href="#id2865287">Windows Networking Protocols</a></dt><dt><a href="#id2865354">Name Resolution Order</a></dt></dl></dd><dt><a href="#id2865470">Technical Overview of browsing</a></dt><dd><dl><dt><a href="#id2865517">Browsing support in samba</a></dt><dt><a href="#id2865624">Problem resolution</a></dt><dt><a href="#id2865703">Browsing across subnets</a></dt></dl></dd></dl></div><p>
1430 This document contains detailed information as well as a fast track guide to
1431 implementing browsing across subnets and / or across workgroups (or domains).
1432 WINS is the best tool for resolution of NetBIOS names to IP addesses. WINS is
1433 NOT involved in browse list handling except by way of name to address resolution.
1434 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
1435 MS Windows 2000 and later can be configured to operate with NO NetBIOS 
1436 over TCP/IP. Samba-3 and later also supports this mode of operation.
1437 When the use of NetBIOS over TCP/IP has been disabled then the primary
1438 means for resolution of MS Windows machine names is via DNS and Active Directory.
1439 The following information assumes that your site is running NetBIOS over TCP/IP.
1440 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2862996"></a>What is Browsing?</h2></div></div><p>
1441 To most people browsing means that they can see the MS Windows and Samba servers
1442 in the Network Neighborhood, and when the computer icon for a particular server is
1443 clicked, it opens up and shows the shares and printers available on the target server.
1444 </p><p>
1445 What seems so simple is in fact a very complex interaction of different technologies.
1446 The technologies (or methods) employed in making all of this work includes:
1447 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>MS Windows machines register their presence to the network</td></tr><tr><td>Machines announce themselves to other machines on the network</td></tr><tr><td>One or more machine on the network collates the local announcements</td></tr><tr><td>The client machine finds the machine that has the collated list of machines</td></tr><tr><td>The client machine is able to resolve the machine names to IP addresses</td></tr><tr><td>The client machine is able to connect to a target machine</td></tr></table><p>
1448 The samba application that controls/manages browse list management and name resolution is
1449 called <tt>nmbd</tt>. The configuration parameters involved in nmbd's operation are:
1450 </p><pre class="programlisting">
1451         Browsing options:
1452         -----------------
1453                 * os level
1454                   lm announce
1455                   lm interval
1456                 * preferred master
1457                 * local master
1458                 * domain master
1459                   browse list
1460                   enhanced browsing
1461
1462         Name Resolution Method:
1463         -----------------------
1464                 * name resolve order
1465
1466         WINS options:
1467         -------------
1468                   dns proxy
1469                   wins proxy
1470                 * wins server
1471                 * wins support
1472                   wins hook
1473 </pre><p>
1474 WINS Server and WINS Support are mutually exclusive options. Those marked with an '*' are
1475 the only options that commonly MAY need to be modified. Even if not one of these parameters
1476 is set nmbd will still do it's job.
1477 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2863646"></a>Discussion</h2></div></div><p>
1478 Firstly, all MS Windows networking is based on SMB (Server Message
1479 Block) based messaging. SMB messaging may be implemented using NetBIOS or 
1480 without NetBIOS. Samba implements NetBIOS by encapsulating it over TCP/IP.
1481 MS Windows products can do likewise. NetBIOS based networking uses broadcast
1482 messaging to affect browse list management. When running NetBIOS over
1483 TCP/IP this uses UDP based messaging. UDP messages can be broadcast or unicast.
1484 </p><p>
1485 Normally, only unicast UDP messaging can be forwarded by routers. The
1486 <b>remote announce</b>
1487 parameter to smb.conf helps to project browse announcements
1488 to remote network segments via unicast UDP. Similarly, the 
1489 <b>remote browse sync</b> parameter of <tt>smb.conf</tt>
1490 implements browse list collation using unicast UDP.
1491 </p><p>
1492 Secondly, in those networks where Samba is the only SMB server technology
1493 wherever possible <tt>nmbd</tt> should be configured on one (1) machine as the WINS
1494 server. This makes it easy to manage the browsing environment. If each network
1495 segment is configured with it's own Samba WINS server, then the only way to
1496 get cross segment browsing to work is by using the 
1497 <b>remote announce</b> and the <b>remote browse sync</b>
1498 parameters to your <tt>smb.conf</tt> file.
1499 </p><p>
1500 If only one WINS server is used for an entire multi-segment network then
1501 the use of the <b>remote announce</b> and the 
1502 <b>remote browse sync</b> parameters should NOT be necessary.
1503 </p><p>
1504 As of Samba 3 WINS replication is being worked on. The bulk of the code has
1505 been committed, but it still needs maturation.
1506 </p><p>
1507 Right now samba WINS does not support MS-WINS replication. This means that
1508 when setting up Samba as a WINS server there must only be one <tt>nmbd</tt> configured
1509 as a WINS server on the network. Some sites have used multiple Samba WINS
1510 servers for redundancy (one server per subnet) and then used 
1511 <b>remote browse sync</b> and <b>remote announce</b>
1512 to affect browse list collation across all
1513 segments. Note that this means clients will only resolve local names,
1514 and must be configured to use DNS to resolve names on other subnets in
1515 order to resolve the IP addresses of the servers they can see on other
1516 subnets. This setup is not recommended, but is mentioned as a practical
1517 consideration (ie: an 'if all else fails' scenario).
1518 </p><p>
1519 Lastly, take note that browse lists are a collection of unreliable broadcast
1520 messages that are repeated at intervals of not more than 15 minutes. This means
1521 that it will take time to establish a browse list and it can take up to 45
1522 minutes to stabilise, particularly across network segments.
1523 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2863809"></a>How Browsing Functions</h2></div></div><p>
1524 As stated above, MS Windows machines register their NetBIOS names 
1525 (ie: the machine name for each service type in operation) on start 
1526 up. Also, as stated above, the exact method by which this name registration 
1527 takes place is determined by whether or not the MS Windows client/server 
1528 has been given a WINS server address, whether or not LMHOSTS lookup 
1529 is enabled, or if DNS for NetBIOS name resolution is enabled, etc.
1530 </p><p>
1531 In the case where there is no WINS server all name registrations as 
1532 well as name lookups are done by UDP broadcast. This isolates name 
1533 resolution to the local subnet, unless LMHOSTS is used to list all 
1534 names and IP addresses. In such situations Samba provides a means by 
1535 which the samba server name may be forcibly injected into the browse 
1536 list of a remote MS Windows network (using the 
1537 <b>remote announce</b> parameter).
1538 </p><p>
1539 Where a WINS server is used, the MS Windows client will use UDP 
1540 unicast to register with the WINS server. Such packets can be routed 
1541 and thus WINS allows name resolution to function across routed networks.
1542 </p><p>
1543 During the startup process an election will take place to create a 
1544 local master browser if one does not already exist. On each NetBIOS network 
1545 one machine will be elected to function as the domain master browser. This 
1546 domain browsing has nothing to do with MS security domain control. 
1547 Instead, the domain master browser serves the role of contacting each local 
1548 master browser (found by asking WINS or from LMHOSTS) and exchanging browse 
1549 list contents. This way every master browser will eventually obtain a complete 
1550 list of all machines that are on the network. Every 11-15 minutes an election 
1551 is held to determine which machine will be the master browser. By the nature of 
1552 the election criteria used, the machine with the highest uptime, or the 
1553 most senior protocol version, or other criteria, will win the election 
1554 as domain master browser.
1555 </p><p>
1556 Clients wishing to browse the network make use of this list, but also depend 
1557 on the availability of correct name resolution to the respective IP 
1558 address/addresses. 
1559 </p><p>
1560 Any configuration that breaks name resolution and/or browsing intrinsics 
1561 will annoy users because they will have to put up with protracted 
1562 inability to use the network services.
1563 </p><p>
1564 Samba supports a feature that allows forced synchonisation 
1565 of browse lists across routed networks using the <b>remote 
1566 browse sync</b> parameter in the <tt>smb.conf</tt> file. 
1567 This causes Samba to contact the local master browser on a remote network and 
1568 to request browse list synchronisation. This effectively bridges 
1569 two networks that are separated by routers. The two remote 
1570 networks may use either broadcast based name resolution or WINS 
1571 based name resolution, but it should be noted that the <b>remote 
1572 browse sync</b> parameter provides browse list synchronisation - and 
1573 that is distinct from name to address resolution, in other 
1574 words, for cross subnet browsing to function correctly it is 
1575 essential that a name to address resolution mechanism be provided. 
1576 This mechanism could be via DNS, <tt>/etc/hosts</tt>, 
1577 and so on.
1578 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2863936"></a>Setting up WORKGROUP Browsing</h3></div></div><p>
1579 To set up cross subnet browsing on a network containing machines
1580 in up to be in a WORKGROUP, not an NT Domain you need to set up one
1581 Samba server to be the Domain Master Browser (note that this is *NOT*
1582 the same as a Primary Domain Controller, although in an NT Domain the
1583 same machine plays both roles).  The role of a Domain master browser is
1584 to collate the browse lists from local master browsers on all the
1585 subnets that have a machine participating in the workgroup.  Without
1586 one machine configured as a domain master browser each subnet would
1587 be an isolated workgroup, unable to see any machines on any other
1588 subnet.  It is the presense of a domain master browser that makes
1589 cross subnet browsing possible for a workgroup.
1590 </p><p>
1591 In an WORKGROUP environment the domain master browser must be a
1592 Samba server, and there must only be one domain master browser per
1593 workgroup name.  To set up a Samba server as a domain master browser,
1594 set the following option in the [global] section of the <tt>smb.conf</tt> file :
1595 </p><p>
1596 </p><pre class="programlisting">
1597         domain master = yes
1598 </pre><p>
1599 </p><p>
1600 The domain master browser should also preferrably be the local master
1601 browser for its own subnet.  In order to achieve this set the following
1602 options in the [global] section of the <tt>smb.conf</tt> file :
1603 </p><p>
1604 </p><pre class="programlisting">
1605         domain master = yes
1606         local master = yes
1607         preferred master = yes
1608         os level = 65
1609 </pre><p>
1610 </p><p>
1611 The domain master browser may be the same machine as the WINS
1612 server, if you require.
1613 </p><p>
1614 Next, you should ensure that each of the subnets contains a
1615 machine that can act as a local master browser for the
1616 workgroup.  Any MS Windows NT/2K/XP/2003  machine should be
1617 able to do this, as will Windows 9x machines (although these
1618 tend to get rebooted more often, so it's not such a good idea
1619 to use these).  To make a Samba server a local master browser
1620 set the following options in the [global] section of the
1621 <tt>smb.conf</tt> file :
1622 </p><p>
1623 </p><pre class="programlisting">
1624         domain master = no
1625         local master = yes
1626         preferred master = yes
1627         os level = 65
1628 </pre><p>
1629 </p><p>
1630 Do not do this for more than one Samba server on each subnet,
1631 or they will war with each other over which is to be the local
1632 master browser.
1633 </p><p>
1634 The <b>local master</b> parameter allows Samba to act as a
1635 local master browser.  The <b>preferred master</b> causes nmbd
1636 to force a browser election on startup and the <b>os level</b>
1637 parameter sets Samba high enough so that it should win any browser elections.
1638 </p><p>
1639 If you have an NT machine on the subnet that you wish to
1640 be the local master browser then you can disable Samba from
1641 becoming a local master browser by setting the following
1642 options in the <b>[global]</b> section of the 
1643 <tt>smb.conf</tt> file :
1644 </p><p>
1645 </p><pre class="programlisting">
1646         domain master = no
1647         local master = no
1648         preferred master = no
1649         os level = 0
1650 </pre><p>
1651 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2864124"></a>Setting up DOMAIN Browsing</h3></div></div><p>
1652 If you are adding Samba servers to a Windows NT Domain then
1653 you must not set up a Samba server as a domain master browser.
1654 By default, a Windows NT Primary Domain Controller for a Domain
1655 name is also the Domain master browser for that name, and many
1656 things will break if a Samba server registers the Domain master
1657 browser NetBIOS name (<i><tt>DOMAIN</tt></i>&lt;1B&gt;)
1658 with WINS instead of the PDC.
1659 </p><p>
1660 For subnets other than the one containing the Windows NT PDC
1661 you may set up Samba servers as local master browsers as
1662 described.  To make a Samba server a local master browser set 
1663 the following options in the <b>[global]</b> section 
1664 of the <tt>smb.conf</tt> file :
1665 </p><p>
1666 </p><pre class="programlisting">
1667         domain master = no
1668         local master = yes
1669         preferred master = yes
1670         os level = 65
1671 </pre><p>
1672 </p><p>
1673 If you wish to have a Samba server fight the election with machines
1674 on the same subnet you may set the <b>os level</b> parameter
1675 to lower levels.  By doing this you can tune the order of machines that
1676 will become local master browsers if they are running.  For
1677 more details on this see the section <a href="#browse-force-master" title="Forcing samba to be the master">
1678 Forcing samba to be the master browser</a>
1679 below.
1680 </p><p>
1681 If you have Windows NT machines that are members of the domain
1682 on all subnets, and you are sure they will always be running then
1683 you can disable Samba from taking part in browser elections and
1684 ever becoming a local master browser by setting following options 
1685 in the <b>[global]</b> section of the <tt>smb.conf</tt>
1686 file :
1687 </p><p>
1688 </p><pre class="programlisting">
1689         domain master = no
1690         local master = no
1691         preferred master = no
1692         os level = 0
1693 </pre><p>
1694 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="browse-force-master"></a>Forcing samba to be the master</h3></div></div><p>
1695 Who becomes the <b>master browser</b> is determined by an election
1696 process using broadcasts.  Each election packet contains a number of parameters
1697 which determine what precedence (bias) a host should have in the
1698 election.  By default Samba uses a very low precedence and thus loses
1699 elections to just about anyone else.
1700 </p><p>
1701 If you want Samba to win elections then just set the <b>os level</b> global
1702 option in <tt>smb.conf</tt> to a higher number.  It defaults to 0.  Using 34
1703 would make it win all elections over every other system (except other
1704 samba systems!)
1705 </p><p>
1706 A <b>os level</b> of 2 would make it beat WfWg and Win95, but not MS Windows
1707 NT/2K Server.  A MS Windows NT/2K Server domain controller uses level 32.
1708 </p><p>The maximum os level is 255</p><p>
1709 If you want samba to force an election on startup, then set the
1710 <b>preferred master</b> global option in <tt>smb.conf</tt> to &quot;yes&quot;.  Samba will
1711 then have a slight advantage over other potential master browsers
1712 that are not preferred master browsers.  Use this parameter with
1713 care, as if you have two hosts (whether they are windows 95 or NT or
1714 samba) on the same local subnet both set with <b>preferred master</b> to
1715 &quot;yes&quot;, then periodically and continually they will force an election
1716 in order to become the local master browser.
1717 </p><p>
1718 If you want samba to be a <b>domain master browser</b>, then it is
1719 recommended that you also set <b>preferred master</b> to &quot;yes&quot;, because
1720 samba will not become a domain master browser for the whole of your
1721 LAN or WAN if it is not also a local master browser on its own
1722 broadcast isolated subnet.
1723 </p><p>
1724 It is possible to configure two samba servers to attempt to become
1725 the domain master browser for a domain.  The first server that comes
1726 up will be the domain master browser.  All other samba servers will
1727 attempt to become the domain master browser every 5 minutes.  They
1728 will find that another samba server is already the domain master
1729 browser and will fail.  This provides automatic redundancy, should
1730 the current domain master browser fail.
1731 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2864390"></a>Making samba the domain master</h3></div></div><p>
1732 The domain master is responsible for collating the browse lists of
1733 multiple subnets so that browsing can occur between subnets.  You can
1734 make samba act as the domain master by setting <b>domain master = yes</b>
1735 in <tt>smb.conf</tt>.  By default it will not be a domain master.
1736 </p><p>
1737 Note that you should NOT set Samba to be the domain master for a
1738 workgroup that has the same name as an NT Domain.
1739 </p><p>
1740 When samba is the domain master and the master browser it will listen
1741 for master announcements (made roughly every twelve minutes) from local
1742 master browsers on other subnets and then contact them to synchronise
1743 browse lists.
1744 </p><p>
1745 If you want samba to be the domain master then I suggest you also set
1746 the <b>os level</b> high enough to make sure it wins elections, and set
1747 <b>preferred master</b> to &quot;yes&quot;, to get samba to force an election on
1748 startup.
1749 </p><p>
1750 Note that all your servers (including samba) and clients should be
1751 using a WINS server to resolve NetBIOS names.  If your clients are only
1752 using broadcasting to resolve NetBIOS names, then two things will occur:
1753 </p><div class="orderedlist"><ol type="1"><li><p>
1754         your local master browsers will be unable to find a domain master
1755         browser, as it will only be looking on the local subnet.
1756         </p></li><li><p>
1757         if a client happens to get hold of a domain-wide browse list, and
1758         a user attempts to access a host in that list, it will be unable to
1759         resolve the NetBIOS name of that host.
1760         </p></li></ol></div><p>
1761 If, however, both samba and your clients are using a WINS server, then:
1762 </p><div class="orderedlist"><ol type="1"><li><p>
1763         your local master browsers will contact the WINS server and, as long as
1764         samba has registered that it is a domain master browser with the WINS
1765         server, your local master browser will receive samba's ip address
1766         as its domain master browser.
1767         </p></li><li><p>
1768         when a client receives a domain-wide browse list, and a user attempts
1769         to access a host in that list, it will contact the WINS server to
1770         resolve the NetBIOS name of that host.  as long as that host has
1771         registered its NetBIOS name with the same WINS server, the user will
1772         be able to see that host.  
1773         </p></li></ol></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2864538"></a>Note about broadcast addresses</h3></div></div><p>
1774 If your network uses a &quot;0&quot; based broadcast address (for example if it
1775 ends in a 0) then you will strike problems.  Windows for Workgroups
1776 does not seem to support a 0's broadcast and you will probably find
1777 that browsing and name lookups won't work.
1778 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2864555"></a>Multiple interfaces</h3></div></div><p>
1779 Samba now supports machines with multiple network interfaces.  If you
1780 have multiple interfaces then you will need to use the <b>interfaces</b>
1781 option in <tt>smb.conf</tt> to configure them. 
1782 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2864584"></a>Use of the <b>Remote Announce</b> parameter</h3></div></div><p>
1783 The <b>remote announce</b> parameter of 
1784 <tt>smb.conf</tt> can be used to forcibly ensure
1785 that all the NetBIOS names on a network get announced to a remote network.
1786 The syntax of the <b>remote announce</b> parameter is:
1787 </p><pre class="programlisting">
1788         remote announce = a.b.c.d [e.f.g.h] ...
1789 </pre><p>
1790 _or_
1791 </p><pre class="programlisting">
1792         remote announce = a.b.c.d/WORKGROUP [e.f.g.h/WORKGROUP] ...
1793 </pre><p>
1794
1795 where:
1796 </p><div class="variablelist"><dl><dt><span class="term"><i><tt>a.b.c.d</tt></i> and 
1797 <i><tt>e.f.g.h</tt></i></span></dt><dd><p>is either the LMB (Local Master Browser) IP address
1798 or the broadcst address of the remote network.
1799 ie: the LMB is at 192.168.1.10, or the address
1800 could be given as 192.168.1.255 where the netmask
1801 is assumed to be 24 bits (255.255.255.0).
1802 When the remote announcement is made to the broadcast
1803 address of the remote network every host will receive
1804 our announcements. This is noisy and therefore
1805 undesirable but may be necessary if we do NOT know
1806 the IP address of the remote LMB.</p></dd><dt><span class="term"><i><tt>WORKGROUP</tt></i></span></dt><dd><p>is optional and can be either our own workgroup
1807 or that of the remote network. If you use the
1808 workgroup name of the remote network then our
1809 NetBIOS machine names will end up looking like
1810 they belong to that workgroup, this may cause
1811 name resolution problems and should be avoided.
1812 </p></dd></dl></div><p>
1813 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2864695"></a>Use of the <b>Remote Browse Sync</b> parameter</h3></div></div><p>
1814 The <b>remote browse sync</b> parameter of 
1815 <tt>smb.conf</tt> is used to announce to
1816 another LMB that it must synchronise it's NetBIOS name list with our
1817 Samba LMB. It works ONLY if the Samba server that has this option is
1818 simultaneously the LMB on it's network segment.
1819 </p><p>
1820 The syntax of the <b>remote browse sync</b> parameter is:
1821
1822 </p><pre class="programlisting">
1823 remote browse sync = <i><tt>a.b.c.d</tt></i>
1824 </pre><p>
1825
1826 where <i><tt>a.b.c.d</tt></i> is either the IP address of the
1827 remote LMB or else is the network broadcast address of the remote segment.
1828 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2864763"></a>WINS - The Windows Internetworking Name Server</h2></div></div><p>
1829 Use of WINS (either Samba WINS _or_ MS Windows NT Server WINS) is highly
1830 recommended. Every NetBIOS machine registers it's name together with a
1831 name_type value for each of of several types of service it has available.
1832 eg: It registers it's name directly as a unique (the type 0x03) name.
1833 It also registers it's name if it is running the lanmanager compatible
1834 server service (used to make shares and printers available to other users)
1835 by registering the server (the type 0x20) name.
1836 </p><p>
1837 All NetBIOS names are up to 15 characters in length. The name_type variable
1838 is added to the end of the name - thus creating a 16 character name. Any
1839 name that is shorter than 15 characters is padded with spaces to the 15th
1840 character. ie: All NetBIOS names are 16 characters long (including the
1841 name_type information).
1842 </p><p>
1843 WINS can store these 16 character names as they get registered. A client
1844 that wants to log onto the network can ask the WINS server for a list
1845 of all names that have registered the NetLogon service name_type. This saves
1846 broadcast traffic and greatly expedites logon processing. Since broadcast
1847 name resolution can not be used across network segments this type of
1848 information can only be provided via WINS _or_ via statically configured
1849 <tt>lmhosts</tt> files that must reside on all clients in the
1850 absence of WINS.
1851 </p><p>
1852 WINS also serves the purpose of forcing browse list synchronisation by all
1853 LMB's. LMB's must synchronise their browse list with the DMB (domain master
1854 browser) and WINS helps the LMB to identify it's DMB. By definition this
1855 will work only within a single workgroup. Note that the domain master browser
1856 has NOTHING to do with what is referred to as an MS Windows NT Domain. The
1857 later is a reference to a security environment while the DMB refers to the
1858 master controller for browse list information only.
1859 </p><p>
1860 Use of WINS will work correctly only if EVERY client TCP/IP protocol stack
1861 has been configured to use the WINS server/s. Any client that has not been
1862 configured to use the WINS server will continue to use only broadcast based
1863 name registration so that WINS may NEVER get to know about it. In any case,
1864 machines that have not registered with a WINS server will fail name to address
1865 lookup attempts by other clients and will therefore cause workstation access
1866 errors.
1867 </p><p>
1868 To configure Samba as a WINS server just add 
1869 <b>wins support = yes</b> to the <tt>smb.conf</tt>
1870 file [globals] section.
1871 </p><p>
1872 To configure Samba to register with a WINS server just add
1873 &quot;wins server = a.b.c.d&quot; to your smb.conf file [globals] section.
1874 </p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Important</h3><p>
1875 Never use both <b>wins support = yes</b> together
1876 with <b>wins server = a.b.c.d</b>
1877 particularly not using it's own IP address.
1878 Specifying both will cause nmbd to refuse to start!
1879 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2863586"></a>Setting up a WINS server</h3></div></div><p>
1880 Either a Samba machine or a Windows NT Server machine may be set up
1881 as a WINS server.  To set a Samba machine to be a WINS server you must
1882 add the following option to the <tt>smb.conf</tt> file on the selected machine :
1883 in the [globals] section add the line 
1884 </p><p>
1885 </p><pre class="programlisting">
1886         wins support = yes
1887 </pre><p>
1888 </p><p>
1889 Versions of Samba prior to 1.9.17 had this parameter default to
1890 yes.  If you have any older versions of Samba on your network it is
1891 strongly suggested you upgrade to a recent version, or at the very
1892 least set the parameter to 'no' on all these machines.
1893 </p><p>
1894 Machines with <b>wins support = yes</b> will keep a list of 
1895 all NetBIOS names registered with them, acting as a DNS for NetBIOS names.
1896 </p><p>
1897 You should set up only ONE wins server.  Do NOT set the
1898 <b>wins support = yes</b> option on more than one Samba 
1899 server.
1900 </p><p>
1901 To set up a Windows NT Server as a WINS server you need to set up
1902 the WINS service - see your NT documentation for details.  Note that
1903 Windows NT WINS Servers can replicate to each other, allowing more
1904 than one to be set up in a complex subnet environment.  As Microsoft
1905 refuse to document these replication protocols Samba cannot currently
1906 participate in these replications.  It is possible in the future that
1907 a Samba-&gt;Samba WINS replication protocol may be defined, in which
1908 case more than one Samba machine could be set up as a WINS server
1909 but currently only one Samba server should have the 
1910 <b>wins support = yes</b> parameter set.
1911 </p><p>
1912 After the WINS server has been configured you must ensure that all
1913 machines participating on the network are configured with the address
1914 of this WINS server.  If your WINS server is a Samba machine, fill in
1915 the Samba machine IP address in the &quot;Primary WINS Server&quot; field of
1916 the &quot;Control Panel-&gt;Network-&gt;Protocols-&gt;TCP-&gt;WINS Server&quot; dialogs
1917 in Windows 95 or Windows NT.  To tell a Samba server the IP address
1918 of the WINS server add the following line to the [global] section of
1919 all <tt>smb.conf</tt> files :
1920 </p><p>
1921 </p><pre class="programlisting">
1922         wins server = &lt;name or IP address&gt;
1923 </pre><p>
1924 </p><p>
1925 where &lt;name or IP address&gt; is either the DNS name of the WINS server
1926 machine or its IP address.
1927 </p><p>
1928 Note that this line MUST NOT BE SET in the <tt>smb.conf</tt> file of the Samba
1929 server acting as the WINS server itself.  If you set both the
1930 <b>wins support = yes</b> option and the 
1931 <b>wins server = &lt;name&gt;</b> option then
1932 nmbd will fail to start.
1933 </p><p>
1934 There are two possible scenarios for setting up cross subnet browsing.
1935 The first details setting up cross subnet browsing on a network containing
1936 Windows 95, Samba and Windows NT machines that are not configured as
1937 part of a Windows NT Domain.  The second details setting up cross subnet
1938 browsing on networks that contain NT Domains.
1939 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2865218"></a>WINS Replication</h3></div></div><p>
1940 Samba-3 permits WINS replication through the use of the <tt>wrepld</tt> utility.
1941 This tool is not currently capable of being used as it is still in active development.
1942 As soon as this tool becomes moderately functional we will prepare man pages and enhance this
1943 section of the documentation to provide usage and technical details.
1944 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2865243"></a>Static WINS Entries</h3></div></div><p>
1945 New to Samba-3 is a tool called <tt>winsedit</tt> that may be used to add
1946 static WINS entries to the WINS database. This tool can be used also to modify entries
1947 existing in the WINS database.
1948 </p><p>
1949 The development of the winsedit tool was made necessary due to the migration
1950 of the older style wins.dat file into a new tdb binary backend data store.
1951 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2865274"></a>Helpful Hints</h2></div></div><p>
1952 The following hints should be carefully considered as they are stumbling points
1953 for many new network administrators.
1954 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2865287"></a>Windows Networking Protocols</h3></div></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>
1955 Do NOT use more than one (1) protocol on MS Windows machines
1956 </p></div><p>
1957 A very common cause of browsing problems results from installing more than
1958 one protocol on an MS Windows machine.
1959 </p><p>
1960 Every NetBIOS machine takes part in a process of electing the LMB (and DMB)
1961 every 15 minutes. A set of election criteria is used to determine the order
1962 of precidence for winning this election process. A machine running Samba or
1963 Windows NT will be biased so that the most suitable machine will predictably
1964 win and thus retain it's role.
1965 </p><p>
1966 The election process is &quot;fought out&quot; so to speak over every NetBIOS network
1967 interface. In the case of a Windows 9x machine that has both TCP/IP and IPX
1968 installed and has NetBIOS enabled over both protocols the election will be
1969 decided over both protocols. As often happens, if the Windows 9x machine is
1970 the only one with both protocols then the LMB may be won on the NetBIOS
1971 interface over the IPX protocol. Samba will then lose the LMB role as Windows
1972 9x will insist it knows who the LMB is. Samba will then cease to function
1973 as an LMB and thus browse list operation on all TCP/IP only machines will
1974 fail.
1975 </p><p><span class="emphasis"><em>
1976 Windows 95, 98, 98se, Me are referred to generically as Windows 9x.
1977 The Windows NT4, 2000, XP and 2003 use common protocols. These are roughly
1978 referred to as the WinNT family, but it should be recognised that 2000 and
1979 XP/2003 introduce new protocol extensions that cause them to behave 
1980 differently from MS Windows NT4. Generally, where a server does NOT support
1981 the newer or extended protocol, these will fall back to the NT4 protocols.
1982 </em></span></p><p>
1983 The safest rule of all to follow it this - USE ONLY ONE PROTOCOL!
1984 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2865354"></a>Name Resolution Order</h3></div></div><p>
1985 Resolution of NetBIOS names to IP addresses can take place using a number
1986 of methods. The only ones that can provide NetBIOS name_type information
1987 are:</p><table class="simplelist" border="0" summary="Simple list"><tr><td>WINS: the best tool!</td></tr><tr><td>LMHOSTS: is static and hard to maintain.</td></tr><tr><td>Broadcast: uses UDP and can not resolve names across remote segments.</td></tr></table><p>
1988 Alternative means of name resolution includes:</p><table class="simplelist" border="0" summary="Simple list"><tr><td>/etc/hosts: is static, hard to maintain, and lacks name_type info</td></tr><tr><td>DNS: is a good choice but lacks essential name_type info.</td></tr></table><p>
1989 Many sites want to restrict DNS lookups and want to avoid broadcast name
1990 resolution traffic. The &quot;name resolve order&quot; parameter is of great help here.
1991 The syntax of the &quot;name resolve order&quot; parameter is:
1992 </p><pre class="programlisting">
1993 name resolve order = wins lmhosts bcast host
1994 </pre><p>
1995 _or_
1996 </p><pre class="programlisting">
1997 name resolve order = wins lmhosts       (eliminates bcast and host)
1998 </pre><p>
1999 The default is:
2000 </p><pre class="programlisting">
2001 name  resolve order = host lmhost wins bcast
2002 </pre><p>
2003 where &quot;host&quot; refers the the native methods used by the Unix system
2004 to implement the gethostbyname() function call. This is normally
2005 controlled by <tt>/etc/host.conf</tt>, <tt>/etc/nsswitch.conf</tt> and <tt>/etc/resolv.conf</tt>.
2006 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2865470"></a>Technical Overview of browsing</h2></div></div><p>
2007 SMB networking provides a mechanism by which clients can access a list
2008 of machines in a network, a so-called <b>browse list</b>.  This list
2009 contains machines that are ready to offer file and/or print services
2010 to other machines within the network. Thus it does not include
2011 machines which aren't currently able to do server tasks.  The browse
2012 list is heavily used by all SMB clients.  Configuration of SMB
2013 browsing has been problematic for some Samba users, hence this
2014 document.
2015 </p><p>
2016 MS Windows 2000 and later, as with Samba 3 and later, can be
2017 configured to not use NetBIOS over TCP/IP. When configured this way
2018 it is imperative that name resolution (using DNS/LDAP/ADS) be correctly
2019 configured and operative. Browsing will NOT work if name resolution
2020 from SMB machine names to IP addresses does not function correctly.
2021 </p><p>
2022 Where NetBIOS over TCP/IP is enabled use of a WINS server is highly
2023 recommended to aid the resolution of NetBIOS (SMB) names to IP addresses.
2024 WINS allows remote segment clients to obtain NetBIOS name_type information
2025 that can NOT be provided by any other means of name resolution.
2026 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2865517"></a>Browsing support in samba</h3></div></div><p>
2027 Samba facilitates browsing.  The browsing is supported by nmbd
2028 and is also controlled by options in the <tt>smb.conf</tt> file.
2029 Samba can act as a local browse master for a workgroup and the ability
2030 to support domain logons and scripts is now available.
2031 </p><p>
2032 Samba can also act as a domain master browser for a workgroup.  This
2033 means that it will collate lists from local browse masters into a
2034 wide area network server list.  In order for browse clients to
2035 resolve the names they may find in this list, it is recommended that
2036 both samba and your clients use a WINS server.
2037 </p><p>
2038 Note that you should NOT set Samba to be the domain master for a
2039 workgroup that has the same name as an NT Domain: on each wide area
2040 network, you must only ever have one domain master browser per workgroup,
2041 regardless of whether it is NT, Samba or any other type of domain master
2042 that is providing this service.
2043 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
2044 Nmbd can be configured as a WINS server, but it is not
2045 necessary to specifically use samba as your WINS server.  MS Windows
2046 NT4, Server or Advanced Server 2000 or 2003 can be configured as
2047 your WINS server.  In a mixed NT/2000/2003 server and samba environment on
2048 a Wide Area Network, it is recommended that you use the Microsoft
2049 WINS server capabilities.  In a samba-only environment, it is
2050 recommended that you use one and only one Samba server as your WINS server.
2051 </p></div><p>
2052 To get browsing to work you need to run nmbd as usual, but will need
2053 to use the <b>workgroup</b> option in <tt>smb.conf</tt>
2054 to control what workgroup Samba becomes a part of.
2055 </p><p>
2056 Samba also has a useful option for a Samba server to offer itself for
2057 browsing on another subnet.  It is recommended that this option is only
2058 used for 'unusual' purposes: announcements over the internet, for
2059 example.  See <b>remote announce</b> in the 
2060 <tt>smb.conf</tt> man page.  
2061 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2865624"></a>Problem resolution</h3></div></div><p>
2062 If something doesn't work then hopefully the log.nmb file will help
2063 you track down the problem.  Try a debug level of 2 or 3 for finding
2064 problems. Also note that the current browse list usually gets stored
2065 in text form in a file called <tt>browse.dat</tt>.
2066 </p><p>
2067 Note that if it doesn't work for you, then you should still be able to
2068 type the server name as <tt>\\SERVER</tt> in filemanager then
2069 hit enter and filemanager should display the list of available shares.
2070 </p><p>
2071 Some people find browsing fails because they don't have the global
2072 <b>guest account</b> set to a valid account.  Remember that the
2073 IPC$ connection that lists the shares is done as guest, and thus you must
2074 have a valid guest account.
2075 </p><p><span class="emphasis"><em>
2076 MS Windows 2000 and upwards (as with Samba) can be configured to disallow
2077 anonymous (ie: Guest account) access to the IPC$ share. In that case, the
2078 MS Windows 2000/XP/2003 machine acting as an SMB/CIFS client will use the
2079 name of the currently logged in user to query the IPC$ share. MS Windows
2080 9X clients are not able to do this and thus will NOT be able to browse
2081 server resources.
2082 </em></span></p><p>
2083 The other big problem people have is that their broadcast address,
2084 netmask or IP address is wrong (specified with the &quot;interfaces&quot; option
2085 in <tt>smb.conf</tt>)
2086 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2865703"></a>Browsing across subnets</h3></div></div><p>
2087 Since the release of Samba 1.9.17(alpha1) Samba has been
2088 updated to enable it to support the replication of browse lists
2089 across subnet boundaries.  New code and options have been added to
2090 achieve this.  This section describes how to set this feature up
2091 in different settings.
2092 </p><p>
2093 To see browse lists that span TCP/IP subnets (ie.  networks separated
2094 by routers that don't pass broadcast traffic) you must set up at least
2095 one WINS server.  The WINS server acts as a DNS for NetBIOS names, allowing
2096 NetBIOS name to IP address translation to be done by doing a direct
2097 query of the WINS server.  This is done via a directed UDP packet on
2098 port 137 to the WINS server machine.  The reason for a WINS server is
2099 that by default, all NetBIOS name to IP address translation is done
2100 by broadcasts from the querying machine.  This means that machines
2101 on one subnet will not be able to resolve the names of machines on
2102 another subnet without using a WINS server.
2103 </p><p>
2104 Remember, for browsing across subnets to work correctly, all machines,
2105 be they Windows 95, Windows NT, or Samba servers must have the IP address
2106 of a WINS server given to them by a DHCP server, or by manual configuration 
2107 (for Win95 and WinNT, this is in the TCP/IP Properties, under Network 
2108 settings) for Samba this is in the <tt>smb.conf</tt> file.
2109 </p><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2865754"></a>How does cross subnet browsing work ?</h4></div></div><p>
2110 Cross subnet browsing is a complicated dance, containing multiple
2111 moving parts.  It has taken Microsoft several years to get the code
2112 that achieves this correct, and Samba lags behind in some areas.
2113 Samba is capable of cross subnet browsing when configured correctly.
2114 </p><p>
2115 Consider a network set up as follows :
2116 </p><p>
2117 </p><pre class="programlisting">
2118                                    (DMB)
2119              N1_A      N1_B        N1_C       N1_D        N1_E
2120               |          |           |          |           |
2121           -------------------------------------------------------
2122             |          subnet 1                       |
2123           +---+                                      +---+
2124           |R1 | Router 1                  Router 2   |R2 |
2125           +---+                                      +---+
2126             |                                          |
2127             |  subnet 2              subnet 3          |
2128   --------------------------       ------------------------------------
2129   |     |     |      |               |        |         |           |
2130  N2_A  N2_B  N2_C   N2_D           N3_A     N3_B      N3_C        N3_D 
2131                     (WINS)
2132 </pre><p>
2133 </p><p>
2134 Consisting of 3 subnets (1, 2, 3) connected by two routers
2135 (R1, R2) - these do not pass broadcasts.  Subnet 1 has 5 machines
2136 on it, subnet 2 has 4 machines, subnet 3 has 4 machines.  Assume
2137 for the moment that all these machines are configured to be in the
2138 same workgroup (for simplicities sake).  Machine N1_C on subnet 1
2139 is configured as Domain Master Browser (ie.  it will collate the
2140 browse lists for the workgroup).  Machine N2_D is configured as
2141 WINS server and all the other machines are configured to register
2142 their NetBIOS names with it.
2143 </p><p>
2144 As all these machines are booted up, elections for master browsers
2145 will take place on each of the three subnets.  Assume that machine
2146 N1_C wins on subnet 1, N2_B wins on subnet 2, and N3_D wins on
2147 subnet 3 - these machines are known as local master browsers for
2148 their particular subnet.  N1_C has an advantage in winning as the
2149 local master browser on subnet 1 as it is set up as Domain Master
2150 Browser.
2151 </p><p>
2152 On each of the three networks, machines that are configured to 
2153 offer sharing services will broadcast that they are offering
2154 these services.  The local master browser on each subnet will
2155 receive these broadcasts and keep a record of the fact that
2156 the machine is offering a service.  This list of records is
2157 the basis of the browse list.  For this case, assume that
2158 all the machines are configured to offer services so all machines
2159 will be on the browse list.
2160 </p><p>
2161 For each network, the local master browser on that network is
2162 considered 'authoritative' for all the names it receives via
2163 local broadcast.  This is because a machine seen by the local
2164 master browser via a local broadcast must be on the same 
2165 network as the local master browser and thus is a 'trusted'
2166 and 'verifiable' resource.  Machines on other networks that
2167 the local master browsers learn about when collating their
2168 browse lists have not been directly seen - these records are
2169 called 'non-authoritative'.
2170 </p><p>
2171 At this point the browse lists look as follows (these are 
2172 the machines you would see in your network neighborhood if
2173 you looked in it on a particular network right now).
2174 </p><p>
2175 </p><pre class="programlisting">
2176 Subnet           Browse Master   List
2177 ------           -------------   ----
2178 Subnet1          N1_C            N1_A, N1_B, N1_C, N1_D, N1_E
2179
2180 Subnet2          N2_B            N2_A, N2_B, N2_C, N2_D
2181
2182 Subnet3          N3_D            N3_A, N3_B, N3_C, N3_D
2183 </pre><p>
2184 </p><p>
2185 Note that at this point all the subnets are separate, no
2186 machine is seen across any of the subnets.
2187 </p><p>
2188 Now examine subnet 2.  As soon as N2_B has become the local
2189 master browser it looks for a Domain master browser to synchronize
2190 its browse list with.  It does this by querying the WINS server
2191 (N2_D) for the IP address associated with the NetBIOS name 
2192 WORKGROUP&lt;1B&gt;.  This name was registerd by the Domain master
2193 browser (N1_C) with the WINS server as soon as it was booted.
2194 </p><p>
2195 Once N2_B knows the address of the Domain master browser it
2196 tells it that is the local master browser for subnet 2 by
2197 sending a MasterAnnouncement packet as a UDP port 138 packet.
2198 It then synchronizes with it by doing a NetServerEnum2 call.  This
2199 tells the Domain Master Browser to send it all the server
2200 names it knows about.  Once the domain master browser receives
2201 the MasterAnnouncement packet it schedules a synchronization
2202 request to the sender of that packet.  After both synchronizations
2203 are done the browse lists look like :
2204 </p><p>
2205 </p><pre class="programlisting">
2206 Subnet           Browse Master   List
2207 ------           -------------   ----
2208 Subnet1          N1_C            N1_A, N1_B, N1_C, N1_D, N1_E, 
2209                                  N2_A(*), N2_B(*), N2_C(*), N2_D(*)
2210
2211 Subnet2          N2_B            N2_A, N2_B, N2_C, N2_D
2212                                  N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*)
2213
2214 Subnet3          N3_D            N3_A, N3_B, N3_C, N3_D
2215
2216 Servers with a (*) after them are non-authoritative names.
2217 </pre><p>
2218 </p><p>
2219 At this point users looking in their network neighborhood on
2220 subnets 1 or 2 will see all the servers on both, users on
2221 subnet 3 will still only see the servers on their own subnet.
2222 </p><p>
2223 The same sequence of events that occured for N2_B now occurs
2224 for the local master browser on subnet 3 (N3_D).  When it
2225 synchronizes browse lists with the domain master browser (N1_A)
2226 it gets both the server entries on subnet 1, and those on
2227 subnet 2.  After N3_D has synchronized with N1_C and vica-versa
2228 the browse lists look like.
2229 </p><p>
2230 </p><pre class="programlisting">
2231 Subnet           Browse Master   List
2232 ------           -------------   ----
2233 Subnet1          N1_C            N1_A, N1_B, N1_C, N1_D, N1_E, 
2234                                  N2_A(*), N2_B(*), N2_C(*), N2_D(*),
2235                                  N3_A(*), N3_B(*), N3_C(*), N3_D(*)
2236
2237 Subnet2          N2_B            N2_A, N2_B, N2_C, N2_D
2238                                  N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*)
2239
2240 Subnet3          N3_D            N3_A, N3_B, N3_C, N3_D
2241                                  N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*),
2242                                  N2_A(*), N2_B(*), N2_C(*), N2_D(*)
2243
2244 Servers with a (*) after them are non-authoritative names.
2245 </pre><p>
2246 </p><p>
2247 At this point users looking in their network neighborhood on
2248 subnets 1 or 3 will see all the servers on all sunbets, users on
2249 subnet 2 will still only see the servers on subnets 1 and 2, but not 3.
2250 </p><p>
2251 Finally, the local master browser for subnet 2 (N2_B) will sync again
2252 with the domain master browser (N1_C) and will recieve the missing
2253 server entries.  Finally - and as a steady state (if no machines
2254 are removed or shut off) the browse lists will look like :
2255 </p><p>
2256 </p><pre class="programlisting">
2257 Subnet           Browse Master   List
2258 ------           -------------   ----
2259 Subnet1          N1_C            N1_A, N1_B, N1_C, N1_D, N1_E, 
2260                                  N2_A(*), N2_B(*), N2_C(*), N2_D(*),
2261                                  N3_A(*), N3_B(*), N3_C(*), N3_D(*)
2262
2263 Subnet2          N2_B            N2_A, N2_B, N2_C, N2_D
2264                                  N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*)
2265                                  N3_A(*), N3_B(*), N3_C(*), N3_D(*)
2266
2267 Subnet3          N3_D            N3_A, N3_B, N3_C, N3_D
2268                                  N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*),
2269                                  N2_A(*), N2_B(*), N2_C(*), N2_D(*)
2270         
2271 Servers with a (*) after them are non-authoritative names.
2272 </pre><p>
2273 </p><p>
2274 Synchronizations between the domain master browser and local
2275 master browsers will continue to occur, but this should be a
2276 steady state situation.
2277 </p><p>
2278 If either router R1 or R2 fails the following will occur:
2279 </p><div class="orderedlist"><ol type="1"><li><p>
2280         Names of computers on each side of the inaccessible network fragments
2281         will be maintained for as long as 36 minutes, in the network neighbourhood
2282         lists.
2283         </p></li><li><p>
2284         Attempts to connect to these inaccessible computers will fail, but the
2285         names will not be removed from the network neighbourhood lists.
2286         </p></li><li><p>
2287         If one of the fragments is cut off from the WINS server, it will only
2288         be able to access servers on its local subnet, by using subnet-isolated
2289         broadcast NetBIOS name resolution.  The effects are similar to that of
2290         losing access to a DNS server.
2291         </p></li></ol></div></div></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="passdb"></a>Chapter 10. User information database</h2></div><div><div class="author"><h3 class="author">Jelmer R. Vernooij</h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Gerald (Jerry) Carter</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jerry@samba.org">jerry@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Jeremy Allison</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jra@samba.org">jra@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Olivier (lem) Lemaire</h3><div class="affiliation"><span class="orgname">IDEALX<br></span><div class="address"><p><tt>&lt;<a href="mailto:olem@IDEALX.org">olem@IDEALX.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">February 2003</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2866099">Introduction</a></dt><dt><a href="#id2866152">Important Notes About Security</a></dt><dd><dl><dt><a href="#id2866314">Advantages of SMB Encryption</a></dt><dt><a href="#id2866353">Advantages of non-encrypted passwords</a></dt></dl></dd><dt><a href="#id2866388">The smbpasswd Command</a></dt><dt><a href="#id2866568">Plain text</a></dt><dt><a href="#id2866597">TDB</a></dt><dt><a href="#id2866613">LDAP</a></dt><dd><dl><dt><a href="#id2866621">Introduction</a></dt><dt><a href="#id2866721">Encrypted Password Database</a></dt><dt><a href="#id2866860">Supported LDAP Servers</a></dt><dt><a href="#id2866898">Schema and Relationship to the RFC 2307 posixAccount</a></dt><dt><a href="#id2867008">Configuring Samba with LDAP</a></dt><dt><a href="#id2867304">Accounts and Groups management</a></dt><dt><a href="#id2867341">Security and sambaAccount</a></dt><dt><a href="#id2867456">LDAP specials attributes for sambaAccounts</a></dt><dt><a href="#id2867737">Example LDIF Entries for a sambaAccount</a></dt></dl></dd><dt><a href="#id2867793">MySQL</a></dt><dd><dl><dt><a href="#id2867800">Creating the database</a></dt><dt><a href="#id2867854">Configuring</a></dt><dt><a href="#id2867999">Using plaintext passwords or encrypted password</a></dt><dt><a href="#id2868029">Getting non-column data from the table</a></dt></dl></dd><dt><a href="#id2868072">XML</a></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2866099"></a>Introduction</h2></div></div><p>Old windows clients send plain text passwords over the wire. 
2292         Samba can check these passwords by crypting them and comparing them 
2293         to the hash stored in the unix user database.
2294         </p><p>
2295         Newer windows clients send encrypted passwords (so-called 
2296         Lanman and NT hashes) over 
2297         the wire, instead of plain text passwords. The newest clients 
2298         will only send encrypted passwords and refuse to send plain text 
2299         passwords, unless their registry is tweaked.
2300         </p><p>These passwords can't be converted to unix style encrypted 
2301         passwords. Because of that you can't use the standard unix 
2302         user database, and you have to store the Lanman and NT hashes 
2303         somewhere else. </p><p>Next to a differently encrypted passwords, 
2304         windows also stores certain data for each user 
2305         that is not stored in a unix user database, e.g. 
2306         workstations the user may logon from, the location where his/her 
2307         profile is stored, etc.
2308         Samba retrieves and stores this information using a &quot;passdb backend&quot;.
2309         Commonly
2310         available backends are LDAP, plain text file, MySQL and nisplus.
2311         For more information, see the documentation about the 
2312         <b>passdb backend = </b> parameter.
2313         </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2866152"></a>Important Notes About Security</h2></div></div><p>The unix and SMB password encryption techniques seem similar 
2314         on the surface. This similarity is, however, only skin deep. The unix 
2315         scheme typically sends clear text passwords over the network when 
2316         logging in. This is bad. The SMB encryption scheme never sends the 
2317         cleartext password over the network but it does store the 16 byte 
2318         hashed values on disk. This is also bad. Why? Because the 16 byte hashed 
2319         values are a &quot;password equivalent&quot;. You cannot derive the user's 
2320         password from them, but they could potentially be used in a modified 
2321         client to gain access to a server. This would require considerable 
2322         technical knowledge on behalf of the attacker but is perfectly possible. 
2323         You should thus treat the data stored in whatever 
2324         passdb backend you use (smbpasswd file, ldap, mysql) as though it contained the 
2325         cleartext passwords of all your users. Its contents must be kept 
2326         secret, and the file should be protected accordingly.</p><p>Ideally we would like a password scheme which neither requires 
2327         plain text passwords on the net or on disk. Unfortunately this 
2328         is not available as Samba is stuck with being compatible with 
2329         other SMB systems (WinNT, WfWg, Win95 etc). </p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Note that Windows NT 4.0 Service pack 3 changed the 
2330                 default for permissible authentication so that plaintext 
2331                 passwords are <span class="emphasis"><em>never</em></span> sent over the wire. 
2332                 The solution to this is either to switch to encrypted passwords 
2333                 with Samba or edit the Windows NT registry to re-enable plaintext 
2334                 passwords. See the document WinNT.txt for details on how to do 
2335                 this.</p><p>Other Microsoft operating systems which also exhibit 
2336                 this behavior includes</p><p> These versions of MS Windows do not support full domain
2337                 security protocols, although they may log onto a domain environment.
2338                 Of these Only MS Windows XP Home does NOT support domain logons.</p><table class="simplelist" border="0" summary="Simple list"><tr><td>MS DOS Network client 3.0 with 
2339                         the basic network redirector installed</td></tr><tr><td>Windows 95 with the network redirector 
2340                         update installed</td></tr><tr><td>Windows 98 [se]</td></tr><tr><td>Windows Me</td></tr><tr><td>Windows XP Home</td></tr></table><p> The following versions of MS Windows fully support domain
2341                 security protocols.</p><table class="simplelist" border="0" summary="Simple list"><tr><td>Windows NT 3.5x</td></tr><tr><td>Windows NT 4.0</td></tr><tr><td>Windows 2000 Professional</td></tr><tr><td>Windows 200x Server/Advanced Server</td></tr><tr><td>Windows XP Professional</td></tr></table></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>All current release of 
2342         Microsoft SMB/CIFS clients support authentication via the
2343         SMB Challenge/Response mechanism described here.  Enabling
2344         clear text authentication does not disable the ability
2345         of the client to participate in encrypted authentication.</p></div><p>MS Windows clients will cache the encrypted password alone.
2346         Even when plain text passwords are re-enabled, through the appropriate
2347         registry change, the plain text password is NEVER cached. This means that
2348         in the event that a network connections should become disconnected (broken)
2349         only the cached (encrypted) password will be sent to the resource server
2350         to affect a auto-reconnect. If the resource server does not support encrypted
2351         passwords the auto-reconnect will fail. <span class="emphasis"><em>USE OF ENCRYPTED PASSWORDS
2352         IS STRONGLY ADVISED.</em></span></p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2866314"></a>Advantages of SMB Encryption</h3></div></div><table class="simplelist" border="0" summary="Simple list"><tr><td>Plain text passwords are not passed across 
2353                         the network. Someone using a network sniffer cannot just 
2354                         record passwords going to the SMB server.</td></tr><tr><td>WinNT doesn't like talking to a server 
2355                         that does not support encrypted passwords. It will refuse 
2356                         to browse the server if the server is also in user level 
2357                         security mode. It will insist on prompting the user for the 
2358                         password on each connection, which is very annoying. The
2359                         only things you can do to stop this is to use SMB encryption.
2360                         </td></tr><tr><td>Encrypted password support allows automatic share
2361                         (resource) reconnects.</td></tr></table></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2866353"></a>Advantages of non-encrypted passwords</h3></div></div><table class="simplelist" border="0" summary="Simple list"><tr><td>Plain text passwords are not kept 
2362                         on disk, and are NOT cached in memory. </td></tr><tr><td>Uses same password file as other unix 
2363                         services such as login and ftp</td></tr><tr><td>Use of other services (such as telnet and ftp) which
2364                         send plain text passwords over the net, so sending them for SMB
2365                         isn't such a big deal.</td></tr></table></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2866388"></a>The smbpasswd Command</h2></div></div><p>The smbpasswd utility is a utility similar to the 
2366         <b>passwd</b> or <b>yppasswd</b> programs.
2367         It maintains the two 32 byte password fields in the passdb backend. </p><p><b>smbpasswd</b> works in a client-server mode 
2368         where it contacts the local smbd to change the user's password on its 
2369         behalf. This has enormous benefits - as follows.</p><p><b>smbpasswd</b> has the capability 
2370         to change passwords on Windows NT servers (this only works when 
2371         the request is sent to the NT Primary Domain Controller if you 
2372         are changing an NT Domain user's password).</p><p>To run smbpasswd as a normal user just type :</p><p><tt>$ </tt><b><tt>smbpasswd</tt></b></p><p><tt>Old SMB password: </tt><b><tt>&lt;type old value here - 
2373         or hit return if there was no old password&gt;</tt></b></p><p><tt>New SMB Password: </tt><b><tt>&lt;type new value&gt;
2374         </tt></b></p><p><tt>Repeat New SMB Password: </tt><b><tt>&lt;re-type new value
2375         </tt></b></p><p>If the old value does not match the current value stored for 
2376         that user, or the two new values do not match each other, then the 
2377         password will not be changed.</p><p>If invoked by an ordinary user it will only allow the user 
2378         to change his or her own Samba password.</p><p>If run by the root user smbpasswd may take an optional 
2379         argument, specifying the user name whose SMB password you wish to 
2380         change.  Note that when run as root smbpasswd does not prompt for 
2381         or check the old password value, thus allowing root to set passwords 
2382         for users who have forgotten their passwords.</p><p><b>smbpasswd</b> is designed to work in the same way 
2383         and be familiar to UNIX users who use the <b>passwd</b> or 
2384         <b>yppasswd</b> commands.</p><p>For more details on using <b>smbpasswd</b> refer 
2385         to the man page which will always be the definitive reference.</p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2866568"></a>Plain text</h2></div></div><p>
2386 Older versions of samba retrieved user information from the unix user database 
2387 and eventually some other fields from the file <tt>/etc/samba/smbpasswd</tt>
2388 or <tt>/etc/smbpasswd</tt>. When password encryption is disabled, no 
2389 data is stored at all.
2390 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2866597"></a>TDB</h2></div></div><p>Samba can also store the user data in a &quot;TDB&quot; (Trivial Database). Using this backend 
2391 doesn't require any additional configuration. This backend is recommended for new installations that 
2392 don not require LDAP.
2393 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2866613"></a>LDAP</h2></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2866621"></a>Introduction</h3></div></div><p>
2394 This document describes how to use an LDAP directory for storing Samba user
2395 account information traditionally stored in the smbpasswd(5) file.  It is
2396 assumed that the reader already has a basic understanding of LDAP concepts
2397 and has a working directory server already installed.  For more information
2398 on LDAP architectures and Directories, please refer to the following sites.
2399 </p><div class="itemizedlist"><ul type="disc"><li><p>OpenLDAP - <a href="http://www.openldap.org/" target="_top">http://www.openldap.org/</a></p></li><li><p>iPlanet Directory Server - <a href="http://iplanet.netscape.com/directory" target="_top">http://iplanet.netscape.com/directory</a></p></li></ul></div><p>
2400 Note that <a href="http://www.ora.com/" target="_top">O'Reilly Publishing</a> is working on
2401 a guide to LDAP for System Administrators which has a planned release date of
2402 early summer, 2002.
2403 </p><p>
2404 Two additional Samba resources which may prove to be helpful are
2405 </p><div class="itemizedlist"><ul type="disc"><li><p>The <a href="http://www.unav.es/cti/ldap-smb/ldap-smb-3-howto.html" target="_top">Samba-PDC-LDAP-HOWTO</a>
2406         maintained by Ignacio Coupeau.</p></li><li><p>The NT migration scripts from <a href="http://samba.idealx.org/" target="_top">IDEALX</a> that are
2407         geared to manage users and group in such a Samba-LDAP Domain Controller configuration.
2408         </p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2866721"></a>Encrypted Password Database</h3></div></div><p>
2409 Traditionally, when configuring <a href="smb.conf.5.html#ENCRYPTPASSWORDS" target="_top">&quot;encrypt
2410 passwords = yes&quot;</a> in Samba's <tt>smb.conf</tt> file, user account
2411 information such as username, LM/NT password hashes, password change times, and account
2412 flags have been stored in the <tt>smbpasswd(5)</tt> file.  There are several
2413 disadvantages to this approach for sites with very large numbers of users (counted
2414 in the thousands).
2415 </p><div class="itemizedlist"><ul type="disc"><li><p>
2416 The first is that all lookups must be performed sequentially.  Given that
2417 there are approximately two lookups per domain logon (one for a normal
2418 session connection such as when mapping a network drive or printer), this
2419 is a performance bottleneck for large sites.  What is needed is an indexed approach
2420 such as is used in databases.
2421 </p></li><li><p>
2422 The second problem is that administrators who desired to replicate a
2423 smbpasswd file to more than one Samba server were left to use external
2424 tools such as <b>rsync(1)</b> and <b>ssh(1)</b>
2425 and wrote custom, in-house scripts.
2426 </p></li><li><p>
2427 And finally, the amount of information which is stored in an
2428 smbpasswd entry leaves no room for additional attributes such as
2429 a home directory, password expiration time, or even a Relative
2430 Identified (RID).
2431 </p></li></ul></div><p>
2432 As a result of these defeciencies, a more robust means of storing user attributes
2433 used by smbd was developed.  The API which defines access to user accounts
2434 is commonly referred to as the samdb interface (previously this was called the passdb
2435 API, and is still so named in the CVS trees). 
2436 </p><p>
2437 There are a few points to stress about that the ldapsam
2438 does not provide.  The LDAP support referred to in the this documentation does not
2439 include:
2440 </p><div class="itemizedlist"><ul type="disc"><li><p>A means of retrieving user account information from
2441         an Windows 2000 Active Directory server.</p></li><li><p>A means of replacing /etc/passwd.</p></li></ul></div><p>
2442 The second item can be accomplished by using LDAP NSS and PAM modules.  LGPL
2443 versions of these libraries can be obtained from PADL Software
2444 (<a href="http://www.padl.com/" target="_top">http://www.padl.com/</a>). More
2445 information about the configuration of these packages may be found at &quot;LDAP,
2446 System Administration; Gerald Carter, O'Reilly; Chapter 6: Replacing NIS&quot;.
2447 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2866860"></a>Supported LDAP Servers</h3></div></div><p>
2448 The LDAP samdb code in 2.2.3 (and later) has been developed and tested
2449 using the OpenLDAP 2.0 server and client libraries. 
2450 The same code should be able to work with Netscape's Directory Server
2451 and client SDK. However, due to lack of testing so far, there are bound
2452 to be compile errors and bugs.  These should not be hard to fix.
2453 If you are so inclined, please be sure to forward all patches to
2454 <a href="mailto:samba-patches@samba.org" target="_top">samba-patches@samba.org</a> and
2455 <a href="mailto:jerry@samba.org" target="_top">jerry@samba.org</a>.
2456 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2866898"></a>Schema and Relationship to the RFC 2307 posixAccount</h3></div></div><p>
2457 Samba 3.0 includes the necessary schema file for OpenLDAP 2.0 in
2458 <tt>examples/LDAP/samba.schema</tt>.  The sambaAccount objectclass is given here:
2459 </p><pre class="programlisting">
2460 objectclass ( 1.3.1.5.1.4.1.7165.2.2.2 NAME 'sambaAccount' SUP top AUXILIARY
2461      DESC 'Samba Account'
2462      MUST ( uid $ rid )
2463      MAY  ( cn $ lmPassword $ ntPassword $ pwdLastSet $ logonTime $
2464             logoffTime $ kickoffTime $ pwdCanChange $ pwdMustChange $ acctFlags $
2465             displayName $ smbHome $ homeDrive $ scriptPath $ profilePath $
2466             description $ userWorkstations $ primaryGroupID $ domain ))
2467 </pre><p>
2468 The samba.schema file has been formatted for OpenLDAP 2.0.  The OID's are
2469 owned by the Samba Team and as such is legal to be openly published.
2470 If you translate the schema to be used with Netscape DS, please
2471 submit the modified schema file as a patch to <a href="mailto:jerry@samba.org" target="_top">jerry@samba.org</a>
2472 </p><p>
2473 Just as the smbpasswd file is meant to store information which supplements a
2474 user's <tt>/etc/passwd</tt> entry, so is the sambaAccount object
2475 meant to supplement the UNIX user account information.  A sambaAccount is a
2476 <tt>STRUCTURAL</tt> objectclass so it can be stored individually
2477 in the directory.  However, there are several fields (e.g. uid) which overlap
2478 with the posixAccount objectclass outlined in RFC2307.  This is by design.
2479 </p><p>
2480 In order to store all user account information (UNIX and Samba) in the directory,
2481 it is necessary to use the sambaAccount and posixAccount objectclasses in
2482 combination.  However, smbd will still obtain the user's UNIX account
2483 information via the standard C library calls (e.g. getpwnam(), et. al.).
2484 This means that the Samba server must also have the LDAP NSS library installed
2485 and functioning correctly.  This division of information makes it possible to
2486 store all Samba account information in LDAP, but still maintain UNIX account
2487 information in NIS while the network is transitioning to a full LDAP infrastructure.
2488 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2867008"></a>Configuring Samba with LDAP</h3></div></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2867016"></a>OpenLDAP configuration</h4></div></div><p>
2489 To include support for the sambaAccount object in an OpenLDAP directory
2490 server, first copy the samba.schema file to slapd's configuration directory.
2491 </p><p>
2492 <tt>root# </tt><b><tt>cp samba.schema /etc/openldap/schema/</tt></b>
2493 </p><p>
2494 Next, include the <tt>samba.schema</tt> file in <tt>slapd.conf</tt>.
2495 The sambaAccount object contains two attributes which depend upon other schema
2496 files.  The 'uid' attribute is defined in <tt>cosine.schema</tt> and
2497 the 'displayName' attribute is defined in the <tt>inetorgperson.schema</tt>
2498 file.  Both of these must be included before the <tt>samba.schema</tt> file.
2499 </p><pre class="programlisting">
2500 ## /etc/openldap/slapd.conf
2501
2502 ## schema files (core.schema is required by default)
2503 include            /etc/openldap/schema/core.schema
2504
2505 ## needed for sambaAccount
2506 include            /etc/openldap/schema/cosine.schema
2507 include            /etc/openldap/schema/inetorgperson.schema
2508 include            /etc/openldap/schema/samba.schema
2509 include            /etc/openldap/schema/nis.schema
2510
2511 ....
2512 </pre><p>
2513 It is recommended that you maintain some indices on some of the most usefull attributes,
2514 like in the following example, to speed up searches made on sambaAccount objectclasses
2515 (and possibly posixAccount and posixGroup as well).
2516 </p><pre class="programlisting">
2517 # Indices to maintain
2518 ## required by OpenLDAP 2.0
2519 index objectclass   eq
2520
2521 ## support pb_getsampwnam()
2522 index uid           pres,eq
2523 ## support pdb_getsambapwrid()
2524 index rid           eq
2525
2526 ## uncomment these if you are storing posixAccount and
2527 ## posixGroup entries in the directory as well
2528 ##index uidNumber     eq
2529 ##index gidNumber     eq
2530 ##index cn            eq
2531 ##index memberUid     eq
2532
2533 # (both fetched via ldapsearch):
2534 index   primaryGroupID  eq
2535 index   displayName     pres,eq
2536
2537 </pre></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2867134"></a>Configuring Samba</h4></div></div><p>
2538 The following parameters are available in smb.conf only with <i><tt>--with-ldapsam</tt></i>
2539 was included when compiling Samba.
2540 </p><div class="itemizedlist"><ul type="disc"><li><p><a href="smb.conf.5.html#PASSDBBACKEND" target="_top">passdb backend [ldapsam|ldapsam_nua]:url</a></p></li><li><p><a href="smb.conf.5.html#LDAPSSL" target="_top">ldap ssl</a></p></li><li><p><a href="smb.conf.5.html#LDAPADMINDN" target="_top">ldap admin dn</a></p></li><li><p><a href="smb.conf.5.html#LDAPSUFFIX" target="_top">ldap suffix</a></p></li><li><p><a href="smb.conf.5.html#LDAPFILTER" target="_top">ldap filter</a></p></li><li><p><a href="smb.conf.5.html#LDAPPORT" target="_top">ldap port</a></p></li><li><p><a href="smb.conf.5.html#LDAPMACHINSUFFIX" target="_top">ldap machine suffix</a></p></li><li><p><a href="smb.conf.5.html#LDAPUSERSUFFIX" target="_top">ldap user suffix</a></p></li><li><p><a href="smb.conf.5.html#LDAPDELETEDN" target="_top">ldap delete dn</a></p></li></ul></div><p>
2541 These are described in the <a href="smb.conf.5.html" target="_top">smb.conf(5)</a> man
2542 page and so will not be repeated here.  However, a sample smb.conf file for
2543 use with an LDAP directory could appear as
2544 </p><pre class="programlisting">
2545 ## /usr/local/samba/lib/smb.conf
2546 [global]
2547      security = user
2548      encrypt passwords = yes
2549
2550      netbios name = TASHTEGO
2551      workgroup = NARNIA
2552
2553      # ldap related parameters
2554
2555      # define the DN to use when binding to the directory servers
2556      # The password for this DN is not stored in smb.conf.  Rather it
2557      # must be set by using 'smbpasswd -w <i><tt>secretpw</tt></i>' to store the
2558      # passphrase in the secrets.tdb file.  If the &quot;ldap admin dn&quot; values
2559      # change, this password will need to be reset.
2560      ldap admin dn = &quot;cn=Samba Manager,ou=people,dc=samba,dc=org&quot;
2561
2562      # Define the SSL option when connecting to the directory
2563      # ('off', 'start tls', or 'on' (default))
2564      ldap ssl = start tls
2565
2566      passdb backend ldapsam:ldap://ahab.samba.org
2567
2568      # smbpasswd -x delete the entire dn-entry
2569      ldap delete dn = no
2570
2571      # the machine and user suffix added to the base suffix
2572      # wrote WITHOUT quotes. NULL siffixes by default
2573      ldap user suffix = ou=People
2574      ldap machine suffix = ou=Systems
2575
2576      # define the port to use in the LDAP session (defaults to 636 when
2577      # &quot;ldap ssl = on&quot;)
2578      ldap port = 389
2579
2580      # specify the base DN to use when searching the directory
2581      ldap suffix = &quot;ou=people,dc=samba,dc=org&quot;
2582
2583      # generally the default ldap search filter is ok
2584      # ldap filter = &quot;(&amp;(uid=%u)(objectclass=sambaAccount))&quot;
2585 </pre></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2867304"></a>Accounts and Groups management</h3></div></div><p>
2586 As users accounts are managed thru the sambaAccount objectclass, you should
2587 modify your existing administration tools to deal with sambaAccount attributes.
2588 </p><p>
2589 Machines accounts are managed with the sambaAccount objectclass, just
2590 like users accounts. However, it's up to you to store thoses accounts
2591 in a different tree of you LDAP namespace: you should use
2592 &quot;ou=Groups,dc=plainjoe,dc=org&quot; to store groups and
2593 &quot;ou=People,dc=plainjoe,dc=org&quot; to store users. Just configure your
2594 NSS and PAM accordingly (usually, in the /etc/ldap.conf configuration
2595 file).
2596 </p><p>
2597 In Samba release 3.0, the group management system is based on posix
2598 groups. This means that Samba makes usage of the posixGroup objectclass.
2599 For now, there is no NT-like group system management (global and local
2600 groups).
2601 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2867341"></a>Security and sambaAccount</h3></div></div><p>
2602 There are two important points to remember when discussing the security
2603 of sambaAccount entries in the directory.
2604 </p><div class="itemizedlist"><ul type="disc"><li><p><span class="emphasis"><em>Never</em></span> retrieve the lmPassword or
2605         ntPassword attribute values over an unencrypted LDAP session.</p></li><li><p><span class="emphasis"><em>Never</em></span> allow non-admin users to
2606         view the lmPassword or ntPassword attribute values.</p></li></ul></div><p>
2607 These password hashes are clear text equivalents and can be used to impersonate
2608 the user without deriving the original clear text strings.  For more information
2609 on the details of LM/NT password hashes, refer to the <a href="#passdb" title="Chapter 10. User information database">User Database</a> of the Samba-HOWTO-Collection.
2610 </p><p>
2611 To remedy the first security issue, the &quot;ldap ssl&quot; smb.conf parameter defaults
2612 to require an encrypted session (<b>ldap ssl = on</b>) using
2613 the default port of 636
2614 when contacting the directory server.  When using an OpenLDAP 2.0 server, it
2615 is possible to use the use the StartTLS LDAP extended  operation in the place of
2616 LDAPS.  In either case, you are strongly discouraged to disable this security
2617 (<b>ldap ssl = off</b>).
2618 </p><p>
2619 Note that the LDAPS protocol is deprecated in favor of the LDAPv3 StartTLS
2620 extended operation.  However, the OpenLDAP library still provides support for
2621 the older method of securing communication between clients and servers.
2622 </p><p>
2623 The second security precaution is to prevent non-administrative users from
2624 harvesting password hashes from the directory.  This can be done using the
2625 following ACL in <tt>slapd.conf</tt>:
2626 </p><pre class="programlisting">
2627 ## allow the &quot;ldap admin dn&quot; access, but deny everyone else
2628 access to attrs=lmPassword,ntPassword
2629      by dn=&quot;cn=Samba Admin,ou=people,dc=plainjoe,dc=org&quot; write
2630      by * none
2631 </pre></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2867456"></a>LDAP specials attributes for sambaAccounts</h3></div></div><p>
2632 The sambaAccount objectclass is composed of the following attributes:
2633 </p><div class="itemizedlist"><ul type="disc"><li><p><tt>lmPassword</tt>: the LANMAN password 16-byte hash stored as a character
2634         representation of a hexidecimal string.</p></li><li><p><tt>ntPassword</tt>: the NT password hash 16-byte stored as a character
2635         representation of a hexidecimal string.</p></li><li><p><tt>pwdLastSet</tt>: The integer time in seconds since 1970 when the
2636         <tt>lmPassword</tt> and <tt>ntPassword</tt> attributes were last set.
2637         </p></li><li><p><tt>acctFlags</tt>: string of 11 characters surrounded by square brackets []
2638         representing account flags such as U (user), W(workstation), X(no password expiration), and
2639         D(disabled).</p></li><li><p><tt>logonTime</tt>: Integer value currently unused</p></li><li><p><tt>logoffTime</tt>: Integer value currently unused</p></li><li><p><tt>kickoffTime</tt>: Integer value currently unused</p></li><li><p><tt>pwdCanChange</tt>: Integer value currently unused</p></li><li><p><tt>pwdMustChange</tt>: Integer value currently unused</p></li><li><p><tt>homeDrive</tt>: specifies the drive letter to which to map the
2640         UNC path specified by homeDirectory. The drive letter must be specified in the form &quot;X:&quot;
2641         where X is the letter of the drive to map. Refer to the &quot;logon drive&quot; parameter in the
2642         smb.conf(5) man page for more information.</p></li><li><p><tt>scriptPath</tt>: The scriptPath property specifies the path of
2643         the user's logon script, .CMD, .EXE, or .BAT file. The string can be null. The path
2644         is relative to the netlogon share.  Refer to the &quot;logon script&quot; parameter in the
2645         smb.conf(5) man page for more information.</p></li><li><p><tt>profilePath</tt>: specifies a path to the user's profile.
2646         This value can be a null string, a local absolute path, or a UNC path.  Refer to the
2647         &quot;logon path&quot; parameter in the smb.conf(5) man page for more information.</p></li><li><p><tt>smbHome</tt>: The homeDirectory property specifies the path of
2648         the home directory for the user. The string can be null. If homeDrive is set and specifies
2649         a drive letter, homeDirectory should be a UNC path. The path must be a network
2650         UNC path of the form \\server\share\directory. This value can be a null string.
2651         Refer to the &quot;logon home&quot; parameter in the smb.conf(5) man page for more information.
2652         </p></li><li><p><tt>userWorkstation</tt>: character string value currently unused.
2653         </p></li><li><p><tt>rid</tt>: the integer representation of the user's relative identifier
2654         (RID).</p></li><li><p><tt>primaryGroupID</tt>: the relative identifier (RID) of the primary group
2655         of the user.</p></li></ul></div><p>
2656 The majority of these parameters are only used when Samba is acting as a PDC of
2657 a domain (refer to the <a href="Samba-PDC-HOWTO.html" target="_top">Samba-PDC-HOWTO</a> for details on
2658 how to configure Samba as a Primary Domain Controller). The following four attributes
2659 are only stored with the sambaAccount entry if the values are non-default values:
2660 </p><div class="itemizedlist"><ul type="disc"><li><p>smbHome</p></li><li><p>scriptPath</p></li><li><p>logonPath</p></li><li><p>homeDrive</p></li></ul></div><p>
2661 These attributes are only stored with the sambaAccount entry if
2662 the values are non-default values.  For example, assume TASHTEGO has now been
2663 configured as a PDC and that <b>logon home = \\%L\%u</b> was defined in
2664 its <tt>smb.conf</tt> file. When a user named &quot;becky&quot; logons to the domain,
2665 the <i><tt>logon home</tt></i> string is expanded to \\TASHTEGO\becky.
2666 If the smbHome attribute exists in the entry &quot;uid=becky,ou=people,dc=samba,dc=org&quot;,
2667 this value is used.  However, if this attribute does not exist, then the value
2668 of the <i><tt>logon home</tt></i> parameter is used in its place.  Samba
2669 will only write the attribute value to the directory entry if the value is
2670 something other than the default (e.g. \\MOBY\becky).
2671 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2867737"></a>Example LDIF Entries for a sambaAccount</h3></div></div><p>
2672 The following is a working LDIF with the inclusion of the posixAccount objectclass:
2673 </p><pre class="programlisting">
2674 dn: uid=guest2, ou=people,dc=plainjoe,dc=org
2675 ntPassword: 878D8014606CDA29677A44EFA1353FC7
2676 pwdMustChange: 2147483647
2677 primaryGroupID: 1201
2678 lmPassword: 552902031BEDE9EFAAD3B435B51404EE
2679 pwdLastSet: 1010179124
2680 logonTime: 0
2681 objectClass: sambaAccount
2682 uid: guest2
2683 kickoffTime: 2147483647
2684 acctFlags: [UX         ]
2685 logoffTime: 2147483647
2686 rid: 19006
2687 pwdCanChange: 0
2688 </pre><p>
2689 The following is an LDIF entry for using both the sambaAccount and
2690 posixAccount objectclasses:
2691 </p><pre class="programlisting">
2692 dn: uid=gcarter, ou=people,dc=plainjoe,dc=org
2693 logonTime: 0
2694 displayName: Gerald Carter
2695 lmPassword: 552902031BEDE9EFAAD3B435B51404EE
2696 primaryGroupID: 1201
2697 objectClass: posixAccount
2698 objectClass: sambaAccount
2699 acctFlags: [UX         ]
2700 userPassword: {crypt}BpM2ej8Rkzogo
2701 uid: gcarter
2702 uidNumber: 9000
2703 cn: Gerald Carter
2704 loginShell: /bin/bash
2705 logoffTime: 2147483647
2706 gidNumber: 100
2707 kickoffTime: 2147483647
2708 pwdLastSet: 1010179230
2709 rid: 19000
2710 homeDirectory: /home/tashtego/gcarter
2711 pwdCanChange: 0
2712 pwdMustChange: 2147483647
2713 ntPassword: 878D8014606CDA29677A44EFA1353FC7
2714 </pre></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2867793"></a>MySQL</h2></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2867800"></a>Creating the database</h3></div></div><p>
2715 You either can set up your own table and specify the field names to pdb_mysql (see below
2716 for the column names) or use the default table. The file <tt>examples/pdb/mysql/mysql.dump</tt> 
2717 contains the correct queries to create the required tables. Use the command :
2718
2719 <b>mysql -u<i><tt>username</tt></i> -h<i><tt>hostname</tt></i> -p<i><tt>password</tt></i> <i><tt>databasename</tt></i> &gt; <tt>/path/to/samba/examples/pdb/mysql/mysql.dump</tt></b>
2720
2721 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2867854"></a>Configuring</h3></div></div><p>This plugin lacks some good documentation, but here is some short info:</p><p>Add a the following to the <b>passdb backend</b> variable in your <tt>smb.conf</tt>:
2722 </p><pre class="programlisting">
2723 passdb backend = [other-plugins] mysql:identifier [other-plugins]
2724 </pre><p>
2725 </p><p>The identifier can be any string you like, as long as it doesn't collide with 
2726 the identifiers of other plugins or other instances of pdb_mysql. If you 
2727 specify multiple pdb_mysql.so entries in 'passdb backend', you also need to 
2728 use different identifiers!
2729 </p><p>
2730 Additional options can be given thru the smb.conf file in the [global] section.
2731 </p><pre class="programlisting">
2732 identifier:mysql host                     - host name, defaults to 'localhost'
2733 identifier:mysql password
2734 identifier:mysql user                     - defaults to 'samba'
2735 identifier:mysql database                 - defaults to 'samba'
2736 identifier:mysql port                     - defaults to 3306
2737 identifier:table                          - Name of the table containing users
2738 </pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>
2739 Since the password for the mysql user is stored in the 
2740 smb.conf file, you should make the the smb.conf file 
2741 readable only to the user that runs samba. This is considered a security 
2742 bug and will be fixed soon.
2743 </p></div><p>Names of the columns in this table(I've added column types those columns should have first):</p><pre class="programlisting">
2744 identifier:logon time column             - int(9)
2745 identifier:logoff time column            - int(9)
2746 identifier:kickoff time column           - int(9)
2747 identifier:pass last set time column     - int(9)
2748 identifier:pass can change time column   - int(9)
2749 identifier:pass must change time column  - int(9)
2750 identifier:username column               - varchar(255) - unix username
2751 identifier:domain column                 - varchar(255) - NT domain user is part of
2752 identifier:nt username column            - varchar(255) - NT username
2753 identifier:fullname column               - varchar(255) - Full name of user
2754 identifier:home dir column               - varchar(255) - Unix homedir path
2755 identifier:dir drive column              - varchar(2)   - Directory drive path (eg: 'H:')
2756 identifier:logon script column           - varchar(255)
2757                                          - Batch file to run on client side when logging on
2758 identifier:profile path column           - varchar(255) - Path of profile
2759 identifier:acct desc column              - varchar(255) - Some ASCII NT user data
2760 identifier:workstations column           - varchar(255)
2761                                          - Workstations user can logon to (or NULL for all)
2762 identifier:unknown string column         - varchar(255) - unknown string
2763 identifier:munged dial column            - varchar(255) - ?
2764 identifier:user sid column               - varchar(255) - NT user SID
2765 identifier:group sid column              - varchar(255) - NT group ID
2766 identifier:lanman pass column            - varchar(255) - encrypted lanman password
2767 identifier:nt pass column                - varchar(255) - encrypted nt passwd
2768 identifier:plain pass column             - varchar(255) - plaintext password
2769 identifier:acct control column           - int(9) - nt user data
2770 identifier:unknown 3 column              - int(9) - unknown
2771 identifier:logon divs column             - int(9) - ?
2772 identifier:hours len column              - int(9) - ?
2773 identifier:unknown 5 column              - int(9) - unknown
2774 identifier:unknown 6 column              - int(9) - unknown
2775 </pre><p>
2776 Eventually, you can put a colon (:) after the name of each column, which 
2777 should specify the column to update when updating the table. You can also
2778 specify nothing behind the colon - then the data from the field will not be 
2779 updated. 
2780 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2867999"></a>Using plaintext passwords or encrypted password</h3></div></div><p>
2781 I strongly discourage the use of plaintext passwords, however, you can use them:
2782 </p><p>
2783 If you would like to use plaintext passwords, set
2784 'identifier:lanman pass column' and 'identifier:nt pass column' to
2785 'NULL' (without the quotes) and 'identifier:plain pass column' to the
2786 name of the column containing the plaintext passwords. 
2787 </p><p>
2788 If you use encrypted passwords, set the 'identifier:plain pass
2789 column' to 'NULL' (without the quotes). This is the default.
2790 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2868029"></a>Getting non-column data from the table</h3></div></div><p>
2791 It is possible to have not all data in the database and making some 'constant'.
2792 </p><p>
2793 For example, you can set 'identifier:fullname column' to : 
2794 <b>CONCAT(First_name,' ',Sur_name)</b>
2795 </p><p>
2796 Or, set 'identifier:workstations column' to :
2797 <b>NULL</b></p><p>See the MySQL documentation for more language constructs.</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2868072"></a>XML</h2></div></div><p>This module requires libxml2 to be installed.</p><p>The usage of pdb_xml is pretty straightforward. To export data, use:
2798 </p><p>
2799         <b><tt>pdbedit -e xml:filename</tt></b>
2800 </p><p>
2801 (where filename is the name of the file to put the data in)
2802 </p><p>
2803 To import data, use:
2804 <b><tt>pdbedit -i xml:filename -e current-pdb</tt></b>
2805 </p><p>
2806 Where filename is the name to read the data from and current-pdb to put it in.
2807 </p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="unix-permissions"></a>Chapter 11. UNIX Permission Bits and Windows NT Access Control Lists</h2></div><div><div class="author"><h3 class="author">Jeremy Allison</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jra@samba.org">jra@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">12 Apr 1999</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2865054">Viewing and changing UNIX permissions using the NT 
2808         security dialogs</a></dt><dt><a href="#id2864937">How to view file security on a Samba share</a></dt><dt><a href="#id2868280">Viewing file ownership</a></dt><dt><a href="#id2868401">Viewing file or directory permissions</a></dt><dd><dl><dt><a href="#id2868484">File Permissions</a></dt><dt><a href="#id2868587">Directory Permissions</a></dt></dl></dd><dt><a href="#id2868637">Modifying file or directory permissions</a></dt><dt><a href="#id2868797">Interaction with the standard Samba create mask 
2809         parameters</a></dt><dt><a href="#id2869113">Interaction with the standard Samba file attribute 
2810         mapping</a></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2865054"></a>Viewing and changing UNIX permissions using the NT 
2811         security dialogs</h2></div></div><p>Windows NT clients can use their native security settings 
2812         dialog box to view and modify the underlying UNIX permissions.</p><p>Note that this ability is careful not to compromise 
2813         the security of the UNIX host Samba is running on, and 
2814         still obeys all the file permission rules that a Samba 
2815         administrator can set.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
2816         All access to Unix/Linux system file via Samba is controlled at
2817         the operating system file access control level. When trying to
2818         figure out file access problems it is vitally important to identify
2819         the identity of the Windows user as it is presented by Samba at
2820         the point of file access. This can best be determined from the
2821         Samba log files.
2822         </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2864937"></a>How to view file security on a Samba share</h2></div></div><p>From an NT4/2000/XP client, single-click with the right 
2823         mouse button on any file or directory in a Samba mounted 
2824         drive letter or UNC path. When the menu pops-up, click 
2825         on the <span class="emphasis"><em>Properties</em></span> entry at the bottom of 
2826         the menu. This brings up the file properties dialog
2827         box. Click on the tab <span class="emphasis"><em>Security</em></span> and you 
2828         will see three buttons, <span class="emphasis"><em>Permissions</em></span>,     
2829         <span class="emphasis"><em>Auditing</em></span>, and <span class="emphasis"><em>Ownership</em></span>. 
2830         The <span class="emphasis"><em>Auditing</em></span> button will cause either 
2831         an error message A requested privilege is not held 
2832         by the client to appear if the user is not the 
2833         NT Administrator, or a dialog which is intended to allow an 
2834         Administrator to add auditing requirements to a file if the 
2835         user is logged on as the NT Administrator. This dialog is 
2836         non-functional with a Samba share at this time, as the only 
2837         useful button, the <b>Add</b> button will not currently 
2838         allow a list of users to be seen.</p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2868280"></a>Viewing file ownership</h2></div></div><p>Clicking on the <b>&quot;Ownership&quot;</b> button 
2839         brings up a dialog box telling you who owns the given file. The 
2840         owner name will be of the form :</p><p><b>&quot;SERVER\user (Long name)&quot;</b></p><p>Where <i><tt>SERVER</tt></i> is the NetBIOS name of 
2841         the Samba server, <i><tt>user</tt></i> is the user name of 
2842         the UNIX user who owns the file, and <i><tt>(Long name)</tt></i>
2843         is the descriptive string identifying the user (normally found in the
2844         GECOS field of the UNIX password database). Click on the <b>Close
2845         </b> button to remove this dialog.</p><p>If the parameter <i><tt>nt acl support</tt></i>
2846         is set to <tt>false</tt> then the file owner will 
2847         be shown as the NT user <b>&quot;Everyone&quot;</b>.</p><p>The <b>Take Ownership</b> button will not allow 
2848         you to change the ownership of this file to yourself (clicking on 
2849         it will display a dialog box complaining that the user you are 
2850         currently logged onto the NT client cannot be found). The reason 
2851         for this is that changing the ownership of a file is a privileged 
2852         operation in UNIX, available only to the <span class="emphasis"><em>root</em></span> 
2853         user. As clicking on this button causes NT to attempt to change 
2854         the ownership of a file to the current user logged into the NT 
2855         client this will not work with Samba at this time.</p><p>There is an NT chown command that will work with Samba 
2856         and allow a user with Administrator privilege connected 
2857         to a Samba server as root to change the ownership of 
2858         files on both a local NTFS filesystem or remote mounted NTFS 
2859         or Samba drive. This is available as part of the <span class="emphasis"><em>Seclib
2860         </em></span> NT security library written by Jeremy Allison of 
2861         the Samba Team, available from the main Samba ftp site.</p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2868401"></a>Viewing file or directory permissions</h2></div></div><p>The third button is the <b>&quot;Permissions&quot;</b> 
2862         button. Clicking on this brings up a dialog box that shows both 
2863         the permissions and the UNIX owner of the file or directory. 
2864         The owner is displayed in the form :</p><p><b>&quot;SERVER\user (Long name)&quot;</b></p><p>Where <i><tt>SERVER</tt></i> is the NetBIOS name of 
2865         the Samba server, <i><tt>user</tt></i> is the user name of 
2866         the UNIX user who owns the file, and <i><tt>(Long name)</tt></i>
2867         is the descriptive string identifying the user (normally found in the
2868         GECOS field of the UNIX password database).</p><p>If the parameter <i><tt>nt acl support</tt></i>
2869         is set to <tt>false</tt> then the file owner will 
2870         be shown as the NT user <b>&quot;Everyone&quot;</b> and the 
2871         permissions will be shown as NT &quot;Full Control&quot;.</p><p>The permissions field is displayed differently for files 
2872         and directories, so I'll describe the way file permissions 
2873         are displayed first.</p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2868484"></a>File Permissions</h3></div></div><p>The standard UNIX user/group/world triple and 
2874                 the corresponding &quot;read&quot;, &quot;write&quot;, &quot;execute&quot; permissions 
2875                 triples are mapped by Samba into a three element NT ACL 
2876                 with the 'r', 'w', and 'x' bits mapped into the corresponding 
2877                 NT permissions. The UNIX world permissions are mapped into 
2878                 the global NT group <b>Everyone</b>, followed 
2879                 by the list of permissions allowed for UNIX world. The UNIX 
2880                 owner and group permissions are displayed as an NT 
2881                 <b>user</b> icon and an NT <b>local 
2882                 group</b> icon respectively followed by the list 
2883                 of permissions allowed for the UNIX user and group.</p><p>As many UNIX permission sets don't map into common 
2884                 NT names such as <b>&quot;read&quot;</b>, <b>
2885                 &quot;change&quot;</b> or <b>&quot;full control&quot;</b> then 
2886                 usually the permissions will be prefixed by the words <b>
2887                 &quot;Special Access&quot;</b> in the NT display list.</p><p>But what happens if the file has no permissions allowed 
2888                 for a particular UNIX user group or world component ? In order 
2889                 to  allow &quot;no permissions&quot; to be seen and modified then Samba 
2890                 overloads the NT <b>&quot;Take Ownership&quot;</b> ACL attribute 
2891                 (which has no meaning in UNIX) and reports a component with 
2892                 no permissions as having the NT <b>&quot;O&quot;</b> bit set. 
2893                 This was chosen of course to make it look like a zero, meaning 
2894                 zero permissions. More details on the decision behind this will 
2895                 be given below.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2868587"></a>Directory Permissions</h3></div></div><p>Directories on an NT NTFS file system have two 
2896                 different sets of permissions. The first set of permissions 
2897                 is the ACL set on the directory itself, this is usually displayed 
2898                 in the first set of parentheses in the normal <b>&quot;RW&quot;</b> 
2899                 NT style. This first set of permissions is created by Samba in 
2900                 exactly the same way as normal file permissions are, described 
2901                 above, and is displayed in the same way.</p><p>The second set of directory permissions has no real meaning 
2902                 in the UNIX permissions world and represents the <b>
2903                 &quot;inherited&quot;</b> permissions that any file created within 
2904                 this directory would inherit.</p><p>Samba synthesises these inherited permissions for NT by 
2905                 returning as an NT ACL the UNIX permission mode that a new file 
2906                 created by Samba on this share would receive.</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2868637"></a>Modifying file or directory permissions</h2></div></div><p>Modifying file and directory permissions is as simple 
2907         as changing the displayed permissions in the dialog box, and 
2908         clicking the <b>OK</b> button. However, there are 
2909         limitations that a user needs to be aware of, and also interactions 
2910         with the standard Samba permission masks and mapping of DOS 
2911         attributes that need to also be taken into account.</p><p>If the parameter <i><tt>nt acl support</tt></i>
2912         is set to <tt>false</tt> then any attempt to set 
2913         security permissions will fail with an <b>&quot;Access Denied&quot;
2914         </b> message.</p><p>The first thing to note is that the <b>&quot;Add&quot;</b> 
2915         button will not return a list of users in Samba (it will give 
2916         an error message of <b>&quot;The remote procedure call failed 
2917         and did not execute&quot;</b>). This means that you can only 
2918         manipulate the current user/group/world permissions listed in 
2919         the dialog box. This actually works quite well as these are the 
2920         only permissions that UNIX actually has.</p><p>If a permission triple (either user, group, or world) 
2921         is removed from the list of permissions in the NT dialog box, 
2922         then when the <b>&quot;OK&quot;</b> button is pressed it will 
2923         be applied as &quot;no permissions&quot; on the UNIX side. If you then 
2924         view the permissions again the &quot;no permissions&quot; entry will appear 
2925         as the NT <b>&quot;O&quot;</b> flag, as described above. This 
2926         allows you to add permissions back to a file or directory once 
2927         you have removed them from a triple component.</p><p>As UNIX supports only the &quot;r&quot;, &quot;w&quot; and &quot;x&quot; bits of 
2928         an NT ACL then if other NT security attributes such as &quot;Delete 
2929         access&quot; are selected then they will be ignored when applied on 
2930         the Samba server.</p><p>When setting permissions on a directory the second 
2931         set of permissions (in the second set of parentheses) is 
2932         by default applied to all files within that directory. If this 
2933         is not what you want you must uncheck the <b>&quot;Replace 
2934         permissions on existing files&quot;</b> checkbox in the NT 
2935         dialog before clicking <b>&quot;OK&quot;</b>.</p><p>If you wish to remove all permissions from a 
2936         user/group/world  component then you may either highlight the 
2937         component and click the <b>&quot;Remove&quot;</b> button, 
2938         or set the component to only have the special <b>&quot;Take
2939         Ownership&quot;</b> permission (displayed as <b>&quot;O&quot;
2940         </b>) highlighted.</p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2868797"></a>Interaction with the standard Samba create mask 
2941         parameters</h2></div></div><p>There are four parameters 
2942         to control interaction with the standard Samba create mask parameters.
2943         These are :</p><p><i><tt>security mask</tt></i></p><p><i><tt>force security mode</tt></i></p><p><i><tt>directory security mask</tt></i></p><p><i><tt>force directory security mode</tt></i></p><p>Once a user clicks <b>&quot;OK&quot;</b> to apply the 
2944         permissions Samba maps the given permissions into a user/group/world 
2945         r/w/x triple set, and then will check the changed permissions for a 
2946         file against the bits set in the <a href="smb.conf.5.html#SECURITYMASK" target="_top"> 
2947         <i><tt>security mask</tt></i></a> parameter. Any bits that 
2948         were changed that are not set to '1' in this parameter are left alone 
2949         in the file permissions.</p><p>Essentially, zero bits in the <i><tt>security mask</tt></i>
2950         mask may be treated as a set of bits the user is <span class="emphasis"><em>not</em></span> 
2951         allowed to change, and one bits are those the user is allowed to change.
2952         </p><p>If not set explicitly this parameter is set to the same value as 
2953         the <a href="smb.conf.5.html#CREATEMASK" target="_top"><i><tt>create mask
2954         </tt></i></a> parameter. To allow a user to modify all the
2955         user/group/world permissions on a file, set this parameter 
2956         to 0777.</p><p>Next Samba checks the changed permissions for a file against 
2957         the bits set in the <a href="smb.conf.5.html#FORCESECURITYMODE" target="_top">
2958         <i><tt>force security mode</tt></i></a> parameter. Any bits 
2959         that were changed that correspond to bits set to '1' in this parameter 
2960         are forced to be set.</p><p>Essentially, bits set in the <i><tt>force security mode
2961         </tt></i> parameter may be treated as a set of bits that, when 
2962         modifying security on a file, the user has always set to be 'on'.</p><p>If not set explicitly this parameter is set to the same value 
2963         as the <a href="smb.conf.5.html#FORCECREATEMODE" target="_top"><i><tt>force 
2964         create mode</tt></i></a> parameter.
2965         To allow a user to modify all the user/group/world permissions on a file
2966         with no restrictions set this parameter to 000.</p><p>The <i><tt>security mask</tt></i> and <i><tt>force 
2967         security mode</tt></i> parameters are applied to the change 
2968         request in that order.</p><p>For a directory Samba will perform the same operations as 
2969         described above for a file except using the parameter <i><tt>
2970         directory security mask</tt></i> instead of <i><tt>security 
2971         mask</tt></i>, and <i><tt>force directory security mode
2972         </tt></i> parameter instead of <i><tt>force security mode
2973         </tt></i>.</p><p>The <i><tt>directory security mask</tt></i> parameter 
2974         by default is set to the same value as the <i><tt>directory mask
2975         </tt></i> parameter and the <i><tt>force directory security 
2976         mode</tt></i> parameter by default is set to the same value as 
2977         the <i><tt>force directory mode</tt></i> parameter. </p><p>In this way Samba enforces the permission restrictions that 
2978         an administrator can set on a Samba share, whilst still allowing users 
2979         to modify the permission bits within that restriction.</p><p>If you want to set up a share that allows users full control
2980         in modifying the permission bits on their files and directories and
2981         doesn't force any particular bits to be set 'on', then set the following
2982         parameters in the <tt>smb.conf</tt> file in that share specific section :</p><p><i><tt>security mask = 0777</tt></i></p><p><i><tt>force security mode = 0</tt></i></p><p><i><tt>directory security mask = 0777</tt></i></p><p><i><tt>force directory security mode = 0</tt></i></p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2869113"></a>Interaction with the standard Samba file attribute 
2983         mapping</h2></div></div><p>Samba maps some of the DOS attribute bits (such as &quot;read 
2984         only&quot;) into the UNIX permissions of a file. This means there can 
2985         be a conflict between the permission bits set via the security 
2986         dialog and the permission bits set by the file attribute mapping.
2987         </p><p>One way this can show up is if a file has no UNIX read access
2988         for the owner it will show up as &quot;read only&quot; in the standard 
2989         file attributes tabbed dialog. Unfortunately this dialog is
2990         the same one that contains the security info in another tab.</p><p>What this can mean is that if the owner changes the permissions
2991         to allow themselves read access using the security dialog, clicks
2992         <b>&quot;OK&quot;</b> to get back to the standard attributes tab 
2993         dialog, and then clicks <b>&quot;OK&quot;</b> on that dialog, then 
2994         NT will set the file permissions back to read-only (as that is what 
2995         the attributes still say in the dialog). This means that after setting 
2996         permissions and clicking <b>&quot;OK&quot;</b> to get back to the 
2997         attributes dialog you should always hit <b>&quot;Cancel&quot;</b> 
2998         rather than <b>&quot;OK&quot;</b> to ensure that your changes 
2999         are not overridden.</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="groupmapping"></a>Chapter 12. Configuring Group Mapping</h2></div><div><div class="author"><h3 class="author">Jean François Micouleau</h3></div></div><div><div class="author"><h3 class="author">Gerald (Jerry) Carter</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jerry@samba.org">jerry@samba.org</a>&gt;</tt></p></div></div></div></div></div><p>
3000 Starting with Samba 3.0 alpha 2, new group mapping functionality
3001 is available to create associations between Windows SIDs and UNIX
3002 groups. The <i><tt>groupmap</tt></i> subcommand included with
3003 the <b>net</b> tool can be used to manage these associations.
3004 </p><p>
3005 The first immediate reason to use the group mapping on a Samba PDC, is that
3006 the <i><tt>domain admin group</tt></i> <tt>smb.conf</tt> has been removed.
3007 This parameter was used to give the listed users membership in the &quot;Domain Admins&quot;
3008 Windows group which gave local admin rights on their workstations (in
3009 default configurations).
3010 </p><p>
3011 When installing NT/W2K on a computer, the installer program creates some users
3012 and groups. Notably the 'Administrators' group, and gives to that group some
3013 privileges like the ability to change the date and time or to kill any process
3014 (or close too) running on the local machine. The 'Administrator' user is a
3015 member of the 'Administrators' group, and thus 'inherit' the 'Administrators'
3016 group privileges. If a 'joe' user is created and become a member of the
3017 'Administrator' group, 'joe' has exactly the same rights as 'Administrator'.
3018 </p><p>
3019 When a NT/W2K machine is joined to a domain, the &quot;Domain Adminis&quot; group of the
3020 PDC is added to the local 'Administrators' group of the workstation. Every
3021 member of the 'Domain Administrators' group 'inherit' the
3022 rights of the local 'Administrators' group when logging on the workstation.
3023 </p><p>
3024 The following steps describe how to make samba PDC users members of the
3025 'Domain Admins' group?
3026 </p><div class="orderedlist"><ol type="1"><li><p>create a unix group (usually in <tt>/etc/group</tt>),
3027   let's call it domadm</p></li><li><p>add to this group the users that must be Administrators. For example
3028   if you want joe,john and mary, your entry in <tt>/etc/group</tt> will
3029   look like:</p><pre class="programlisting">
3030   domadm:x:502:joe,john,mary
3031   </pre></li><li><p>Map this domadm group to the &quot;Domain Admins&quot; group
3032   by running the command:</p><p><tt>root# </tt><b><tt>net groupmap add ntgroup=&quot;Domain Admins&quot; unixgroup=domadm</tt></b></p><p>The quotes around &quot;Domain Admins&quot; are necessary due to the space in the group name.  Also make
3033   sure to leave no whitespace surrounding the equal character (=).</p></li></ol></div><p>Now joe, john and mary are domain administrators!</p><p>
3034 It is possible to map any arbitrary UNIX group to any Windows NT
3035 group as well as making any UNIX group a Windows domain group.
3036 For example, if you wanted to include a UNIX group (e.g. acct) in a ACL on a
3037 local file or printer on a domain member machine, you would flag
3038 that group as a domain group by running the following on the Samba PDC:
3039 </p><p><tt>root# </tt><b><tt>net groupmap add rid=1000 ntgroup=&quot;Accounting&quot; unixgroup=acct</tt></b></p><p>Be aware that the rid parmeter is a unsigned 32 bit integer that should
3040 normally start at 1000.  However, this rid must not overlap with any RID assigned
3041 to a user.  Verifying this is done differently depending on on the passdb backend 
3042 you are using.  Future versions of the tools may perform the verification automatically,
3043 but for now the burden in on you.</p><p>You can list the various groups in the mapping database by executing 
3044 <b>net groupmap list</b>.  Here is an example:</p><pre class="programlisting"><tt>root# </tt>net groupmap list
3045 System Administrators (S-1-5-21-2547222302-1596225915-2414751004-1002) -&gt; sysadmin
3046 Domain Admins (S-1-5-21-2547222302-1596225915-2414751004-512) -&gt; domadmin
3047 Domain Users (S-1-5-21-2547222302-1596225915-2414751004-513) -&gt; domuser
3048 Domain Guests (S-1-5-21-2547222302-1596225915-2414751004-514) -&gt; domguest
3049 </pre><p>For complete details on <b>net groupmap</b>, refer to the 
3050 net(8) man page.</p></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="printing"></a>Chapter 13. Printing Support</h2></div><div><div class="author"><h3 class="author">Gerald (Jerry) Carter</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jerry@samba.org">jerry@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Patrick Powell</h3><div class="affiliation"><div class="address"><p><tt>&lt;<a href="mailto:papowell@lprng.org">papowell@lprng.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate"> (3 May 2001) </p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2869498">Introduction</a></dt><dt><a href="#id2869614">Configuration</a></dt><dd><dl><dt><a href="#id2869661">Creating [print$]</a></dt><dt><a href="#id2869893">Setting Drivers for Existing Printers</a></dt><dt><a href="#id2869992">Support a large number of printers</a></dt><dt><a href="#id2870099">Adding New Printers via the Windows NT APW</a></dt><dt><a href="#id2870231">Samba and Printer Ports</a></dt></dl></dd><dt><a href="#id2869233">The Imprints Toolset</a></dt><dd><dl><dt><a href="#id2869259">What is Imprints?</a></dt><dt><a href="#id2870336">Creating Printer Driver Packages</a></dt><dt><a href="#id2870355">The Imprints server</a></dt><dt><a href="#id2870379">The Installation Client</a></dt></dl></dd><dt><a href="#id2869340">Diagnosis</a></dt><dd><dl><dt><a href="#id2869347">Introduction</a></dt><dt><a href="#id2870552">Debugging printer problems</a></dt><dt><a href="#id2870619">What printers do I have?</a></dt><dt><a href="#id2870661">Setting up printcap and print servers</a></dt><dt><a href="#id2870795">Job sent, no output</a></dt><dt><a href="#id2871344">Job sent, strange output</a></dt><dt><a href="#id2871420">Raw PostScript printed</a></dt><dt><a href="#id2871438">Advanced Printing</a></dt><dt><a href="#id2871464">Real debugging</a></dt></dl></dd></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2869498"></a>Introduction</h2></div></div><p>Beginning with the 2.2.0 release, Samba supports 
3051 the native Windows NT printing mechanisms implemented via 
3052 MS-RPC (i.e. the SPOOLSS named pipe).  Previous versions of 
3053 Samba only supported LanMan printing calls.</p><p>The additional functionality provided by the new 
3054 SPOOLSS support includes:</p><div class="itemizedlist"><ul type="disc"><li><p>Support for downloading printer driver 
3055         files to Windows 95/98/NT/2000 clients upon demand.
3056         </p></li><li><p>Uploading of printer drivers via the 
3057         Windows NT Add Printer Wizard (APW) or the 
3058         Imprints tool set (refer to <a href="http://imprints.sourceforge.net" target="_top">http://imprints.sourceforge.net</a>). 
3059         </p></li><li><p>Support for the native MS-RPC printing 
3060         calls such as StartDocPrinter, EnumJobs(), etc...  (See 
3061         the MSDN documentation at <a href="http://msdn.microsoft.com/" target="_top">http://msdn.microsoft.com/</a> 
3062         for more information on the Win32 printing API)
3063         </p></li><li><p>Support for NT Access Control Lists (ACL) 
3064         on printer objects</p></li><li><p>Improved support for printer queue manipulation 
3065         through the use of an internal databases for spooled job 
3066         information</p></li></ul></div><p>
3067 There has been some initial confusion about what all this means
3068 and whether or not it is a requirement for printer drivers to be 
3069 installed on a Samba host in order to support printing from Windows 
3070 clients. As a side note, Samba does not use these drivers in any way to process 
3071 spooled files.  They are utilized entirely by the clients.
3072 </p><p>
3073 The following MS KB article, may be of some help if you are dealing with
3074 Windows 2000 clients:  <span class="emphasis"><em>How to Add Printers with No User 
3075 Interaction in Windows 2000</em></span>
3076 </p><p>
3077 <a href="http://support.microsoft.com/support/kb/articles/Q189/1/05.ASP" target="_top">http://support.microsoft.com/support/kb/articles/Q189/1/05.ASP</a>
3078 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2869614"></a>Configuration</h2></div></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">[print$] vs. [printer$]</h3><p>
3079 Previous versions of Samba recommended using a share named [printer$].  
3080 This name was taken from the printer$ service created by Windows 9x 
3081 clients when a printer was shared.  Windows 9x printer servers always have 
3082 a printer$ service which provides read-only access via no 
3083 password in order to support printer driver downloads.
3084 </p><p>
3085 However, the initial implementation allowed for a 
3086 parameter named <i><tt>printer driver location</tt></i> 
3087 to be used on a per share basis to specify the location of 
3088 the driver files associated with that printer.  Another 
3089 parameter named <i><tt>printer driver</tt></i> provided 
3090 a means of defining the printer driver name to be sent to 
3091 the client.
3092 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2869661"></a>Creating [print$]</h3></div></div><p>
3093 In order to support the uploading of printer driver 
3094 files, you must first configure a file share named [print$].  
3095 The name of this share is hard coded in Samba's internals so 
3096 the name is very important (print$ is the service used by 
3097 Windows NT print servers to provide support for printer driver 
3098 download).
3099 </p><p>You should modify the server's smb.conf file to add the global
3100 parameters and to create the 
3101 following file share (of course, some of the parameter values,
3102 such as 'path' are arbitrary and should be replaced with
3103 appropriate values for your site):</p><pre class="programlisting">
3104 [global]
3105     ; members of the ntadmin group should be able
3106     ; to add drivers and set printer properties
3107     ; root is implicitly a 'printer admin'
3108     printer admin = @ntadmin
3109
3110 [print$]
3111     path = /usr/local/samba/printers
3112     guest ok = yes
3113     browseable = yes
3114     read only = yes
3115     ; since this share is configured as read only, then we need
3116     ; a 'write list'.  Check the file system permissions to make
3117     ; sure this account can copy files to the share.  If this
3118     ; is setup to a non-root account, then it should also exist
3119     ; as a 'printer admin'
3120     write list = @ntadmin,root
3121 </pre><p>The <a href="smb.conf.5.html#WRITELIST" target="_top"><i><tt>
3122 write list</tt></i></a> is used to allow administrative 
3123 level user accounts to have write access in order to update files 
3124 on the share.  See the <a href="smb.conf.5.html" target="_top">smb.conf(5) 
3125 man page</a> for more information on configuring file shares.</p><p>The requirement for <a href="smb.conf.5.html#GUESTOK" target="_top"><b>guest 
3126 ok = yes</b></a> depends upon how your
3127 site is configured.  If users will be guaranteed to have 
3128 an account on the Samba host, then this is a non-issue.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Author's Note</h3><p>
3129 The non-issue is that if all your Windows NT users are guaranteed to be 
3130 authenticated by the Samba server (such as a domain member server and the NT 
3131 user has already been validated by the Domain Controller in 
3132 order to logon to the Windows NT console), then guest access 
3133 is not necessary.  Of course, in a workgroup environment where 
3134 you just want to be able to print without worrying about 
3135 silly accounts and security, then configure the share for 
3136 guest access.  You'll probably want to add <a href="smb.conf.5.html#MAPTOGUEST" target="_top"><b>map to guest = Bad User
3137 </b></a> in the [global] section as well.  Make sure 
3138 you understand what this parameter does before using it 
3139 though. --jerry
3140 </p></div><p>In order for a Windows NT print server to support 
3141 the downloading of driver files by multiple client architectures,
3142 it must create subdirectories within the [print$] service
3143 which correspond to each of the supported client architectures.
3144 Samba follows this model as well.</p><p>Next create the directory tree below the [print$] share 
3145 for each architecture you wish to support.</p><p><tt>
3146 [print$]-----
3147         |-W32X86           ; &quot;Windows NT x86&quot;
3148         |-WIN40            ; &quot;Windows 95/98&quot;
3149         |-W32ALPHA         ; &quot;Windows NT Alpha_AXP&quot;
3150         |-W32MIPS          ; &quot;Windows NT R4000&quot;
3151         |-W32PPC           ; &quot;Windows NT PowerPC&quot;
3152 </tt></p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">ATTENTION!  REQUIRED PERMISSIONS</h3><p>
3153 In order to currently add a new driver to you Samba host, 
3154 one of two conditions must hold true:
3155 </p><div class="itemizedlist"><ul type="disc"><li><p>The account used to connect to the Samba host 
3156         must have a uid of 0 (i.e. a root account)</p></li><li><p>The account used to connect to the Samba host
3157         must be a member of the <a href="smb.conf.5.html#PRINTERADMIN" target="_top"><i><tt>printer 
3158         admin</tt></i></a> list.</p></li></ul></div><p>
3159 Of course, the connected account must still possess access
3160 to add files to the subdirectories beneath [print$]. Remember
3161 that all file shares are set to 'read only' by default.
3162 </p></div><p>
3163 Once you have created the required [print$] service and 
3164 associated subdirectories, simply log onto the Samba server using 
3165 a root (or <i><tt>printer admin</tt></i>) account
3166 from a Windows NT 4.0/2k client.  Open &quot;Network Neighbourhood&quot; or
3167 &quot;My Network Places&quot; and browse for the Samba host.  Once you have located
3168 the server, navigate to the &quot;Printers...&quot; folder.
3169 You should see an initial listing of printers
3170 that matches the printer shares defined on your Samba host.
3171 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2869893"></a>Setting Drivers for Existing Printers</h3></div></div><p>The initial listing of printers in the Samba host's 
3172 Printers folder will have no real printer driver assigned 
3173 to them. This defaults to a NULL string to allow the use
3174 of the local Add Printer Wizard on NT/2000 clients.
3175 Attempting to view the printer properties for a printer
3176 which has this default driver assigned will result in 
3177 the error message:</p><p>
3178 <span class="emphasis"><em>Device settings cannot be displayed.  The driver 
3179 for the specified printer is not installed, only spooler 
3180 properties will be displayed.  Do you want to install the 
3181 driver now?</em></span>
3182 </p><p>
3183 Click &quot;No&quot; in the error dialog and you will be presented with
3184 the printer properties window.  The way to assign a driver to a 
3185 printer is to either
3186 </p><div class="itemizedlist"><ul type="disc"><li><p>Use the &quot;New Driver...&quot; button to install 
3187         a new printer driver, or</p></li><li><p>Select a driver from the popup list of 
3188         installed drivers.  Initially this list will be empty.</p></li></ul></div><p>If you wish to install printer drivers for client 
3189 operating systems other than &quot;Windows NT x86&quot;, you will need 
3190 to use the &quot;Sharing&quot; tab of the printer properties dialog.</p><p>Assuming you have connected with a root account, you 
3191 will also be able modify other printer properties such as 
3192 ACLs and device settings using this dialog box.</p><p>A few closing comments for this section, it is possible 
3193 on a Windows NT print server to have printers
3194 listed in the Printers folder which are not shared.  Samba does
3195 not make this distinction.  By definition, the only printers of
3196 which Samba is aware are those which are specified as shares in
3197 <tt>smb.conf</tt>.</p><p>Another interesting side note is that Windows NT clients do
3198 not use the SMB printer share, but rather can print directly 
3199 to any printer on another Windows NT host using MS-RPC.  This
3200 of course assumes that the printing client has the necessary
3201 privileges on the remote host serving the printer.  The default
3202 permissions assigned by Windows NT to a printer gives the &quot;Print&quot;
3203 permissions to the &quot;Everyone&quot; well-known group.
3204 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2869992"></a>Support a large number of printers</h3></div></div><p>One issue that has arisen during the development
3205 phase of Samba 2.2 is the need to support driver downloads for
3206 100's of printers.  Using the Windows NT APW is somewhat 
3207 awkward to say the list.  If more than one printer are using the 
3208 same driver, the <a href="rpcclient.1.html" target="_top"><b>rpcclient's
3209 setdriver command</b></a> can be used to set the driver
3210 associated with an installed driver.  The following is example
3211 of how this could be accomplished:</p><p>
3212 <tt>$ </tt><b><tt>rpcclient pogo -U root%secret -c &quot;enumdrivers&quot;</tt></b>
3213 </p><pre class="programlisting"> 
3214 Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
3215  
3216 [Windows NT x86]
3217 Printer Driver Info 1:
3218      Driver Name: [HP LaserJet 4000 Series PS]
3219  
3220 Printer Driver Info 1:
3221      Driver Name: [HP LaserJet 2100 Series PS]
3222  
3223 Printer Driver Info 1:
3224      Driver Name: [HP LaserJet 4Si/4SiMX PS]
3225 </pre><p>                                 
3226 <tt>$ </tt><b><tt>rpcclient pogo -U root%secret -c &quot;enumprinters&quot;</tt></b>
3227 </p><pre class="programlisting">
3228 Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
3229      flags:[0x800000]
3230      name:[\\POGO\hp-print]
3231      description:[POGO\\POGO\hp-print,NO DRIVER AVAILABLE FOR THIS PRINTER,]
3232      comment:[]
3233                                   
3234 </pre><p>
3235 <tt>$ </tt><b><tt>rpcclient pogo -U root%secret -c &quot;setdriver hp-print \&quot;HP LaserJet 4000 Series PS\&quot;&quot;</tt></b>
3236 </p><pre class="programlisting">
3237 Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
3238 Successfully set hp-print to driver HP LaserJet 4000 Series PS.
3239 </pre></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2870099"></a>Adding New Printers via the Windows NT APW</h3></div></div><p>
3240 By default, Samba offers all printer shares defined in <tt>smb.conf</tt>
3241 in the &quot;Printers...&quot; folder.  Also existing in this folder is the Windows NT 
3242 Add Printer Wizard icon.  The APW will be show only if
3243 </p><div class="itemizedlist"><ul type="disc"><li><p>The connected user is able to successfully
3244         execute an OpenPrinterEx(\\server) with administrative
3245         privileges (i.e. root or <i><tt>printer admin</tt></i>).
3246         </p></li><li><p><a href="smb.conf.5.html#SHOWADDPRINTERWIZARD" target="_top"><i><tt>show 
3247         add printer wizard = yes</tt></i></a> (the default).
3248         </p></li></ul></div><p>
3249 In order to be able to use the APW to successfully add a printer to a Samba 
3250 server, the <a href="smb.conf.5.html#ADDPRINTERCOMMAND" target="_top"><i><tt>add 
3251 printer command</tt></i></a> must have a defined value.  The program
3252 hook must successfully add the printer to the system (i.e. 
3253 <tt>/etc/printcap</tt> or appropriate files) and 
3254 <tt>smb.conf</tt> if necessary.
3255 </p><p>
3256 When using the APW from a client, if the named printer share does 
3257 not exist, <b>smbd</b> will execute the <i><tt>add printer 
3258 command</tt></i> and reparse to the <tt>smb.conf</tt>
3259 to attempt to locate the new printer share.  If the share is still not defined,
3260 an error of &quot;Access Denied&quot; is returned to the client.  Note that the 
3261 <i><tt>add printer program</tt></i> is executed under the context
3262 of the connected user, not necessarily a root account.
3263 </p><p>
3264 There is a complementary <a href="smb.conf.5.html#DELETEPRINTERCOMMAND" target="_top"><i><tt>delete
3265 printer command</tt></i></a> for removing entries from the &quot;Printers...&quot;
3266 folder.
3267 </p><p>
3268 The following is an example <a href="smb.conf.5.html#ADDPRINTERCOMMAN" target="_top"><i><tt>add printer command</tt></i></a> script. It adds the appropriate entries to <tt>/etc/printcap.local</tt> (change that to what you need) and returns a line of 'Done' which is needed for the whole process to work.
3269 </p><pre class="programlisting">
3270 #!/bin/sh
3271
3272 # Script to insert a new printer entry into printcap.local
3273 #
3274 # $1, printer name, used as the descriptive name
3275 # $2, share name, used as the printer name for Linux
3276 # $3, port name
3277 # $4, driver name
3278 # $5, location, used for the device file of the printer
3279 # $6, win9x location
3280
3281 #
3282 # Make sure we use the location that RedHat uses for local printer defs
3283 PRINTCAP=/etc/printcap.local
3284 DATE=`date +%Y%m%d-%H%M%S`
3285 LP=lp
3286 RESTART=&quot;service lpd restart&quot;
3287
3288 # Keep a copy
3289 cp $PRINTCAP $PRINTCAP.$DATE
3290 # Add the printer to $PRINTCAP
3291 echo &quot;&quot;                                                       &gt;&gt; $PRINTCAP
3292 echo &quot;$2|$1:\\&quot;                                       &gt;&gt; $PRINTCAP
3293 echo &quot;  :sd=/var/spool/lpd/$2:\\&quot;                     &gt;&gt; $PRINTCAP
3294 echo &quot;  :mx=0:ml=0:sh:\\&quot;                             &gt;&gt; $PRINTCAP
3295 echo &quot;  :lp=/usr/local/samba/var/print/$5.prn:&quot;       &gt;&gt; $PRINTCAP
3296
3297 touch &quot;/usr/local/samba/var/print/$5.prn&quot; &gt;&gt; /tmp/printadd.$$ 2&gt;&amp;1
3298 chown $LP &quot;/usr/local/samba/var/print/$5.prn&quot; &gt;&gt; /tmp/printadd.$$ 2&gt;&amp;1
3299
3300 mkdir /var/spool/lpd/$2
3301 chmod 700 /var/spool/lpd/$2
3302 chown $LP /var/spool/lpd/$2
3303 #echo $1 &gt;&gt; &quot;/usr/local/samba/var/print/$5.prn&quot;
3304 #echo $2 &gt;&gt; &quot;/usr/local/samba/var/print/$5.prn&quot;
3305 #echo $3 &gt;&gt; &quot;/usr/local/samba/var/print/$5.prn&quot;
3306 #echo $4 &gt;&gt; &quot;/usr/local/samba/var/print/$5.prn&quot;
3307 #echo $5 &gt;&gt; &quot;/usr/local/samba/var/print/$5.prn&quot;
3308 #echo $6 &gt;&gt; &quot;/usr/local/samba/var/print/$5.prn&quot;
3309 $RESTART &gt;&gt; &quot;/usr/local/samba/var/print/$5.prn&quot;
3310 # Not sure if this is needed
3311 touch /usr/local/samba/lib/smb.conf
3312 #
3313 # You need to return a value, but I am not sure what it means.
3314 #
3315 echo &quot;Done&quot;
3316 exit 0
3317 </pre></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2870231"></a>Samba and Printer Ports</h3></div></div><p>
3318 Windows NT/2000 print servers associate a port with each printer.  These normally
3319 take the form of LPT1:, COM1:, FILE:, etc...  Samba must also support the
3320 concept of ports associated with a printer.  By default, only one printer port,
3321 named &quot;Samba Printer Port&quot;, exists on a system.  Samba does not really a port in
3322 order to print, rather it is a requirement of Windows clients.  
3323 </p><p>
3324 Note that Samba does not support the concept of &quot;Printer Pooling&quot; internally 
3325 either.  This is when a logical printer is assigned to multiple ports as 
3326 a form of load balancing or fail over.
3327 </p><p>
3328 If you require that multiple ports be defined for some reason,
3329 <tt>smb.conf</tt> possesses a <a href="smb.conf.5.html#ENUMPORTSCOMMAND" target="_top"><i><tt>enumports 
3330 command</tt></i></a> which can be used to define an external program 
3331 that generates a listing of ports on a system.
3332 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2869233"></a>The Imprints Toolset</h2></div></div><p>The Imprints tool set provides a UNIX equivalent of the 
3333         Windows NT Add Printer Wizard.  For complete information, please 
3334         refer to the Imprints web site at <a href="http://imprints.sourceforge.net/" target="_top">
3335         http://imprints.sourceforge.net/</a> as well as the documentation 
3336         included with the imprints source distribution.  This section will 
3337         only provide a brief introduction to the features of Imprints.</p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2869259"></a>What is Imprints?</h3></div></div><p>Imprints is a collection of tools for supporting the goals 
3338                 of</p><div class="itemizedlist"><ul type="disc"><li><p>Providing a central repository information 
3339                         regarding Windows NT and 95/98 printer driver packages</p></li><li><p>Providing the tools necessary for creating 
3340                         the Imprints printer driver packages.</p></li><li><p>Providing an installation client which 
3341                         will obtain and install printer drivers on remote Samba 
3342                         and Windows NT 4 print servers.</p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2870336"></a>Creating Printer Driver Packages</h3></div></div><p>The process of creating printer driver packages is beyond
3343                 the scope of this document (refer to Imprints.txt also included
3344                 with the Samba distribution for more information).  In short,
3345                 an Imprints driver package is a gzipped tarball containing the
3346                 driver files, related INF files, and a control file needed by the
3347                 installation client.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2870355"></a>The Imprints server</h3></div></div><p>The Imprints server is really a database server that 
3348                 may be queried via standard HTTP mechanisms.  Each printer 
3349                 entry in the database has an associated URL for the actual
3350                 downloading of the package.  Each package is digitally signed
3351                 via GnuPG which can be used to verify that package downloaded
3352                 is actually the one referred in the Imprints database.  It is 
3353                 <span class="emphasis"><em>not</em></span> recommended that this security check 
3354                 be disabled.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2870379"></a>The Installation Client</h3></div></div><p>More information regarding the Imprints installation client 
3355                 is available in the <tt>Imprints-Client-HOWTO.ps</tt> 
3356                 file included with the imprints source package.</p><p>The Imprints installation client comes in two forms.</p><div class="itemizedlist"><ul type="disc"><li><p>a set of command line Perl scripts</p></li><li><p>a GTK+ based graphical interface to 
3357                         the command line perl scripts</p></li></ul></div><p>The installation client (in both forms) provides a means
3358                 of querying the Imprints database server for a matching
3359                 list of known printer model names as well as a means to 
3360                 download and install the drivers on remote Samba and Windows
3361                 NT print servers.</p><p>The basic installation process is in four steps and 
3362                 perl code is wrapped around <b>smbclient</b> 
3363                 and <b>rpcclient</b>.</p><pre class="programlisting">   
3364 foreach (supported architecture for a given driver)
3365 {
3366      1.  rpcclient: Get the appropriate upload directory 
3367          on the remote server
3368      2.  smbclient: Upload the driver files
3369      3.  rpcclient: Issues an AddPrinterDriver() MS-RPC
3370 }
3371         
3372 4.  rpcclient: Issue an AddPrinterEx() MS-RPC to actually
3373     create the printer
3374 </pre><p>One of the problems encountered when implementing 
3375                 the Imprints tool set was the name space issues between 
3376                 various supported client architectures.  For example, Windows 
3377                 NT includes a driver named &quot;Apple LaserWriter II NTX v51.8&quot; 
3378                 and Windows 95 calls its version of this driver &quot;Apple 
3379                 LaserWriter II NTX&quot;</p><p>The problem is how to know what client drivers have 
3380                 been uploaded for a printer.  As astute reader will remember 
3381                 that the Windows NT Printer Properties dialog only includes 
3382                 space for one printer driver name.  A quick look in the 
3383                 Windows NT 4.0 system registry at</p><p><tt>HKLM\System\CurrentControlSet\Control\Print\Environment
3384                 </tt></p><p>will reveal that Windows NT always uses the NT driver 
3385                 name.  This is ok as Windows NT always requires that at least 
3386                 the Windows NT version of the printer driver is present.  
3387                 However, Samba does not have the requirement internally.  
3388                 Therefore, how can you use the NT driver name if is has not 
3389                 already been installed?</p><p>The way of sidestepping this limitation is to require 
3390                 that all Imprints printer driver packages include both the Intel 
3391                 Windows NT and 95/98 printer drivers and that NT driver is 
3392                 installed first.</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2869340"></a>Diagnosis</h2></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2869347"></a>Introduction</h3></div></div><p>
3393 This is a short description of how to debug printing problems with
3394 Samba. This describes how to debug problems with printing from a SMB
3395 client to a Samba server, not the other way around. For the reverse
3396 see the examples/printing directory.
3397 </p><p>
3398 Ok, so you want to print to a Samba server from your PC. The first
3399 thing you need to understand is that Samba does not actually do any
3400 printing itself, it just acts as a middleman between your PC client
3401 and your Unix printing subsystem. Samba receives the file from the PC
3402 then passes the file to a external &quot;print command&quot;. What print command
3403 you use is up to you.
3404 </p><p>
3405 The whole things is controlled using options in smb.conf. The most
3406 relevant options (which you should look up in the smb.conf man page)
3407 are:
3408 </p><pre class="programlisting">
3409       [global]
3410         print command     - send a file to a spooler
3411         lpq command       - get spool queue status
3412         lprm command      - remove a job
3413       [printers]
3414         path = /var/spool/lpd/samba
3415 </pre><p>
3416 The following are nice to know about:
3417 </p><pre class="programlisting">
3418         queuepause command   - stop a printer or print queue
3419         queueresume command  - start a printer or print queue
3420 </pre><p>
3421 Example:
3422 </p><pre class="programlisting">
3423         print command = /usr/bin/lpr -r -P%p %s
3424         lpq command   = /usr/bin/lpq    -P%p %s
3425         lprm command  = /usr/bin/lprm   -P%p %j
3426         queuepause command = /usr/sbin/lpc -P%p stop
3427         queuepause command = /usr/sbin/lpc -P%p start
3428 </pre><p>
3429 Samba should set reasonable defaults for these depending on your
3430 system type, but it isn't clairvoyant. It is not uncommon that you
3431 have to tweak these for local conditions.  The commands should
3432 always have fully specified pathnames,  as the smdb may not have
3433 the correct PATH values.
3434 </p><p>
3435 When you send a job to Samba to be printed,  it will make a temporary
3436 copy of it in the directory specified in the [printers] section.
3437 and it should be periodically cleaned out.  The lpr -r option
3438 requests that the temporary copy be removed after printing; If
3439 printing fails then you might find leftover files in this directory,
3440 and it should be periodically cleaned out.  Samba used the lpq
3441 command to determine the &quot;job number&quot; assigned to your print job
3442 by the spooler.
3443 </p><p>
3444 The %&gt;letter&lt; are &quot;macros&quot; that get dynamically replaced with appropriate
3445 values when they are used. The %s gets replaced with the name of the spool
3446 file that Samba creates and the %p gets replaced with the name of the
3447 printer. The %j gets replaced with the &quot;job number&quot; which comes from
3448 the lpq output.
3449 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2870552"></a>Debugging printer problems</h3></div></div><p>
3450 One way to debug printing problems is to start by replacing these
3451 command with shell scripts that record the arguments and the contents
3452 of the print file. A simple example of this kind of things might
3453 be:
3454 </p><pre class="programlisting">
3455         print command = /tmp/saveprint %p %s
3456
3457     #!/bin/saveprint
3458     # we make sure that we are the right user
3459     /usr/bin/id -p &gt;/tmp/tmp.print
3460     # we run the command and save the error messages
3461     # replace the command with the one appropriate for your system
3462     /usr/bin/lpr -r -P$1 $2 2&gt;&gt;&amp;/tmp/tmp.print
3463 </pre><p>
3464 Then you print a file and try removing it.  You may find that the
3465 print queue needs to be stopped in order to see the queue status
3466 and remove the job:
3467 </p><pre class="programlisting">
3468
3469 h4: {42} % echo hi &gt;/tmp/hi
3470 h4: {43} % smbclient //localhost/lw4
3471 added interface ip=10.0.0.4 bcast=10.0.0.255 nmask=255.255.255.0
3472 Password: 
3473 Domain=[ASTART] OS=[Unix] Server=[Samba 2.0.7]
3474 smb: \&gt; print /tmp/hi
3475 putting file /tmp/hi as hi-17534 (0.0 kb/s) (average 0.0 kb/s)
3476 smb: \&gt; queue
3477 1049     3            hi-17534
3478 smb: \&gt; cancel 1049
3479 Error cancelling job 1049 : code 0
3480 smb: \&gt; cancel 1049
3481 Job 1049 cancelled
3482 smb: \&gt; queue
3483 smb: \&gt; exit
3484 </pre><p>
3485 The 'code 0' indicates that the job was removed.  The comment
3486 by the  smbclient is a bit misleading on this.
3487 You can observe the command output and then and look at the
3488 /tmp/tmp.print file to see what the results are.  You can quickly
3489 find out if the problem is with your printing system.  Often people
3490 have problems with their /etc/printcap file or permissions on
3491 various print queues.
3492 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2870619"></a>What printers do I have?</h3></div></div><p>
3493 You can use the 'testprns' program to check to see if the printer
3494 name you are using is recognized by Samba.  For example,  you can
3495 use:
3496 </p><pre class="programlisting">
3497     testprns printer /etc/printcap
3498 </pre><p>
3499 Samba can get its printcap information from a file or from a program.
3500 You can try the following to see the format of the extracted
3501 information:
3502 </p><pre class="programlisting">
3503     testprns -a printer /etc/printcap
3504
3505     testprns -a printer '|/bin/cat printcap'
3506 </pre></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2870661"></a>Setting up printcap and print servers</h3></div></div><p>
3507 You may need to set up some printcaps for your Samba system to use.
3508 It is strongly recommended that you use the facilities provided by
3509 the print spooler to set up queues and printcap information.
3510 </p><p>
3511 Samba requires either a printcap or program to deliver printcap
3512 information.  This printcap information has the format:
3513 </p><pre class="programlisting">
3514   name|alias1|alias2...:option=value:...
3515 </pre><p>
3516 For almost all printing systems, the printer 'name' must be composed
3517 only of alphanumeric or underscore '_' characters.  Some systems also
3518 allow hyphens ('-') as well.  An alias is an alternative name for the
3519 printer,  and an alias with a space in it is used as a 'comment'
3520 about the printer.  The printcap format optionally uses a \ at the end of lines
3521 to extend the printcap to multiple lines.
3522 </p><p>
3523 Here are some examples of printcap files:
3524 </p><p>
3525 </p><div class="orderedlist"><ol type="1"><li><p>
3526 pr              just printer name
3527 </p></li><li><p>
3528 pr|alias        printer name and alias
3529 </p></li><li><p>
3530 pr|My Printer   printer name, alias used as comment
3531 </p></li><li><p>
3532 pr:sh:\        Same as pr:sh:cm= testing
3533   :cm= \ 
3534   testing
3535 </p></li><li><p>
3536 pr:sh           Same as pr:sh:cm= testing
3537   :cm= testing
3538 </p></li></ol></div><p>
3539 </p><p>
3540 Samba reads the printcap information when first started.  If you make
3541 changes in the printcap information, then you must do the following:
3542 </p><div class="orderedlist"><ol type="1"><li><p>
3543 make sure that the print spooler is aware of these changes.
3544 The LPRng system uses the 'lpc reread' command to do this.
3545 </p></li><li><p>
3546 make sure that the spool queues, etc., exist and have the
3547 correct permissions.  The LPRng system uses the 'checkpc -f'
3548 command to do this.
3549 </p></li><li><p>
3550 You now should send a SIGHUP signal to the smbd server to have
3551 it reread the printcap information.
3552 </p></li></ol></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2870795"></a>Job sent, no output</h3></div></div><p>
3553 This is the most frustrating part of printing.  You may have sent the
3554 job,  verified that the job was forwarded,  set up a wrapper around
3555 the command to send the file,  but there was no output from the printer.
3556 </p><p>
3557 First,  check to make sure that the job REALLY is getting to the
3558 right print queue.  If you are using a BSD or LPRng print spooler,
3559 you can temporarily stop the printing of jobs.  Jobs can still be
3560 submitted, but they will not be printed.  Use:
3561 </p><pre class="programlisting">
3562   lpc -Pprinter stop
3563 </pre><p>
3564 Now submit a print job and then use 'lpq -Pprinter' to see if the
3565 job is in the print queue.  If it is not in the print queue then
3566 you will have to find out why it is not being accepted for printing.
3567 </p><p>
3568 Next, you may want to check to see what the format of the job really
3569 was.  With the assistance of the system administrator you can view
3570 the submitted jobs files.  You may be surprised to find that these
3571 are not in what you would expect to call a printable format.
3572 You can use the UNIX 'file' utitily to determine what the job
3573 format actually is:
3574 </p><pre class="programlisting">
3575     cd /var/spool/lpd/printer   # spool directory of print jobs
3576     ls                          # find job files
3577     file dfA001myhost
3578 </pre><p>
3579 You should make sure that your printer supports this format OR that
3580 your system administrator has installed a 'print filter' that will
3581 convert the file to a format appropriate for your printer.
3582 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2871344"></a>Job sent, strange output</h3></div></div><p>
3583 Once you have the job printing, you can then start worrying about
3584 making it print nicely.
3585 </p><p>
3586 The most common problem is extra pages of output: banner pages
3587 OR blank pages at the end.
3588 </p><p>
3589 If you are getting banner pages,  check and make sure that the
3590 printcap option or printer option is configured for no banners.
3591 If you have a printcap,  this is the :sh (suppress header or banner
3592 page) option.  You should have the following in your printer.
3593 </p><pre class="programlisting">
3594    printer: ... :sh
3595 </pre><p>
3596 If you have this option and are still getting banner pages,  there
3597 is a strong chance that your printer is generating them for you
3598 automatically.  You should make sure that banner printing is disabled
3599 for the printer.  This usually requires using the printer setup software
3600 or procedures supplied by the printer manufacturer.
3601 </p><p>
3602 If you get an extra page of output,  this could be due to problems
3603 with your job format,  or if you are generating PostScript jobs,
3604 incorrect setting on your printer driver on the MicroSoft client.
3605 For example, under Win95 there is a option:
3606 </p><pre class="programlisting">
3607   Printers|Printer Name|(Right Click)Properties|Postscript|Advanced|
3608 </pre><p>
3609 that allows you to choose if a Ctrl-D is appended to all jobs.
3610 This is a very bad thing to do, as most spooling systems will
3611 automatically add a ^D to the end of the job if it is detected as
3612 PostScript.  The multiple ^D may cause an additional page of output.
3613 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2871420"></a>Raw PostScript printed</h3></div></div><p>
3614 This is a problem that is usually caused by either the print spooling
3615 system putting information at the start of the print job that makes
3616 the printer think the job is a text file, or your printer simply
3617 does not support PostScript.  You may need to enable 'Automatic
3618 Format Detection' on your printer.
3619 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2871438"></a>Advanced Printing</h3></div></div><p>
3620 Note that you can do some pretty magic things by using your
3621 imagination with the &quot;print command&quot; option and some shell scripts.
3622 Doing print accounting is easy by passing the %U option to a print
3623 command shell script. You could even make the print command detect
3624 the type of output and its size and send it to an appropriate
3625 printer.
3626 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2871464"></a>Real debugging</h3></div></div><p>
3627 If the above debug tips don't help, then maybe you need to bring in
3628 the bug guns, system tracing. See Tracing.txt in this directory.
3629 </p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="CUPS-printing"></a>Chapter 14. CUPS Printing Support</h2></div><div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Kurt Pfeifle</h3><div class="affiliation"><div class="address"><p><tt>&lt;<a href="mailto:kpfeifle@danka.de">kpfeifle@danka.de</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate"> (25 March 2003) </p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2871008">Introduction</a></dt><dt><a href="#id2871067">Configuring smb.conf for CUPS</a></dt><dt><a href="#id2871607">CUPS - RAW Print Through Mode</a></dt><dt><a href="#id2871091">CUPS as a network PostScript RIP</a></dt><dt><a href="#id2872272">Windows Terminal Servers (WTS) as CUPS clients</a></dt><dt><a href="#id2872314">Setting up CUPS for driver download</a></dt><dt><a href="#id2872401">Sources of CUPS drivers / PPDs</a></dt><dd><dl><dt><a href="#id2872566">cupsaddsmb</a></dt></dl></dd><dt><a href="#id2872915">The CUPS Filter Chains</a></dt><dt><a href="#id2873302">CUPS Print Drivers and Devices</a></dt><dd><dl><dt><a href="#id2873339">Further printing steps</a></dt></dl></dd><dt><a href="#id2873758">Limiting the number of pages users can print</a></dt><dt><a href="#id2874367">Advanced Postscript Printing from MS Windows</a></dt><dt><a href="#id2874473">Auto-Deletion of CUPS spool files</a></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2871008"></a>Introduction</h2></div></div><p>
3630 The Common Unix Print System (CUPS) has become very popular, but to many it is
3631 a very mystical tool. There is a great deal of uncertainty regarding CUPS and how
3632 it works. The result is seen in a large number of posting on the samba mailing lists
3633 expressing frustration when MS Windows printers appear not to work with a CUPS
3634 backr-end.
3635 </p><p>
3636 This is a good time to point out how CUPS can be used and what it does. CUPS is more
3637 than just a print spooling system - it is a complete printer management system that
3638 complies with HTTP and IPP protocols. It can be managed remotely via a web browser
3639 and it can print using http and ipp protocols.
3640 </p><p>
3641 CUPS allows to creation of RAW printers (ie: NO file format translation) as well as
3642 SMART printers (ie: CUPS does file format conversion as required for the printer). In
3643 many ways this gives CUPS similar capabilities to the MS Windows print monitoring
3644 system. Of course, if you are a CUPS advocate, you would agrue that CUPS is better!
3645 In any case, let us now move on to explore how one may configure CUPS for interfacing
3646 with MS Windows print clients via Samba.
3647 </p><p>
3648 <a href="http://www.cups.org/" target="_top">CUPS</a> is a newcomer in the UNIX printing scene,
3649 which has convinced many people upon first trial already. However, it has quite a few
3650 new features, which make it different from other, more traditional printing systems.
3651 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2871067"></a>Configuring <tt>smb.conf</tt> for CUPS</h2></div></div><p>
3652 Printing with CUPS in the most basic <tt>smb.conf</tt>
3653 setup in Samba-3  only needs two settings: <b>printing = cups</b> and
3654 <b>printcap = cups</b>. While CUPS itself doesn't need a printcap
3655 anymore, the <tt>cupsd.conf</tt> configuration file knows two directives
3656 (example: <b>Printcap /etc/printcap</b> and <b>PrintcapFormat
3657 BSD</b>), which control if such a file should be created for the
3658 convenience of third party applications. Make sure it is set! For details see
3659 <b>man cupsd.conf</b> and other CUPS-related documentation.
3660 </p><p>
3661 If SAMBA is compiled against libcups, then <b>printcap = cups</b> uses the
3662 CUPS API to list printers, submit jobs, etc. Otherwise it maps to the System V commands
3663 with an additional <i><tt>-oraw</tt></i> option for printing. On a Linux system,
3664 you can use the <b>ldd</b> command to find out details (ldd may not be
3665 present on other OS platforms, or its function may be embodied by a different command):
3666 </p><p>
3667 </p><pre class="programlisting">transmeta:/home/kurt # ldd `which smbd`
3668         libssl.so.0.9.6 =&gt; /usr/lib/libssl.so.0.9.6 (0x4002d000)
3669         libcrypto.so.0.9.6 =&gt; /usr/lib/libcrypto.so.0.9.6 (0x4005a000)
3670         libcups.so.2 =&gt; /usr/lib/libcups.so.2 (0x40123000)
3671         libdl.so.2 =&gt; /lib/libdl.so.2 (0x401e8000)
3672         libnsl.so.1 =&gt; /lib/libnsl.so.1 (0x401ec000)
3673         libpam.so.0 =&gt; /lib/libpam.so.0 (0x40202000)
3674         libc.so.6 =&gt; /lib/libc.so.6 (0x4020b000)
3675         /lib/ld-linux.so.2 =&gt; /lib/ld-linux.so.2 (0x40000000)
3676 </pre><p>
3677 The line &quot;libcups.so.2 =&gt; /usr/lib/libcups.so.2
3678 (0x40123000)&quot; shows there is CUPS support compiled into this version of
3679 Samba. If this is the case, and <b>printing = cups</b> is set, then any
3680 otherwise manually set print command in <tt>smb.conf</tt> is ignored.
3681 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2871607"></a>CUPS - RAW Print Through Mode</h2></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
3682 When used in raw print through mode is will be necessary to use the printer
3683 vendor's drivers in each Windows client PC.
3684 </p></div><p>
3685 When CUPS printers are configured for RAW print-through mode operation it is the
3686 responsibility of the Samba client to fully render the print job (file) in a format
3687 that is suitable for direct delivery to the printer. In this case CUPS will NOT
3688 do any print file format conversion work.
3689 </p><p>
3690 The CUPS files that need to be correctly set for RAW mode printers to work are:
3691
3692 </p><div class="itemizedlist"><ul type="disc"><li><p><tt>/etc/cups/mime.types</tt></p></li><li><p><tt>/etc/cups/mime.convs</tt></p></li></ul></div><p>
3693
3694 Both contain entries that must be uncommented to allow <span class="emphasis"><em>RAW</em></span> mode
3695 operation.
3696 </p><p>
3697 Firstly, to enable CUPS based printing from Samba the following options must be
3698 enabled in your <tt>smb.conf</tt> file [globals] section:
3699
3700 </p><div class="itemizedlist"><ul type="disc"><li><p>printing = CUPS</p></li><li><p>printcap = CUPS</p></li></ul></div><p>
3701
3702 When these parameters are specified the print directives in <tt>smb.conf</tt> (as well as in
3703 samba itself) will be ignored because samba will directly interface with CUPS through
3704 it's application program interface (API) - so long as Samba has been compiled with
3705 CUPS library (libcups) support. If samba has NOT been compiled with CUPS support then
3706 printing will use the System V AT&amp;T command set with the <span class="emphasis"><em>-oraw</em></span> 
3707 option automatically passing through.
3708 </p><p>
3709 Cupsomatic (an enhanced printing utility that is part of some CUPS implementations) 
3710 on the Samba/CUPS server does *not* add any features if a file is really
3711 printed &quot;raw&quot;.  However, if you have loaded the driver for the Windows client from
3712 the CUPS server, using the &quot;cupsaddsmb&quot; utility, and if this driver is one using
3713 a &quot;Foomatic&quot; PPD, the PJL header in question is already added on the Windows client,
3714 at the time when the driver initially generated the PostScript data and CUPS in true
3715 &quot;-oraw&quot; manner doesn't remove this PJL header and passes the file &quot;as is&quot; to its
3716 printer communication backend.
3717 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>NOTE: editing in the &quot;mime.convs&quot; and the &quot;mime.types&quot; file does not *enforce*
3718 &quot;raw&quot; printing, it only *allows* it.</p></div><p>
3719 Print files that arrive from MS Windows printing are &quot;auto-typed&quot; by CUPS. This aids
3720 the process of determining proper treatment while in the print queue system.
3721
3722 </p><div class="itemizedlist"><ul type="disc"><li><p>
3723         Files generated by PCL drivers and directed at PCK printers get auto-typed as
3724         <tt>application/octet-stream</tt>. Unknown file format types also
3725         get auto-typed with this tag.
3726         </p></li><li><p>
3727         Files generated by a Postscript driver and directed at a Postscript printer
3728         are auto-typed depending on the auto-detected most suitable MIME type as:
3729
3730         </p><div class="itemizedlist"><ul type="circle"><li><p>* application/postscript</p></li><li><p>* application/vnd.cups-postscript</p></li></ul></div><p>
3731         </p></li></ul></div><p>
3732 </p><p>
3733 &quot;application/postscript&quot; first goes thru the &quot;pstops&quot; filter (where the page counting
3734 and accounting takes place). The outcome will be of MIME type
3735 &quot;application/vnd.cups-postscript&quot;. The pstopsfilter reads and uses information from
3736 the PPD and inserts user-provided options into the PostScript file. As a consequence,
3737 the filtered file could possibly have an unwanted PJL header.
3738 </p><p>
3739 &quot;application/postscript&quot; will be all files with a &quot;.ps&quot;, &quot;.ai&quot;, &quot;.eps&quot; suffix or which
3740 have as their first character string one of &quot;%!&quot; or &quot;&gt;04&lt;%&quot;.
3741 </p><p>
3742 &quot;application/vnd.cups-postscript&quot; will files which contain the string
3743 &quot;LANGUAGE=POSTSCRIPT&quot; (or similar variations with different capitalization) in the
3744 first 512 bytes, and also contain the &quot;PJL super escape code&quot; in the first 128 bytes
3745 (&quot;&gt;1B&lt;%-12345X&quot;). Very likely, most PostScript files generated on Windows using a CUPS
3746 or other PPD, will have to be auto-typed as &quot;vnd.cups-postscript&quot;.  A file produced
3747 with a &quot;Generic PostScript driver&quot; will just be tagged &quot;application/postscript&quot;.
3748 </p><p>
3749 Once the file is in &quot;application/vnd.cups-postscript&quot; format, either &quot;pstoraster&quot;
3750 or &quot;cupsomatic&quot; will take over (depending on the printer configuration, as
3751 determined by the PPD in use).
3752 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
3753 A printer queue with *no* PPD associated to it is a &quot;raw&quot; printer and all files
3754 will go directly there as received by the spooler. The exeptions are file types
3755 &quot;application/octet-stream&quot; which need &quot;passthrough feature&quot; enabled.
3756 &quot;Raw&quot; queues don't do any filtering at all, they hand the file directly to the
3757 CUPS backend. This backend is responsible for the sending of the data to the device
3758 (as in the &quot;device URI&quot; notation as lpd://, socket://, smb://, ipp://, http://,
3759 parallel:/, serial:/, usb:/ etc.)
3760 </p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
3761 &quot;cupsomatic&quot;/Foomatic are *not* native CUPS drivers and they don't ship with CUPS.
3762 They are a Third Party add-on, developed at Linuxprinting.org.  As such, they are
3763 a brilliant hack to make all models (driven by Ghostscript drivers/filters in
3764 traditional spoolers) also work via CUPS, with the same (good or bad!) quality
3765 as in these other spoolers. &quot;cupsomatic&quot; is only a vehicle to execute a ghostscript
3766 commandline at that stage in the CUPS filtering chain, where &quot;normally&quot; the native
3767 CUPS &quot;pstoraster&quot; filter would kick in.  cupsomatic by-passes pstoraster, &quot;kidnaps&quot;
3768 the printfile from CUPS away and re-directs it to go through Ghostscipt. CUPS accepts this,
3769 because the associated CUPS-O-Matic-/Foomatic-PPD specifies:
3770 </p><pre class="programlisting">
3771    *cupsFilter:  &quot;application/vnd.cups-postscript 0 cupsomatic&quot;
3772 </pre><p>
3773 This line persuades CUPS to hand the file to cupsomatic, once it has successfully
3774 converted it to the MIME type &quot;application/vnd.cups-postscript&quot;. This conversion will not
3775 happen for Jobs arriving from Windows which are auto-typed &quot;application/octet-stream&quot;,
3776 with the according changes in &quot;/etc/cups/mime.types&quot; in place.
3777 </p></div><p>
3778 CUPS is widely configurable and flexible, even regarding its filtering mechanism.
3779 Another workaround in some situations would be to have
3780 in &quot;/etc/cups/mime.types&quot; entries as follows:
3781 </p><pre class="programlisting">
3782    application/postscript           application/vnd.cups-raw  0  -
3783    application/vnd.cups-postscript  application/vnd.cups-raw  0  -
3784 </pre><p>
3785 This would prevent all Postscript files from being filtered (rather, they will go
3786 thru the virtual &quot;nullfilter&quot; denoted with &quot;-&quot;). This could only be useful for
3787 PS printers. If you want to print PS code on non-PS printers an entry as follows
3788 could be useful:
3789 </p><pre class="programlisting">
3790    */*           application/vnd.cups-raw  0  -
3791 </pre><p>
3792 and would effectively send *all* files to the backend without further processing.
3793 </p><p>
3794 Lastly, you could have the following entry:
3795 </p><pre class="programlisting">
3796    application/vnd.cups-postscript  application/vnd.cups-raw  0  my_PJL_stripping_filter
3797 </pre><p>
3798 You will need to write a &quot;my_PJL_stripping_filter&quot; (could be a shellscript) that
3799 parses the PostScript and removes the unwanted PJL. This would need to conform to
3800 CUPS filter design (mainly, receive and pass the parameters printername, job-id,
3801 username, jobtitle, copies, print options and possibly the filename). It would
3802 be installed as world executable into &quot;/usr/lib/cups/filters/&quot; and will be called
3803 by CUPS if it encounters a MIME type &quot;application/vnd.cups-postscript&quot;.
3804 </p><p>
3805 CUPS can handle &quot;-o job-hold-until=indefinite&quot;. This keeps the job in the queue
3806 &quot;on hold&quot;. It will only be printed upon manual release by the printer operator.
3807 This is a requirement in many &quot;central reproduction departments&quot;, where a few
3808 operators manage the jobs of hundreds of users on some big machine, where no
3809 user is allowed to have direct access. (The operators often need to load the
3810 proper paper type before running the 10.000 page job requested by marketing
3811 for the mailing, etc.).
3812 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2871091"></a>CUPS as a network PostScript RIP</h2></div></div><p>
3813 This is the configuration where CUPS drivers are working on server, and where the
3814 Adobe PostScript driver with CUPS-PPDs is downloaded to clients.
3815 </p><p>
3816 CUPS is perfectly able to use PPD files (PostScript
3817 Printer Descriptions). PPDs can control all print device options. They
3818 are usually provided by the manufacturer -- if you own a PostSript printer,
3819 that is. PPD files are always a component of PostScript printer drivers on MS
3820 Windows or Apple Mac OS systems. They are ASCII files containing
3821 user-selectable print options, mapped to appropriate PostScript, PCL or PJL
3822 commands for the target printer. Printer driver GUI dialogs translate these
3823 options &quot;on-the-fly&quot; into buttons and drop-down lists for the user to
3824 select.
3825 </p><p>
3826 CUPS can load, without any conversions, the PPD file from
3827 any Windows (NT is recommended) PostScript driver and handle the options.
3828 There is a web browser interface to the print options (select
3829 http://localhost:631/printers/ and click on one &quot;Configure Printer&quot; button
3830 to see it), a commandline interface (see <b>man lpoptions</b> or
3831 try if you have <b>lphelp</b> on your system) plus some different GUI frontends on Linux
3832 UNIX, which can present PPD options to the users. PPD options are normally
3833 meant to become evaluated by the PostScript RIP on the real PostScript
3834 printer.
3835 </p><p>
3836 CUPS doesn't stop at &quot;real&quot; PostScript printers in its
3837 usage of PPDs. The CUPS developers have extended the PPD concept, to also
3838 describe available device and driver options for non-PostScript printers
3839 through  CUPS-PPDs.
3840 </p><p>
3841 This is logical, as CUPS includes a fully featured
3842 PostScript interpreter (RIP). This RIP is based on Ghostscript. It can
3843 process all received PostScript (and additionally many other file formats)
3844 from clients. All CUPS-PPDs geared to non-PostScript printers contain an
3845 additional line, starting with the keyword <i><tt>*cupsFilter</tt></i>.
3846 This line
3847 tells the CUPS print system which printer-specific filter to use for the
3848 interpretation of the accompanying PostScript. Thus CUPS lets all its
3849 printers appear as PostScript devices to its clients, because it can act as a
3850 PostScript RIP for those printers, processing the received PostScript code
3851 into a proper raster print format.
3852 </p><p>
3853 CUPS-PPDs can also be used on Windows-Clients, on top of a
3854 PostScript driver (recommended is the Adobe one).
3855 </p><p>
3856 This feature enables CUPS to do a few tricks no other
3857 spooler can do:
3858 </p><div class="itemizedlist"><ul type="disc"><li><p>act as a networked PostScript RIP (Raster Image Processor), handling
3859     printfiles from all client platforms in a uniform way;</p></li><li><p>act as a central accounting and billing server, as all files are passed
3860     through the <b>pstops</b> Filter and are therefor logged in
3861     the CUPS <tt>page_log</tt>. - <span class="emphasis"><em>NOTE: </em></span>this
3862     can not happen with &quot;raw&quot; print jobs, which always remain unfiltered
3863     per definition;</p></li><li><p>enable clients to consolidate on a single PostScript driver, even for
3864     many different target printers.</p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2872272"></a>Windows Terminal Servers (WTS) as CUPS clients</h2></div></div><p>
3865 This setup may be of special interest to people
3866 experiencing major problems in WTS environments. WTS need often a multitude
3867 of non-PostScript drivers installed to run their clients' variety of
3868 different printer models. This often imposes the price of much increased
3869 instability. In many cases, in an attempt to overcome this problem, site
3870 administrators have resorted to restrict the allowed drivers installed on
3871 their WTS to one generic PCL- and one PostScript driver. This however
3872 restricts the clients in the amount of printer options available for them --
3873 often they can't get out more then simplex prints from one standard paper
3874 tray, while their devices could do much better, if driven by a different
3875 driver!
3876 </p><p>
3877 Using an Adobe PostScript driver, enabled with a CUPS-PPD,
3878 seems to be a very elegant way to overcome all these shortcomings. The
3879 PostScript driver is not known to cause major stability problems on WTS (even
3880 if used with many different PPDs). The clients will be able to (again) chose
3881 paper trays, duplex printing and other settings. However, there is a certain
3882 price for this too: a  CUPS server acting as a PostScript RIP for its clients
3883 requires more CPU and RAM than just to act as  a &quot;raw spooling&quot; device. Plus,
3884 this setup is not yet widely tested, although the first feedbacks look very
3885 promising...
3886 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2872314"></a>Setting up CUPS for driver download</h2></div></div><p>
3887 The <b>cupsadsmb</b> utility (shipped with all current
3888 CUPS versions) makes the sharing of any (or all) installed CUPS printers very
3889 easy. Prior to using it, you need the following settings in <tt>smb.conf</tt>:
3890 </p><pre class="programlisting">[global]
3891                  load printers = yes
3892                  printing = cups
3893                  printcap name = cups
3894
3895         [printers]
3896                  comment = All Printers
3897                  path = /var/spool/samba
3898                  browseable = no
3899                  public = yes
3900                  guest ok = yes
3901                  writable = no
3902                  printable = yes
3903                  printer admin = root
3904
3905         [print$]
3906                  comment = Printer Drivers
3907                  path = /etc/samba/drivers
3908                  browseable = yes
3909                  guest ok = no
3910                  read only = yes
3911                  write list = root
3912         </pre><p>
3913 For licensing reasons the necessary files of the Adobe
3914 Postscript driver can not be distributed with either Samba or CUPS. You need
3915 to download them yourself from the Adobe website. Once extracted, create a
3916 <tt>drivers</tt> directory in the CUPS data directory (usually
3917 <tt>/usr/share/cups/</tt>). Copy the Adobe files using
3918 UPPERCASE filenames, to this directory as follows:
3919 </p><pre class="programlisting">
3920                 ADFONTS.MFM
3921                 ADOBEPS4.DRV
3922                 ADOBEPS4.HLP
3923                 ADOBEPS5.DLL
3924                 ADOBEPSU.DLL
3925                 ADOBEPSU.HLP
3926                 DEFPRTR2.PPD
3927                 ICONLIB.DLL
3928         </pre><p>
3929 Users of the ESP Print Pro software are able to install
3930 their &quot;Samba Drivers&quot; package for this purpose with no problem.
3931 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2872401"></a>Sources of CUPS drivers / PPDs</h2></div></div><p>
3932 On the internet you can find now many thousand CUPS-PPD
3933 files (with their companion filters), in many national languages,
3934 supporting more than 1.000 non-PostScript models.
3935 </p><div class="itemizedlist"><ul type="disc"><li><p><a href="http://wwwl.easysw.com/printpro/" target="_top">ESP PrintPro
3936     (http://wwwl.easysw.com/printpro/)</a>
3937     (commercial, non-Free) is packaged with more than 3.000 PPDs, ready for
3938     successful usage &quot;out of the box&quot; on Linux, IBM-AIX, HP-UX, Sun-Solaris,
3939     SGI-IRIX, Compaq Tru64, Digital Unix and some more commercial Unices (it
3940     is written by the CUPS developers themselves and its sales help finance
3941     the further development of CUPS, as they feed their creators)</p></li><li><p>the <a href="http://gimp-print.sourceforge.net/" target="_top">Gimp-Print-Project
3942     (http://gimp-print.sourceforge.net/)</a>
3943     (GPL, Free Software) provides around 120 PPDs (supporting nearly 300
3944     printers, many driven to photo quality output), to be used alongside the
3945     Gimp-Print CUPS filters;</p></li><li><p><a href="http://www.turboprint.com/" target="_top">TurboPrint
3946     (http://www.turboprint.com/)</a>
3947     (Shareware, non-Freee) supports roughly the same amount of printers in
3948     excellent quality;</p></li><li><p><a href="http://www-124.ibm.com/developerworks/oss/linux/projects/omni/" target="_top">OMNI
3949     (http://www-124.ibm.com/developerworks/oss/linux/projects/omni/)</a>
3950     (LPGL, Free) is a package made by IBM, now containing support for more
3951     than 400 printers, stemming from the inheritance of IBM OS/2 KnowHow
3952     ported over to Linux (CUPS support is in a Beta-stage at present);</p></li><li><p><a href="http://hpinkjet.sourceforge.net/" target="_top">HPIJS
3953     (http://hpinkjet.sourceforge.net/)</a>
3954     (BSD-style licnes, Free) supports around 120 of HP's own printers and is
3955     also providing excellent print quality now;</p></li><li><p><a href="http://www.linuxprinting.org/" target="_top">Foomatic/cupsomatic (http://www.linuxprinting.org/)</a>
3956     (LPGL, Free) from Linuxprinting.org are providing PPDs for practically every
3957     Ghostscript filter known to the world, now usable with CUPS.</p></li></ul></div><p>
3958 <span class="emphasis"><em>NOTE: </em></span>the cupsomatic trick from Linuxprinting.org is
3959 working different from the other drivers. While the other drivers take the
3960 generic CUPS raster (produced by CUPS' own pstoraster PostScript RIP) as
3961 their input, cupsomatic &quot;kidnaps&quot; the PostScript inside CUPS, before
3962 RIP-ping, deviates it to an external Ghostscript installation (which now
3963 becomes the RIP) and gives it back to a CUPS backend once Ghostscript is
3964 finished. -- CUPS versions from 1.1.15 and later will provide their pstoraster
3965 PostScript RIP function again inside a system-wide Ghostscript
3966 installation rather than in &quot;their own&quot; pstoraster filter. (This
3967 CUPS-enabling Ghostscript version may be installed either as a
3968 patch to GNU or AFPL Ghostscript, or as a complete ESP Ghostscript package).
3969 However, this will not change the cupsomatic approach of guiding the printjob
3970 along a different path through the filtering system than the standard CUPS
3971 way...
3972 </p><p>
3973 Once you installed a printer inside CUPS with one of the
3974 recommended methods (the lpadmin command, the web browser interface or one of
3975 the available GUI wizards), you can use <b>cupsaddsmb</b> to share the
3976 printer via Samba. <b>cupsaddsmb</b> prepares the driver files for
3977 comfortable client download and installation upon their first contact with
3978 this printer share.
3979 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2872566"></a><b>cupsaddsmb</b></h3></div></div><p>
3980 The <b>cupsaddsmb</b> command copies the needed files
3981 for convenient Windows client installations from the previously prepared CUPS
3982 data directory to your [print$] share. Additionally, the PPD
3983 associated with this printer is copied from <tt>/etc/cups/ppd/</tt> to
3984 [print$].
3985 </p><pre class="programlisting">
3986 <tt>root# </tt> <b>cupsaddsmb -U root infotec_IS2027</b>
3987 Password for root required to access localhost via
3988 SAMBA: <b><tt>[type in password 'secret']</tt></b>
3989 </pre><p>
3990 To share all printers and drivers, use the <i><tt>-a</tt></i>
3991 parameter instead of a printer name.
3992 </p><p>
3993 Probably you want to see what's going on. Use the
3994 <i><tt>-v</tt></i> parameter to get a more verbose output:
3995 </p><p>
3996 Probably you want to see what's going on. Use the
3997 <i><tt>-v</tt></i> parameter to get a more verbose output:
3998 </p><pre class="programlisting">
3999 Note: The following line shave been wrapped so that information is not lost.
4000  
4001 <tt>root# </tt> cupsaddsmb -v -U root infotec_IS2027
4002     Password for root required to access localhost via SAMBA:
4003     Running command: smbclient //localhost/print\$ -N -U'root%secret' -c 'mkdir W32X86;put
4004        /var/spool/cups/tmp/3cd1cc66376c0 W32X86/infotec_IS2027.PPD;put
4005        /usr/share/cups/drivers/
4006        ADOBEPS5.DLL W32X86/ADOBEPS5.DLL;put /usr/share/cups/drivers/ADOBEPSU.DLLr
4007        W32X86/ADOBEPSU.DLL;put /usr/share/cups/drivers/ADOBEPSU.HLP W32X86/ADOBEPSU.HLP'
4008     added interface ip=10.160.16.45 bcast=10.160.31.255 nmask=255.255.240.0
4009     added interface ip=192.168.182.1 bcast=192.168.182.255 nmask=255.255.255.0
4010     added interface ip=172.16.200.1 bcast=172.16.200.255 nmask=255.255.255.0
4011     Domain=[TUX-NET] OS=[Unix] Server=[Samba 2.2.3a.200204262025cvs]
4012     NT_STATUS_OBJECT_NAME_COLLISION making remote directory \W32X86
4013     putting file /var/spool/cups/tmp/3cd1cc66376c0 as
4014       \W32X86/infotec_IS2027.PPD (17394.6 kb/s) (average 17395.2 kb/s)
4015     putting file /usr/share/cups/drivers/ADOBEPS5.DLL as
4016       \W32X86/ADOBEPS5.DLL (10877.4 kb/s) (average 11343.0 kb/s)
4017     putting file /usr/share/cups/drivers/ADOBEPSU.DLL as
4018       \W32X86/ADOBEPSU.DLL (5095.2 kb/s) (average 9260.4 kb/s)
4019     putting file /usr/share/cups/drivers/ADOBEPSU.HLP as
4020       \W32X86/ADOBEPSU.HLP (8828.7 kb/s) (average 9247.1 kb/s)
4021
4022     Running command: smbclient //localhost/print\$ -N -U'root%secret' -c 'mkdir WIN40;put
4023       /var/spool/cups/tmp/3cd1cc66376c0 WIN40/infotec_IS2027.PPD;put
4024       /usr/share/cups/drivers/ADFONTS.MFM WIN40/ADFONTS.MFM;put
4025       /usr/share/cups/drivers/ADOBEPS4.DRV WIN40/ADOBEPS4.DRV;put
4026       /usr/share/cups/drivers/ADOBEPS4.HLP WIN40/ADOBEPS4.HLP;put
4027       /usr/share/cups/drivers/DEFPRTR2.PPD WIN40/DEFPRTR2.PPD;put
4028       /usr/share/cups/drivers/ICONLIB.DLL WIN40/ICONLIB.DLL;put
4029       /usr/share/cups/drivers/PSMON.DLL WIN40/PSMON.DLL;'
4030     added interface ip=10.160.16.45 bcast=10.160.31.255 nmask=255.255.240.0
4031     added interface ip=192.168.182.1 bcast=192.168.182.255 nmask=255.255.255.0
4032     added interface ip=172.16.200.1 bcast=172.16.200.255 nmask=255.255.255.0
4033     Domain=[TUX-NET] OS=[Unix] Server=[Samba 2.2.3a.200204262025cvs]
4034     NT_STATUS_OBJECT_NAME_COLLISION making remote directory \WIN40
4035     putting file /var/spool/cups/tmp/3cd1cc66376c0 as
4036       \WIN40/infotec_IS2027.PPD (26091.5 kb/s) (average 26092.8 kb/s)
4037     putting file /usr/share/cups/drivers/ADFONTS.MFM as
4038       \WIN40/ADFONTS.MFM (11241.6 kb/s) (average 11812.9 kb/s)
4039     putting file /usr/share/cups/drivers/ADOBEPS4.DRV as
4040       \WIN40/ADOBEPS4.DRV (16640.6 kb/s) (average 14679.3 kb/s)
4041     putting file /usr/share/cups/drivers/ADOBEPS4.HLP as
4042       \WIN40/ADOBEPS4.HLP (11285.6 kb/s) (average 14281.5 kb/s)
4043     putting file /usr/share/cups/drivers/DEFPRTR2.PPD as
4044       \WIN40/DEFPRTR2.PPD (823.5 kb/s) (average 12944.0 kb/s)
4045     putting file /usr/share/cups/drivers/ICONLIB.DLL as
4046       \WIN40/ICONLIB.DLL (19226.2 kb/s) (average 13169.7 kb/s)
4047     putting file /usr/share/cups/drivers/PSMON.DLL as
4048       \WIN40/PSMON.DLL (18666.1 kb/s) (average 13266.7 kb/s)
4049
4050     Running command: rpcclient localhost -N -U'root%secret'
4051        -c 'adddriver &quot;Windows NT x86&quot;
4052        &quot;infotec_IS2027:ADOBEPS5.DLL:infotec_IS2027.PPD:ADOBEPSU.DLL:
4053                 ADOBEPSU.HLP:NULL:RAW:NULL&quot;'
4054     cmd = adddriver &quot;Windows NT x86&quot;
4055        &quot;infotec_IS2027:ADOBEPS5.DLL:infotec_IS2027.PPD:ADOBEPSU.DLL:
4056        ADOBEPSU.HLP:NULL:RAW:NULL&quot;
4057     Printer Driver infotec_IS2027 successfully installed.
4058
4059     Running command: rpcclient localhost -N -U'root%secret'
4060        -c 'adddriver &quot;Windows 4.0&quot;
4061        &quot;infotec_IS2027:ADOBEPS4.DRV:infotec_IS2027.PPD:NULL:
4062                 ADOBEPS4.HLP:PSMON.DLL:RAW: ADFONTS.MFM,DEFPRTR2.PPD,ICONLIB.DLL&quot;'
4063     cmd = adddriver &quot;Windows 4.0&quot; &quot;infotec_IS2027:ADOBEPS4.DRV:
4064                 infotec_IS2027.PPD:NULL:ADOBEPS4.HLP:PSMON.DLL:RAW:
4065                 ADFONTS.MFM,DEFPRTR2.PPD,ICONLIB.DLL&quot;
4066     Printer Driver infotec_IS2027 successfully installed.
4067
4068     Running command: rpcclient localhost -N -U'root%secret'
4069        -c 'setdriver infotec_IS2027 infotec_IS2027'
4070     cmd = setdriver infotec_IS2027 infotec_IS2027
4071     Succesfully set infotec_IS2027 to driver infotec_IS2027.
4072
4073     <tt>root# </tt>
4074 </pre><p>
4075 If you look closely, you'll discover your root password was transfered unencrypted over
4076 the wire, so beware! Also, if you look further her, you'll discover error messages like
4077 <tt>NT_STATUS_OBJECT_NAME_COLLISION</tt> in between. They occur, because
4078 the directories <tt>WIN40</tt> and <tt>W32X86</tt> already
4079 existed in the [print$] driver download share (from a previous driver
4080 installation). They are harmless here.
4081 </p><p>
4082 Now your printer is prepared for the clients to use. From
4083 a client, browse to the CUPS/Samba server, open the &quot;Printers&quot;
4084 share, right-click on this printer and select &quot;Install...&quot; or
4085 &quot;Connect...&quot; (depending on the Windows version you use). Now their
4086 should be a new printer in your client's local &quot;Printers&quot; folder,
4087 named (in my case) &quot;infotec_IS2027 on kdebitshop&quot;
4088 </p><p>
4089 <span class="emphasis"><em>NOTE: </em></span>
4090 <b>cupsaddsmb</b> will only reliably work i
4091 with CUPS version 1.1.15 or higher
4092 and Samba from 2.2.4. If it doesn't work, or if the automatic printer
4093 driver download to the clients doesn't succeed, you can still manually
4094 install the CUPS printer PPD on top of the Adobe PostScript driver on
4095 clients and then point the client's printer queue to the Samba printer
4096 share for connection, should you desire to use the CUPS networked
4097 PostScript RIP functions.
4098 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2872915"></a>The CUPS Filter Chains</h2></div></div><p>
4099 The following diagrams reveal how CUPS handles print jobs.
4100 </p><pre class="programlisting">
4101 #########################################################################
4102 #
4103 # CUPS in and of itself has this (general) filter chain (CAPITAL
4104 # letters are FILE-FORMATS or MIME types, other are filters (this is
4105 # true for pre-1.1.15 of pre-4.3 versions of CUPS and ESP PrintPro):
4106 #
4107 # <i><tt>SOMETHNG</tt></i>-FILEFORMAT
4108 #      |
4109 #      |
4110 #      V
4111 #     <i><tt>something</tt></i>tops
4112 #      |
4113 #      |
4114 #      V
4115 # APPLICATION/POSTSCRIPT
4116 #      |
4117 #      |
4118 #      V
4119 #     pstops
4120 #      |
4121 #      |
4122 #      V
4123 # APPLICATION/VND.CUPS-POSTSCRIPT
4124 #      |
4125 #      |
4126 #      V
4127 #     pstoraster   # as shipped with CUPS, independent from any Ghostscipt
4128 #      |           # installation on the system
4129 #      |  (= &quot;postscipt interpreter&quot;)
4130 #      |
4131 #      V
4132 # APPLICATION/VND.CUPS-RASTER
4133 #      |
4134 #      |
4135 #      V
4136 #     rasterto<i><tt>something</tt></i>  (f.e. Gimp-Print filters may be plugged in here)
4137 #      |   (= &quot;raster driver&quot;)
4138 #      |
4139 #      V
4140 # SOMETHING-DEVICE-SPECIFIC
4141 #      |
4142 #      |
4143 #      V
4144 #     backend
4145 #
4146 #
4147 # ESP PrintPro has some enhanced &quot;rasterto<i><tt>something</tt></i>&quot; filters as compared to
4148 # CUPS, and also a somewhat improved &quot;pstoraster&quot; filter.
4149 #
4150 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
4151 #       CUPS and ESP PrintPro plug-in where rasterto<i><tt>something</tt></i> is noted.
4152 #
4153 #########################################################################
4154 </pre><pre class="programlisting">
4155 #########################################################################
4156 #
4157 # This is how &quot;cupsomatic&quot; comes into play:
4158 # =========================================
4159 #
4160 # <i><tt>SOMETHNG</tt></i>-FILEFORMAT
4161 #      |
4162 #      |
4163 #      V
4164 #    <i><tt>something</tt></i>tops
4165 #      |
4166 #      |
4167 #      V
4168 # APPLICATION/POSTSCRIPT
4169 #      |
4170 #      |
4171 #      V
4172 #    pstops
4173 #      |
4174 #      |
4175 #      V
4176 # APPLICATION/VND.CUPS-POSTSCRIPT ----------------+
4177 #      |                                          |
4178 #      |                                          V
4179 #      V                                         cupsomatic
4180 #    pstoraster                                  (constructs complicated
4181 #      |  (= &quot;postscipt interpreter&quot;)            Ghostscript commandline
4182 #      |                                         to let the file be
4183 #      V                                         processed by a
4184 # APPLICATION/VND.CUPS-RASTER                    &quot;-sDEVICE=<i><tt>s.th.</tt></i>&quot;
4185 #      |                                         call...)
4186 #      |                                          |
4187 #      V                                          |
4188 #    rasterto<i><tt>something</tt></i>                          V
4189 #      |    (= &quot;raster driver&quot;)     +-------------------------+
4190 #      |                            | Ghostscript at work.... |
4191 #      V                            |                         |
4192 # SOMETHING-DEVICE-SPECIFIC         *-------------------------+
4193 #      |                                          |
4194 #      |                                          |
4195 #      V                                          |
4196 #    backend &gt;------------------------------------+
4197 #      |
4198 #      |
4199 #      V
4200 #    THE PRINTER
4201 #
4202 #
4203 # Note, that cupsomatic &quot;kidnaps&quot; the printfile after the
4204 # &quot;APPLICATION/VND.CUPS-POSTSCRPT&quot; stage and deviates it through
4205 # the CUPS-external, systemwide Ghostscript installation, bypassing the
4206 # &quot;pstoraster&quot; filter (therefor also bypassing the CUPS-raster-drivers
4207 # &quot;rasterto<i><tt>something</tt></i>&quot;, and hands the rasterized file directly to the CUPS
4208 # backend...
4209 #
4210 # cupsomatic is not made by the CUPS developers. It is an independent
4211 # contribution to printing development, made by people from
4212 # Linuxprinting.org. (see also http://www.cups.org/cups-help.html)
4213 #
4214 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
4215 #       CUPS and ESP PrintPro plug-in where rasterto<i><tt>something</tt></i> is noted.
4216 #
4217 #########################################################################
4218 </pre><pre class="programlisting">
4219 #########################################################################
4220 #
4221 # And this is how it works for ESP PrintPro from 4.3:
4222 # ===================================================
4223 #
4224 # <i><tt>SOMETHNG</tt></i>-FILEFORMAT
4225 #      |
4226 #      |
4227 #      V
4228 #     <i><tt>something</tt></i>tops
4229 #      |
4230 #      |
4231 #      V
4232 # APPLICATION/POSTSCRIPT
4233 #      |
4234 #      |
4235 #      V
4236 #     pstops
4237 #      |
4238 #      |
4239 #      V
4240 # APPLICATION/VND.CUPS-POSTSCRIPT
4241 #      |
4242 #      |
4243 #      V
4244 #     gsrip
4245 #      |  (= &quot;postscipt interpreter&quot;)
4246 #      |
4247 #      V
4248 # APPLICATION/VND.CUPS-RASTER
4249 #      |
4250 #      |
4251 #      V
4252 #     rasterto<i><tt>something</tt></i>  (f.e. Gimp-Print filters may be plugged in here)
4253 #      |   (= &quot;raster driver&quot;)
4254 #      |
4255 #      V
4256 # SOMETHING-DEVICE-SPECIFIC
4257 #      |
4258 #      |
4259 #      V
4260 #     backend
4261 #
4262 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
4263 #       CUPS and ESP PrintPro plug-in where rasterto<i><tt>something</tt></i> is noted.
4264 #
4265 #########################################################################
4266 </pre><pre class="programlisting">
4267 #########################################################################
4268 #
4269 # This is how &quot;cupsomatic&quot; would come into play with ESP PrintPro:
4270 # ================================================================
4271 #
4272 #
4273 # <i><tt>SOMETHNG</tt></i>-FILEFORMAT
4274 #      |
4275 #      |
4276 #      V
4277 #    <i><tt>something</tt></i>tops
4278 #      |
4279 #      |
4280 #      V
4281 # APPLICATION/POSTSCRIPT
4282 #      |
4283 #      |
4284 #      V
4285 #    pstops
4286 #      |
4287 #      |
4288 #      V
4289 # APPLICATION/VND.CUPS-POSTSCRIPT ----------------+
4290 #      |                                          |
4291 #      |                                          V
4292 #      V                                         cupsomatic
4293 #    gsrip                                       (constructs complicated
4294 #      |  (= &quot;postscipt interpreter&quot;)            Ghostscript commandline
4295 #      |                                         to let the file be
4296 #      V                                         processed by a
4297 # APPLICATION/VND.CUPS-RASTER                    &quot;-sDEVICE=<i><tt>s.th.</tt></i>&quot;
4298 #      |                                         call...)
4299 #      |                                          |
4300 #      V                                          |
4301 #    rasterto<i><tt>something</tt></i>                          V
4302 #      |   (= &quot;raster driver&quot;)      +-------------------------+
4303 #      |                            | Ghostscript at work.... |
4304 #      V                            |                         |
4305 # SOMETHING-DEVICE-SPECIFIC         *-------------------------+
4306 #      |                                          |
4307 #      |                                          |
4308 #      V                                          |
4309 #    backend &gt;------------------------------------+
4310 #      |
4311 #      |
4312 #      V
4313 #    THE PRINTER
4314 #
4315 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
4316 #       CUPS and ESP PrintPro plug-in where rasterto<i><tt>something</tt></i> is noted.
4317 #
4318 #########################################################################
4319 </pre><pre class="programlisting">
4320 #########################################################################
4321 #
4322 # And this is how it works for CUPS from 1.1.15:
4323 # ==============================================
4324 #
4325 # <i><tt>SOMETHNG</tt></i>-FILEFORMAT
4326 #      |
4327 #      |
4328 #      V
4329 #     <i><tt>something</tt></i>tops
4330 #      |
4331 #      |
4332 #      V
4333 # APPLICATION/POSTSCRIPT
4334 #      |
4335 #      |
4336 #      V
4337 #     pstops
4338 #      |
4339 #      |
4340 #      V
4341 # APPLICATION/VND.CUPS-POSTSCRIPT-----+
4342 #                                     |
4343 #                  +------------------v------------------------------+
4344 #                  | Ghostscript                                     |
4345 #                  | at work...                                      |
4346 #                  | (with                                           |
4347 #                  | &quot;-sDEVICE=cups&quot;)                                |
4348 #                  |                                                 |
4349 #                  |         (= &quot;postscipt interpreter&quot;)             |
4350 #                  |                                                 |
4351 #                  +------------------v------------------------------+
4352 #                                     |
4353 #                                     |
4354 # APPLICATION/VND.CUPS-RASTER &gt;-------+
4355 #      |
4356 #      |
4357 #      V
4358 #     rasterto<i><tt>something</tt></i>
4359 #      |   (= &quot;raster driver&quot;)
4360 #      |
4361 #      V
4362 # SOMETHING-DEVICE-SPECIFIC
4363 #      |
4364 #      |
4365 #      V
4366 #     backend
4367 #
4368 #
4369 # NOTE: since version 1.1.15 CUPS &quot;outsourced&quot; the pstoraster process to
4370 #       Ghostscript. GNU Ghostscript needs to be patched to handle the
4371 #       CUPS requirement; ESP Ghostscript has this builtin. In any case,
4372 #       &quot;gs -h&quot; needs to show up a &quot;cups&quot; device. pstoraster is now a
4373 #       calling an appropriate &quot;gs -sDEVICE=cups...&quot; commandline to do
4374 #       the job. It will output &quot;application/vnd.cup-raster&quot;, which will
4375 #       be finally processed by a CUPS raster driver &quot;rasterto<i><tt>something</tt></i>&quot;
4376 #       Note the difference to &quot;cupsomatic&quot;, which will *not* output
4377 #       CUPS-raster, but a final version of the printfile, ready to be
4378 #       sent to the printer. cupsomatic also doesn't use the &quot;cups&quot;
4379 #       devicemode in Ghostscript, but one of the classical devicemodes....
4380 #
4381 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
4382 #       CUPS and ESP PrintPro plug-in where rasterto<i><tt>something</tt></i> is noted.
4383 #
4384 #########################################################################
4385 </pre><pre class="programlisting">
4386 #########################################################################
4387 #
4388 # And this is how it works for CUPS from 1.1.15, with cupsomatic included:
4389 # ========================================================================
4390 #
4391 # <i><tt>SOMETHNG</tt></i>-FILEFORMAT
4392 #      |
4393 #      |
4394 #      V
4395 #     <i><tt>something</tt></i>tops
4396 #      |
4397 #      |
4398 #      V
4399 # APPLICATION/POSTSCRIPT
4400 #      |
4401 #      |
4402 #      V
4403 #     pstops
4404 #      |
4405 #      |
4406 #      V
4407 # APPLICATION/VND.CUPS-POSTSCRIPT-----+
4408 #                                     |
4409 #                  +------------------v------------------------------+
4410 #                  | Ghostscript        . Ghostscript at work....    |
4411 #                  | at work...         . (with &quot;-sDEVICE=           |
4412 #                  | (with              .            <i><tt>s.th.</tt></i>&quot;        |
4413 #                  | &quot;-sDEVICE=cups&quot;)   .                            |
4414 #                  |                    .                            |
4415 #                  | (CUPS standard)    .      (cupsomatic)          |
4416 #                  |                    .                            |
4417 #                  |          (= &quot;postscript interpreter&quot;)           |
4418 #                  |                    .                            |
4419 #                  +------------------v--------------v---------------+
4420 #                                     |              |
4421 #                                     |              |
4422 # APPLICATION/VND.CUPS-RASTER &gt;-------+              |
4423 #      |                                             |
4424 #      |                                             |
4425 #      V                                             |
4426 #     rasterto<i><tt>something</tt></i>                            |
4427 #      |   (= &quot;raster driver&quot;)                       |
4428 #      |                                             |
4429 #      V                                             |
4430 # SOMETHING-DEVICE-SPECIFIC &gt;------------------------+
4431 #      |
4432 #      |
4433 #      V
4434 #     backend
4435 #
4436 #
4437 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
4438 #       CUPS and ESP PrintPro plug-in where rasterto<i><tt>something</tt></i> is noted.
4439 #
4440 ##########################################################################
4441 </pre></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2873302"></a>CUPS Print Drivers and Devices</h2></div></div><p>
4442 CUPS ships with good support for HP LaserJet type printers. You can install
4443 the driver as follows:
4444
4445 </p><div class="itemizedlist"><ul type="disc"><li><p>
4446         lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E -m laserjet.ppd
4447         </p></li></ul></div><p>
4448
4449 (The &quot;-m&quot; switch will retrieve the &quot;laserjet.ppd&quot; from the standard repository
4450 for not-yet-installed-PPDs, which CUPS typically stores in 
4451 <tt>/usr/share/cups/model</tt>. Alternatively, you may use
4452 &quot;-P /absolute/filesystem/path/to/where/there/is/PPD/your.ppd&quot;).
4453 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2873339"></a>Further printing steps</h3></div></div><p>
4454 Always also consult the database on linuxprinting.org for all recommendations
4455 about which driver is best used for each printer:
4456 </p><p><a href="http://www.linuxprinting.org/printer_list.cgi" target="_top">http://www.linuxprinting.org/printer_list.cgi</a></p><p>
4457 There select your model and click on &quot;Show&quot;. You'll arrive at a page listing
4458 all drivers working with your model. There will always be *one* 
4459 <span class="emphasis"><em>recommended</em></span> one. Try this one first. In your case
4460 (&quot;HP LaserJet 4 Plus&quot;), you'll arrive here:
4461 </p><p><a href="http://www.linuxprinting.org/show_printer.cgi?recnum=75104" target="_top">http://www.linuxprinting.org/show_printer.cgi?recnum=75104</a></p><p>
4462 The recommended driver is &quot;ljet4&quot;. It has a link to the page for the ljet4
4463 driver too:
4464 </p><p><a href="http://www.linuxprinting.org/show_driver.cgi?driver=ljet4" target="_top">http://www.linuxprinting.org/show_driver.cgi?driver=ljet4</a></p><p>
4465 On the driver's page, you'll find important and detailed info about how to use
4466 that driver within the various available spoolers. You can generate a PPD for
4467 CUPS. The PPD contains all the info about how to use your model and the driver;
4468 this is, once installed, working transparently for the user -- you'll only
4469 need to choose resolution, paper size etc. from the web-based menu or from
4470 the print dialog GUI or from the commandline...
4471 </p><p>
4472 On the driver's page, choose to use the &quot;PPD-O-Matic&quot; online PPD generator
4473 program. Select your model and click &quot;Generate PPD file&quot;. When you safe the
4474 appearing ASCII text file, don't use &quot;cut'n'past&quot; (as it could possiblly corrupt
4475 line endings and tabs), but use &quot;Save as...&quot; in your browser's menu. Save it
4476 at &quot;/some/path/on/your/filesystem/somewhere/my-name-for-my-printer.ppd&quot;
4477 </p><p>
4478 Then install the printer:
4479 </p><pre class="programlisting">
4480     &quot;lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E \
4481           -P /some/path/on/your/filesystem/somewhere/my-name-for-my-printer.ppd&quot;
4482 </pre><p>
4483 Note, that for all the &quot;Foomatic-PPDs&quot; from Linuxprinting.org, you also need
4484 a special &quot;CUPS filter&quot; named &quot;cupsomatic&quot;. Get the latest version of
4485 &quot;cupsomatic&quot; from:
4486 </p><p><a href="http://www.linuxprinting.org/cupsomatic" target="_top">http://www.linuxprinting.org/cupsomatic</a></p><p>
4487 This needs to be copied to <tt>/usr/lib/cups/filter/cupsomatic</tt>
4488 and be made world executable. This filter is needed to read and act upon the
4489 specially encoded Foomatic comments, embedded in the printfile, which in turn
4490 are used to construct (transparently for you, the user) the complicated
4491 ghostscript command line needed for your printer/driver combo.
4492 </p><p>
4493 You can have a look at all the options for the Ghostscript commandline supported
4494 by your printer and the ljet4 driver by going to the section &quot;Execution details&quot;,
4495 selecting your model (Laserjet 4 Plus) and clicking on &quot;Show execution details&quot;.
4496 This will bring up this web page:
4497 </p><p><a href="http://www.linuxprinting.org/execution.cgi?driver=ljet4&amp;printer=75104&amp;.submit=Show%2Bexecution%2Bdetails" target="_top">http://www.linuxprinting.org/execution.cgi?driver=ljet4&amp;printer=75104&amp;.submit=Show+execution+details</a></p><p>
4498 The ingenious thing is that the database is kept current. If there
4499 is a bug fix and an improvement somewhere in the database, you will
4500 always get the most current and stable and feature-rich driver by following
4501 the steps described above.
4502 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
4503 Till Kamppeter from MandrakeSoft is doing an excellent job here that too few
4504 people are aware of. (So if you use it often, please send him a note showing
4505 your appreciation).</p></div><p>
4506 The latest and greatest improvement now is support for &quot;custom page sizes&quot;
4507 for all those printers which support it.
4508 </p><p>
4509 &quot;cupsomatic&quot; is documented here:
4510 </p><p><a href="http://www.linuxprinting.org/cups-doc.html" target="_top">http://www.linuxprinting.org/cups-doc.html</a></p><p>
4511 More printing tutorial info may be found here:
4512 </p><p><a href="http://www.linuxprinting.org/kpfeifle/LinuxKongress2002/Tutorial/" target="_top">http://www.linuxprinting.org/kpfeifle/LinuxKongress2002/Tutorial/</a></p><p>
4513 Note, that *all* the Foomatic drivers listed on Linuxprinting.org (now
4514 approaching the &quot;all-time high&quot; number of 1.000 for the supported models)
4515 are using a special filtering chain involving Ghostscript, as described
4516 in this document.
4517 </p><p>
4518 Summary - You need:
4519 </p><p>
4520 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>A &quot;foomatic+<i><tt>something</tt></i>&quot; PPD is not enough to print with CUPS (but it is *one* important component)</td></tr><tr><td>The &quot;cupsomatic&quot; filter script (Perl) in <tt>/usr/lib/cups/filters/</tt></td></tr><tr><td>Perl to make cupsomatic run</td></tr><tr><td>Ghostscript (because it is called and controlled by the PPD/cupsomatic combo in a way to fit your printermodel/driver combo.</td></tr><tr><td>Ghostscript *must*, depending on the driver/model, contain support for a certain &quot;device&quot; (as shown by &quot;gs -h&quot;)</td></tr></table><p>
4521 </p><p>
4522 In the case of the &quot;hpijs&quot; driver, you need a Ghostscript version, which
4523 has &quot;ijs&quot; amongst its supported devices in &quot;gs -h&quot;. In the case of
4524 &quot;hpijs+foomatic&quot;, a valid ghostscript commandline would be reading like this:
4525 </p><pre class="programlisting">
4526        gs -q -dBATCH -dPARANOIDSAFER -dQUIET -dNOPAUSE -sDEVICE=ijs       \
4527              -sIjsServer=hpijs<i><tt>PageSize</tt></i> -dDuplex=<i><tt>Duplex</tt></i> <i><tt>Model</tt></i>        \
4528              -r<i><tt>Resolution</tt></i>,PS:MediaPosition=<i><tt>InputSlot</tt></i> -dIjsUseOutputFD \
4529              -sOutputFile=- -
4530 </pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
4531 Note, that with CUPS and the &quot;hpijs+foomatic&quot; PPD (plus Perl and cupsomatic)
4532 you don't need to remember this. You can choose the available print options
4533 thru a GUI print command (like &quot;glp&quot; from ESP's commercially supported
4534 PrintPro software, or KDE's &quot;kprinter&quot;, or GNOME's &quot;gtklp&quot; or the independent
4535 &quot;xpp&quot;) or the CUPS web interface via human-readable drop-down selection
4536 menus.
4537 </p></div><p>
4538 If you use &quot;ESP Ghostscript&quot; (also under the GPL, provided by Easy Software
4539 Products, the makers of CUPS, downloadable from
4540 <a href="http://www.cups.org/software.html" target="_top">http://www.cups.org/software.html</a>,
4541 co-maintained by the developers of linuxprinting.org), you are guaranteed to
4542 have in use the most uptodate, bug-fixed, enhanced and stable version of a Free
4543 Ghostscript. It contains support for ~300 devices, whereas plain vanilla
4544 GNU Ghostscript 7.05 only has ~200.
4545 </p><p>
4546 If you print only one CUPS test page, from the web interface and when you try to
4547 print a windows test page, it acts like the job was never sent:
4548
4549 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>Can you print &quot;standard&quot; jobs from the CUPS machine?</td></tr><tr><td>Are the jobs from Windows visible in the Web interface on CUPS (http://localhost:631/)?</td></tr><tr><td><span class="emphasis"><em>Most important:</em></span> What kind of printer driver are you using on the Windows clients?</td></tr></table><p>
4550
4551 You can try to get a more detailed debugging info by setting &quot;LogLevel debug&quot; in
4552 <tt>/etc/cups/cupsd.conf</tt>, re-start cupsd and investigate <tt>/var/log/cups/error_log</tt>
4553 for the whereabouts of your Windows-originating printjobs:
4554 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>what does the &quot;auto-typing&quot; line say? which is the &quot;MIME type&quot; CUPS thinks is arriving from the Windows clients?</td></tr><tr><td>are there &quot;filter&quot; available for this MIME type?</td></tr><tr><td>are there &quot;filter rules&quot; defined in &quot;/etc/cups/mime.convs&quot; for this MIME type?</td></tr></table></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2873758"></a>Limiting the number of pages users can print</h2></div></div><p>
4555 The feature you want is dependent on the real print subsystem you're using.
4556 Samba's part is always to receive the job files from the clients (filtered
4557 *or* unfiltered) and hand it over to this printing subsystem.
4558 </p><p>
4559 Of course one could &quot;hack&quot; things with one's own scripts.
4560 </p><p>
4561 But there is CUPS (Common Unix Printing System). CUPS supports &quot;quotas&quot;.
4562 Quotas can be based on sizes of jobs or on the number of pages or both,
4563 and are spanning any time period you want.
4564 </p><p>
4565 This is an example command how root would set a print quota in CUPS,
4566 assuming an existing printer named &quot;quotaprinter&quot;:
4567 </p><pre class="programlisting">
4568   lpadmin -p quotaprinter -o job-quota-period=604800 -o job-k-limit=1024 \
4569        -o job-page-limit=100
4570 </pre><p>
4571 This would limit every single user to print 100 pages or 1024 KB of
4572 data (whichever comes first) within the last 604.800 seconds ( = 1 week).
4573 </p><p>
4574 For CUPS to count correctly, the printfile needs to pass the CUPS &quot;pstops&quot; filter,
4575 otherwise it uses a &quot;dummy&quot; count of &quot;1&quot;. Some printfiles don't pass it
4576 (eg: image files) but then those are mostly 1 page jobs anyway. This also means,
4577 proprietary drivers for the target printer running on the client computers and
4578 CUPS/Samba then spooling these files as &quot;raw&quot; (i.e. leaving them untouched, not
4579 filtering them), will be counted as &quot;1-pagers&quot; too!
4580 </p><p>
4581 You need to send PostScript from the clients (i.e. run a PostScript driver there)
4582 for having the chance to get accounting done. If the printer is a non-PostScript model,
4583 you need to let CUPS do the job to convert the file to a print-ready format for the
4584 target printer. This will be working for currently ~1.000 different printer models, see
4585 </p><pre class="programlisting">
4586      http://www.linuxprinting.org/printer_list.cgi
4587 </pre><p>
4588 Before CUPS-1.1.16 your only option was to use the Adobe PostScript
4589 Driver on the Windows clients. The output of this driver was not always
4590 passed thru the &quot;pstops&quot; filter on the CUPS/Samba side, and therefor was
4591 not counted correctly (the reason is that it often --- depending on the
4592 &quot;PPD&quot; being used --- did write a &quot;PJL&quot;-header in front of the real
4593 PostScript which made CUPS to skip the pstops and go directy to
4594 the &quot;pstoraster&quot; stage).
4595 </p><p>
4596 From CUPS-1.1.16 onward you can use the &quot;CUPS PostScript Driver
4597 for Windows NT/2K/XP clients&quot; (it is tagged in the download area of
4598 http://www.cups.org/ as the &quot;cups-samba-1.1.16.tar.gz&quot; package).
4599 It is *not* working for Win9x/ME clients. But it:
4600 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>it guarantees to not write an PJL-header</td></tr><tr><td>it guarantees to still read and support all PJL-options named in the driver PPD with its own means</td></tr><tr><td>it guarantees the file going thru the &quot;pstops&quot; filter on the CUPS/Samba server</td></tr><tr><td>it guarantees to page-count correctly the printfile</td></tr></table><p>
4601 You can read more about the setup of this combination in the
4602 manpage for &quot;cupsaddsmb&quot; (only present with CUPS installed, only
4603 current with CUPS 1.1.16).
4604 </p><p>
4605 These are the items CUPS logs in the &quot;page_log&quot; for every single *page* of a job:
4606 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>Printer name</td></tr><tr><td>User name</td></tr><tr><td>Job ID</td></tr><tr><td>Time of printing</td></tr><tr><td>the page number</td></tr><tr><td>the number of copies</td></tr><tr><td>a billing info string (optional)</td></tr></table><p>
4607 </p><p>
4608 Here is an extract of my CUPS server's page_log file to illustrate
4609 the format and included items:
4610 </p><p><tt>
4611         infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 1 2  #marketing
4612         infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 2 2  #marketing
4613         infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 3 2  #marketing
4614         infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 4 2  #marketing
4615         infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 5 2  #marketing
4616         infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 6 2  #marketing
4617 </tt></p><p>
4618 This was Job ID &quot;40&quot;, printed on &quot;infotec_IS2027&quot; by user &quot;kurt&quot;, a 6-page job
4619 printed in 2 copies and billed to &quot;#marketing&quot;...
4620 </p><p>
4621 What flaws or shortcomings are there?
4622 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>the ones named above</td></tr><tr><td>
4623         CUPS really counts the job pages being *processsed in software*
4624         (going thru the &quot;RIP&quot;) rather than the physical sheets successfully
4625         leaving the printing device -- if there is a jam while printing
4626         the 5th sheet out of 1000 and the job is aborted by the printer,
4627         the &quot;page count&quot; will still show the figure of 1000 for that job
4628         </td></tr><tr><td>
4629         all quotas are the same for all users (no flexibility to give the
4630         boss a higher quota than the clerk) no support for groups
4631         </td></tr><tr><td>
4632         no means to read out the current balance or &quot;used-up&quot; number of current quota
4633         </td></tr><tr><td>
4634         a user having used up 99 sheets of 100 quota will still be able to send and print a 1.000 sheet job
4635         </td></tr><tr><td>
4636         a user being denied a job because of a filled-up quota doesn't get a meaningful
4637         error message from CUPS other than &quot;client-error-not-possible&quot;.
4638         </td></tr></table><p>
4639 But this is the best system out there currently. And there are
4640 huge improvements under development:
4641 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>page counting will go into the &quot;backends&quot; (these talk
4642         directly to the printer and will increase the count in sync with the
4643          actual printing process -- a jam at the 5th sheet will lead to a stop in the counting)</td></tr><tr><td>quotas will be handled more flexibly</td></tr><tr><td>probably there will be support for users to inquire their &quot;accounts&quot; in advance</td></tr><tr><td>probably there will be support for some other tools around this topic</td></tr></table><p>
4644 Other than the current stage of the CUPS development, I don't
4645 know any other ready-to-use tool which you could consider.
4646 </p><p>
4647 You can download the driver files from
4648 <a href="http://www.cups.org/software.html" target="_top">http://www.cups.org/software.html</a>.
4649 It is a separate package from the CUPS base software files, tagged as &quot;CUPS 1.1.16
4650 Windows NT/2k/XP Printer Driver for SAMBA (tar.gz, 192k)&quot;. The filename to
4651 download is &quot;cups-samba-1.1.16.tar.gz&quot;. Upon untar-/unzip-ping it will reveal
4652 the files:
4653 </p><p>
4654 <tt>
4655    cups-samba.install
4656    cups-samba.license
4657    cups-samba.readme
4658    cups-samba.remove
4659    cups-samba.ss
4660 </tt>
4661 </p><p>
4662 These have been packaged with the ESP meta packager software &quot;EPM&quot;. The
4663 *.install and *.remove files are simple shell script, which untars the
4664 *.ss (which is nothing else than a tar-archive) and puts its contents
4665 into <tt>/usr/share/cups/drivers/</tt>. Its contents are 3 files:
4666 </p><p>
4667 <tt>
4668    cupsdrvr.dll
4669    cupsui.dll
4670    cups.hlp
4671 </tt>
4672 </p><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Caution</h3><p>
4673 Due to a bug one CUPS release puts the <tt>cups.hlp</tt>
4674 into <tt>/usr/share/drivers/</tt> instead of
4675 <tt>/usr/share/cups/drivers/</tt>. To work around this, copy/move
4676 the file after running the &quot;./cups-samba.install&quot; script manually to the right place:
4677 </p><p>
4678 <b><tt> cp /usr/share/drivers/cups.hlp /usr/share/cups/drivers/
4679 </tt></b>
4680         </p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
4681 This new CUPS PostScript driver is currently binary-only, but free
4682 no source code is provided (yet). The reason is this: it has
4683 been developed with the help of the Microsoft Driver Developer Kit (DDK)
4684 and compiled with Microsoft Visual Studio 6. It is not clear to the driver
4685 developers if they are allowed to distribute the whole of the source code
4686 as Free Software. However, they will likely release the &quot;diff&quot; in source
4687 code under the GPL, so anybody with a license of Visual Studio and a DDK
4688 will be able to compile for him/herself.
4689 </p><p>
4690 Once you have run the install script (and possibly manually moved the
4691 &quot;cups.hlp&quot; file to &quot;/usr/share/cups/drivers/&quot;), the driver is ready to be
4692 put into Samba's [print$] share (which often maps to &quot;/etc/samba/drivers/&quot;
4693 and contains a subdir tree with WIN40 and W32X86 branches), by running
4694 &quot;cupsaddsmb&quot; (see also &quot;man cupsaddsmb&quot; for CUPS 1.1.16). [Don't forget to
4695 put root into the smbpasswd file by running &quot;smbpasswd&quot; should you run
4696 this whole procedure for the first time.] Once the driver files are in the
4697 [print$] share, they are ready to be downloaded and installed by the
4698 Win NT/2k/XP clients.
4699 </p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
4700         Win 9x/ME clients won't work with this driver. For these you'd
4701         still need to use the ADOBE*.* drivers as previously.
4702         </p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
4703         It is not harming if you've still the ADOBE*.* driver files from
4704         previous installations in the &quot;/usr/share/cups/drivers/&quot; directory.
4705         The new cupsaddsmb (from 1.1.16) will automatically use the
4706         &quot;newest&quot; installed driver (which here then is the CUPS drivers).
4707         </p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
4708         Should your Win clients have had the old ADOBE*.* files and the
4709         Adobe PostScript drivers installed, the download and installation
4710         of the new CUPS PostScript driver for Windows NT/2k/XP will fail
4711         at first.
4712         </p><p>
4713         It is not enough to &quot;delete&quot; the printer (as the driver files
4714         will still be kept by the clients and re-used if you try to
4715         re-install the printer). To really get rid of the Adobe driver
4716         files on the clients, open the &quot;Printers&quot; folder (possibly via
4717         &quot;Start --&gt; Settings --&gt; Control Panel --&gt; Printers&quot;), right-click
4718         onto the folder background and select &quot;Server Properties&quot;. A
4719         new dialog opens; select the &quot;Drivers&quot; tab; on the list select
4720         the driver you want to delete and click on the &quot;Delete&quot; button.
4721         (This will only work if there is no single printer left which
4722         uses that particular driver -- you need to &quot;delete&quot; all printers
4723         using this driver in the &quot;Printers&quot; folder first.)
4724         </p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
4725         Once you have successfully downloaded the CUPS PostScript driver
4726         to a client, you can easily switch all printers to this one
4727         by proceeding as described elsewhere in the &quot;Samba HOWTO
4728         Collection&quot; to change a driver for an existing printer.
4729         </p></div><p>
4730 What are the benefits with the &quot;CUPS PostScript driver for Windows NT/2k/XP&quot;
4731 as compared to the Adobe drivers?
4732 </p><p>
4733 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><p>
4734         no hassle with the Adobe EULA
4735         </p></td></tr><tr><td><p>
4736         no hassle with the question &quot;where do I get the ADOBE*.* driver files from?&quot;
4737         </p></td></tr><tr><td><p>
4738         the Adobe drivers (depending on the printer PPD associated with them)
4739         often put a PJL header in front of the core PostScript part of the print
4740         file (thus the file starts with &quot;<i><tt>1B</tt></i>%-12345X&quot;
4741         or &quot;<i><tt>escape</tt></i>%-12345X&quot;
4742         instead of &quot;%!PS&quot;). This leads to the CUPS daemon autotyping the
4743         arriving file as a print-ready file, not requiring a pass thru the
4744         &quot;pstops&quot; filter (to speak more technical, it is not regarded as the
4745         generic MIME type &quot;application/postscript&quot;, but as the more special
4746         MIME type &quot;application/cups.vnd-postscript&quot;), which therefore also
4747         leads to the page accounting in &quot;/var/log/cups/page_log&quot; not receiving
4748         the exact mumber of pages; instead the dummy page number of &quot;1&quot; is
4749         logged in a standard setup)
4750         </p></td></tr><tr><td><p>
4751         the Adobe driver has more options to &quot;mis-configure&quot; the PostScript
4752         generated by it (like setting it inadvertedly to &quot;Optimize for Speed&quot;,
4753         instead of &quot;Optimize for Portability&quot;, which could lead to CUPS being
4754         unable to process it)
4755         </p></td></tr><tr><td><p>
4756         the CUPS PostScript driver output sent by Windows clients to the CUPS
4757         server will be guaranteed to be auto-typed as generic MIME type
4758         &quot;application/postscript&quot;, thusly passing thru the CUPS &quot;pstops&quot; filter
4759         and logging the correct number of pages in the page_log for accounting
4760         and quota purposes
4761         </p></td></tr><tr><td><p>
4762         the CUPS PostScript driver supports the sending of additional print
4763         options by the Win NT/2k/XP clients, such as naming the CUPS standard
4764         banner pages (or the custom ones, should they be installed at the time
4765         of driver download), using the CUPS &quot;page-label&quot; option, setting a
4766         job-priority and setting the scheduled time of printing (with the option
4767         to support additional useful IPP job attributes in the future).
4768         </p></td></tr><tr><td><p>
4769         the CUPS PostScript driver supports the inclusion of the new
4770         &quot;*cupsJobTicket&quot; comments at the beginnig of the PostScript file (which
4771         could be used in the future for all sort of beneficial extensions on
4772         the CUPS side, but which will not disturb any other application as those
4773         will regard it as a comment and simply ignore it).
4774         </p></td></tr><tr><td><p>
4775         the CUPS PostScript driver will be the heart of the fully fledged CUPS
4776         IPP client for Windows NT/2k/XP to be released soon (probably alongside
4777         the first Beta release for CUPS 1.2).
4778         </p></td></tr></table><p>
4779 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2874367"></a>Advanced Postscript Printing from MS Windows</h2></div></div><p>
4780 Let the Windows Clients use a PostScript driver to deliver poistscript to
4781 the samba print server (just like any Linux or Unix Client would also use
4782 PostScript to send to the server)
4783 </p><p>
4784 Make the Unix printing subsystem to which Samba sends the job convert the
4785 incoming PostScript files to the native print format of the target printers
4786 (would be PCL if you have an HP printer)
4787 </p><p>
4788 Now if you are afraid that this would just mean using a *Generic* PostScript
4789 driver for the clients that has no Simplex/Duplex selection, and no paper tray
4790 choice, but you need them to be able to set up print jobs, with all the bells
4791 and whistles of your printers:-
4792 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>Not possible with traditional spooling systems</td></tr><tr><td>
4793         But perfectly supported by CUPS (which uses &quot;PPD&quot; files to
4794         describe how to control the print options for PostScript and
4795         non-PostScript devices alike...
4796         </td></tr></table><p>
4797 CUPS PPDs are working perfectly on Windows clients who use Adobe PostScript
4798 drivers (or the new CUPS PostScript driver for Windows NT/2K/XP). Clients can use
4799 them to setup the job to their liking and CUPS will use the received job options
4800 to make the (PCL-, ESC/P- or PostScript-) printer behave as required.
4801 </p><p>
4802 If you want to have the additional benefit of page count logging and accounting
4803 then the CUPS PostScript driver is the best choice (better than the Adobe one).
4804 </p><p>
4805 If you want to make the drivers downloadable for the clients then &quot;cupsaddsmb&quot; is
4806 your friend. It will setup the [print$] share on the Samba host to be ready to serve
4807 the clients for a &quot;point and print&quot; driver installation.
4808 </p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>What strings are attached?</p></div><p>
4809 There are some. But, given the sheer CPU power you can buy nowadays,
4810 these can be overcome easily. The strings:
4811 </p><p>
4812 Well, if the CUPS/Samba side will have to print to many printers serving many users,
4813 you probably will need to set up a second server (which can do automatic load balancing
4814 with the first one, plus a degree of fail-over mechanism). Converting the incoming
4815 PostScript jobs, &quot;interpreting&quot; them for non-PostScript printers, amounts to the work
4816 of a &quot;RIP&quot; (Raster Image Processor) done in software. This requires more CPU and RAM
4817 than for the mere &quot;raw spooling&quot; task your current setup is solving. It all depends
4818 on the avarage and peak printing load the server should be able to handle.
4819 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2874473"></a>Auto-Deletion of CUPS spool files</h2></div></div><p>
4820 Samba print files pass thru two &quot;spool&quot; directories. One the incoming directory
4821 managed by Samba, (set eg: in the <b>path = /var/spool/samba</b> directive in the [printers]
4822 section of <tt>smb.conf</tt>). Second is the spool directory of your UNIX print subsystem.
4823 For CUPS it is normally &quot;/var/spool/cups/&quot;, as set by the cupsd.conf directive
4824 &quot;RequestRoot /var/spool/cups&quot;.
4825 </p><p>
4826 I am not sure, which one of your directories keeps the files.  From what you say,
4827 it is most likely the Samba part.
4828 </p><p>
4829 For the CUPS part, you may want to consult:
4830 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>http://localhost:631/sam.html#PreserveJobFiles</td></tr><tr><td>http://localhost:631/sam.html#PreserveJobHistory</td></tr><tr><td>http://localhost:631/sam.html#MaxJobs</td></tr></table><p>
4831 There are the settings described for your CUPS daemon, which could lead to completed
4832 job files not being deleted.
4833 </p><p>
4834 &quot;PreserveJobHistory Yes&quot; -- keeps some details of jobs in
4835 cupsd's mind (well it keeps the &quot;c12345&quot;, &quot;c12346&quot; etc. files
4836 in the CUPS spool directory, which do a similar job as the
4837 old-fashioned BSD-LPD control files). This is set to &quot;Yes&quot;
4838 as a default.
4839 </p><p>
4840 &quot;PreserveJobFiles Yes&quot; -- keeps the job files themselves in
4841 cupsd's mind (well it keeps the &quot;d12345&quot;, &quot;d12346&quot; etc. files
4842 in the CUPS spool directory...). This is set to &quot;No&quot; as the
4843 CUPS default.
4844 </p><p>
4845 &quot;MaxJobs 500&quot; -- this directive controls the maximum number
4846 of jobs that are kept in memory. Once the number of jobs
4847 reaches the limit, the oldest completed job is automatically
4848 purged from the system to make room for the new one. If all
4849 of the known jobs are still pending or active then the new
4850 job will be rejected. Setting the maximum to 0 disables this
4851 functionality. The default setting is 0.
4852 </p><p>
4853 (There are also additional settings for &quot;MaxJobsPerUser&quot; and
4854 &quot;MaxJobsPerPrinter&quot;...)
4855 </p><p>
4856 For everything to work as announced, you need to have three things:
4857 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>
4858         a Samba-smbd which is compiled against &quot;libcups&quot; (Check on Linux by running <b><tt>ldd `which smbd`</tt></b>)
4859         </td></tr><tr><td>
4860         a Samba-<tt>smb.conf</tt> setting of <b>printing = cups</b>
4861         </td></tr><tr><td>
4862         another Samba-<tt>smb.conf</tt> setting of <b>printcap = cups</b>
4863         </td></tr></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
4864 Note, that in this case all other manually set printing-related
4865 commands (like &quot;print command&quot;, &quot;lpq command&quot;, &quot;lprm command&quot;,
4866 &quot;lppause command&quot; or &quot;lpresume command&quot;) are ignored and they
4867 should normally have no influence what-so-ever on your printing.
4868 </p></div><p>
4869 If you want to do things manually, replace the &quot;printing = cups&quot;
4870 by &quot;printing = bsd&quot;. Then your manually set commands may work
4871 (haven't tested this), and a &quot;print command = lp -d %P %s; rm %s&quot;
4872 may do what you need.
4873 </p><p>
4874 You forgot to mention the CUPS version you're using. If you did
4875 set things up as described in the man pages, then the Samba
4876 spool files should be deleted. Otherwise it may be a bug. On
4877 the CUPS side, you can control the behaviour as described
4878 above.
4879 </p><p>
4880 If you have more problems, post the output of these commands:
4881 </p><p>
4882 <b><tt>
4883    grep -v ^# /etc/cups/cupsd.conf | grep -v ^$
4884    grep -v ^# /etc/samba/smb.conf | grep -v ^$ | grep -v &quot;^;&quot;
4885 </tt></b>
4886 </p><p>
4887 (adapt paths as needed). These commands sanitize the files
4888 and cut out the empty lines and lines with comments, providing
4889 the &quot;naked settings&quot; in a compact way.
4890 </p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="winbind"></a>Chapter 15. Unified Logons between Windows NT and UNIX using Winbind</h2></div><div><div class="authorgroup"><div class="author"><h3 class="author">Tim Potter</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:tpot@linuxcare.com.au">tpot@linuxcare.com.au</a>&gt;</tt></p></div></div></div><div class="author"><h3 class="author">Andrew Tridgell</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:tridge@samba.org">tridge@samba.org</a>&gt;</tt></p></div></div></div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div><div class="author"><h3 class="author">Naag Mummaneni</h3><div class="affiliation"><div class="address"><p><tt>&lt;<a href="mailto:getnag@rediffmail.com">getnag@rediffmail.com</a>&gt;</tt></p></div></div></div><div class="author"><h3 class="author">Jelmer R. Vernooij</h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div></div></div><div><p class="pubdate">27 June 2002</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2874714">Abstract</a></dt><dt><a href="#id2874743">Introduction</a></dt><dt><a href="#id2874814">What Winbind Provides</a></dt><dd><dl><dt><a href="#id2872076">Target Uses</a></dt></dl></dd><dt><a href="#id2872107">How Winbind Works</a></dt><dd><dl><dt><a href="#id2872135">Microsoft Remote Procedure Calls</a></dt><dt><a href="#id2872170">Microsoft Active Directory Services</a></dt><dt><a href="#id2872192">Name Service Switch</a></dt><dt><a href="#id2875280">Pluggable Authentication Modules</a></dt><dt><a href="#id2875352">User and Group ID Allocation</a></dt><dt><a href="#id2875387">Result Caching</a></dt></dl></dd><dt><a href="#id2875414">Installation and Configuration</a></dt><dd><dl><dt><a href="#id2875442">Introduction</a></dt><dt><a href="#id2875518">Requirements</a></dt><dt><a href="#id2875611">Testing Things Out</a></dt></dl></dd><dt><a href="#id2877210">Limitations</a></dt><dt><a href="#id2877264">Conclusion</a></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2874714"></a>Abstract</h2></div></div><p>Integration of UNIX and Microsoft Windows NT through 
4891         a unified logon has been considered a &quot;holy grail&quot; in heterogeneous 
4892         computing environments for a long time. We present 
4893         <span class="emphasis"><em>winbind</em></span>, a component of the Samba suite 
4894         of programs as a solution to the unified logon problem. Winbind 
4895         uses a UNIX implementation 
4896         of Microsoft RPC calls, Pluggable Authentication Modules, and the Name 
4897         Service Switch to allow Windows NT domain users to appear and operate 
4898         as UNIX users on a UNIX machine. This paper describes the winbind 
4899         system, explaining the functionality it provides, how it is configured, 
4900         and how it works internally.</p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2874743"></a>Introduction</h2></div></div><p>It is well known that UNIX and Microsoft Windows NT have 
4901         different models for representing user and group information and 
4902         use different technologies for implementing them. This fact has 
4903         made it difficult to integrate the two systems in a satisfactory 
4904         manner.</p><p>One common solution in use today has been to create 
4905         identically named user accounts on both the UNIX and Windows systems 
4906         and use the Samba suite of programs to provide file and print services 
4907         between the two. This solution is far from perfect however, as 
4908         adding and deleting users on both sets of machines becomes a chore 
4909         and two sets of passwords are required both of which
4910         can lead to synchronization problems between the UNIX and Windows 
4911         systems and confusion for users.</p><p>We divide the unified logon problem for UNIX machines into 
4912         three smaller problems:</p><div class="itemizedlist"><ul type="disc"><li><p>Obtaining Windows NT user and group information
4913                 </p></li><li><p>Authenticating Windows NT users
4914                 </p></li><li><p>Password changing for Windows NT users
4915                 </p></li></ul></div><p>Ideally, a prospective solution to the unified logon problem 
4916         would satisfy all the above components without duplication of 
4917         information on the UNIX machines and without creating additional 
4918         tasks for the system administrator when maintaining users and 
4919         groups on either system. The winbind system provides a simple 
4920         and elegant solution to all three components of the unified logon 
4921         problem.</p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2874814"></a>What Winbind Provides</h2></div></div><p>Winbind unifies UNIX and Windows NT account management by 
4922         allowing a UNIX box to become a full member of a NT domain. Once 
4923         this is done the UNIX box will see NT users and groups as if 
4924         they were native UNIX users and groups, allowing the NT domain 
4925         to be used in much the same manner that NIS+ is used within 
4926         UNIX-only environments.</p><p>The end result is that whenever any 
4927         program on the UNIX machine asks the operating system to lookup 
4928         a user or group name, the query will be resolved by asking the 
4929         NT domain controller for the specified domain to do the lookup.
4930         Because Winbind hooks into the operating system at a low level 
4931         (via the NSS name resolution modules in the C library) this 
4932         redirection to the NT domain controller is completely 
4933         transparent.</p><p>Users on the UNIX machine can then use NT user and group 
4934         names as they would use &quot;native&quot; UNIX names. They can chown files 
4935         so that they are owned by NT domain users or even login to the 
4936         UNIX machine and run a UNIX X-Window session as a domain user.</p><p>The only obvious indication that Winbind is being used is 
4937         that user and group names take the form DOMAIN\user and 
4938         DOMAIN\group. This is necessary as it allows Winbind to determine 
4939         that redirection to a domain controller is wanted for a particular 
4940         lookup and which trusted domain is being referenced.</p><p>Additionally, Winbind provides an authentication service 
4941         that hooks into the Pluggable Authentication Modules (PAM) system 
4942         to provide authentication via a NT domain to any PAM enabled 
4943         applications. This capability solves the problem of synchronizing 
4944         passwords between systems since all passwords are stored in a single 
4945         location (on the domain controller).</p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2872076"></a>Target Uses</h3></div></div><p>Winbind is targeted at organizations that have an 
4946                 existing NT based domain infrastructure into which they wish 
4947                 to put UNIX workstations or servers. Winbind will allow these 
4948                 organizations to deploy UNIX workstations without having to 
4949                 maintain a separate account infrastructure. This greatly 
4950                 simplifies the administrative overhead of deploying UNIX 
4951                 workstations into a NT based organization.</p><p>Another interesting way in which we expect Winbind to 
4952                 be used is as a central part of UNIX based appliances. Appliances 
4953                 that provide file and print services to Microsoft based networks 
4954                 will be able to use Winbind to provide seamless integration of 
4955                 the appliance into the domain.</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2872107"></a>How Winbind Works</h2></div></div><p>The winbind system is designed around a client/server 
4956         architecture. A long running <b>winbindd</b> daemon 
4957         listens on a UNIX domain socket waiting for requests
4958         to arrive. These requests are generated by the NSS and PAM 
4959         clients and processed sequentially.</p><p>The technologies used to implement winbind are described 
4960         in detail below.</p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2872135"></a>Microsoft Remote Procedure Calls</h3></div></div><p>Over the last few years, efforts have been underway 
4961                 by various Samba Team members to decode various aspects of 
4962                 the Microsoft Remote Procedure Call (MSRPC) system. This 
4963                 system is used for most network related operations between 
4964                 Windows NT machines including remote management, user authentication
4965                 and print spooling. Although initially this work was done 
4966                 to aid the implementation of Primary Domain Controller (PDC) 
4967                 functionality in Samba, it has also yielded a body of code which 
4968                 can be used for other purposes.</p><p>Winbind uses various MSRPC calls to enumerate domain users 
4969                 and groups and to obtain detailed information about individual 
4970                 users or groups. Other MSRPC calls can be used to authenticate 
4971                 NT domain users and to change user passwords. By directly querying 
4972                 a Windows PDC for user and group information, winbind maps the 
4973                 NT account information onto UNIX user and group names.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2872170"></a>Microsoft Active Directory Services</h3></div></div><p>
4974                 Since late 2001, Samba has gained the ability to
4975                 interact with Microsoft Windows 2000 using its 'Native
4976                 Mode' protocols, rather than the NT4 RPC services.
4977                 Using LDAP and Kerberos, a domain member running
4978                 winbind can enumerate users and groups in exactly the
4979                 same way as a Win2k client would, and in so doing
4980                 provide a much more efficient and
4981                 effective winbind implementation.  
4982                 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2872192"></a>Name Service Switch</h3></div></div><p>The Name Service Switch, or NSS, is a feature that is 
4983                 present in many UNIX operating systems. It allows system 
4984                 information such as hostnames, mail aliases and user information 
4985                 to be resolved from different sources. For example, a standalone 
4986                 UNIX workstation may resolve system information from a series of 
4987                 flat files stored on the local filesystem. A networked workstation 
4988                 may first attempt to resolve system information from local files, 
4989                 and then consult a NIS database for user information or a DNS server 
4990                 for hostname information.</p><p>The NSS application programming interface allows winbind 
4991                 to present itself as a source of system information when 
4992                 resolving UNIX usernames and groups.  Winbind uses this interface, 
4993                 and information obtained from a Windows NT server using MSRPC 
4994                 calls to provide a new source of account enumeration.  Using standard 
4995                 UNIX library calls, one can enumerate the users and groups on
4996                 a UNIX machine running winbind and see all users and groups in 
4997                 a NT domain plus any trusted domain as though they were local 
4998                 users and groups.</p><p>The primary control file for NSS is 
4999                 <tt>/etc/nsswitch.conf</tt>. 
5000                 When a UNIX application makes a request to do a lookup 
5001                 the C library looks in <tt>/etc/nsswitch.conf</tt> 
5002                 for a line which matches the service type being requested, for 
5003                 example the &quot;passwd&quot; service type is used when user or group names 
5004                 are looked up. This     config line species which implementations 
5005                 of that service should be tried and in what order. If the passwd 
5006                 config line is:</p><p><b>passwd: files example</b></p><p>then the C library will first load a module called 
5007                 <tt>/lib/libnss_files.so</tt> followed by
5008                 the module <tt>/lib/libnss_example.so</tt>. The 
5009                 C library will dynamically load each of these modules in turn 
5010                 and call resolver functions within the modules to try to resolve 
5011                 the request. Once the request is resolved the C library returns the
5012                 result to the application.</p><p>This NSS interface provides a very easy way for Winbind 
5013                 to hook into the operating system. All that needs to be done 
5014                 is to put <tt>libnss_winbind.so</tt> in <tt>/lib/</tt> 
5015                 then add &quot;winbind&quot; into <tt>/etc/nsswitch.conf</tt> at 
5016                 the appropriate place. The C library will then call Winbind to 
5017                 resolve user and group names.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2875280"></a>Pluggable Authentication Modules</h3></div></div><p>Pluggable Authentication Modules, also known as PAM, 
5018                 is a system for abstracting authentication and authorization 
5019                 technologies. With a PAM module it is possible to specify different 
5020                 authentication methods for different system applications without 
5021                 having to recompile these applications. PAM is also useful
5022                 for implementing a particular policy for authorization. For example, 
5023                 a system administrator may only allow console logins from users 
5024                 stored in the local password file but only allow users resolved from 
5025                 a NIS database to log in over the network.</p><p>Winbind uses the authentication management and password 
5026                 management PAM interface to integrate Windows NT users into a 
5027                 UNIX system. This allows Windows NT users to log in to a UNIX 
5028                 machine and be authenticated against a suitable Primary Domain 
5029                 Controller. These users can also change their passwords and have 
5030                 this change take effect directly on the Primary Domain Controller.
5031                 </p><p>PAM is configured by providing control files in the directory 
5032                 <tt>/etc/pam.d/</tt> for each of the services that 
5033                 require authentication. When an authentication request is made 
5034                 by an application the PAM code in the C library looks up this
5035                 control file to determine what modules to load to do the 
5036                 authentication check and in what order. This interface makes adding 
5037                 a new authentication service for Winbind very easy, all that needs 
5038                 to be done is that the <tt>pam_winbind.so</tt> module 
5039                 is copied to <tt>/lib/security/</tt> and the PAM 
5040                 control files for relevant services are updated to allow 
5041                 authentication via winbind. See the PAM documentation
5042                 for more details.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2875352"></a>User and Group ID Allocation</h3></div></div><p>When a user or group is created under Windows NT 
5043                 is it allocated a numerical relative identifier (RID). This is 
5044                 slightly different to UNIX which has a range of numbers that are 
5045                 used to identify users, and the same range in which to identify 
5046                 groups. It is winbind's job to convert RIDs to UNIX id numbers and
5047                 vice versa.  When winbind is configured it is given part of the UNIX 
5048                 user id space and a part of the UNIX group id space in which to 
5049                 store Windows NT users and groups. If a Windows NT user is 
5050                 resolved for the first time, it is allocated the next UNIX id from 
5051                 the range. The same process applies for Windows NT groups. Over 
5052                 time, winbind will have mapped all Windows NT users and groups
5053                 to UNIX user ids and group ids.</p><p>The results of this mapping are stored persistently in 
5054                 an ID mapping database held in a tdb database). This ensures that 
5055                 RIDs are mapped to UNIX IDs in a consistent way.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2875387"></a>Result Caching</h3></div></div><p>An active system can generate a lot of user and group 
5056                 name lookups. To reduce the network cost of these lookups winbind 
5057                 uses a caching scheme based on the SAM sequence number supplied 
5058                 by NT domain controllers.  User or group information returned 
5059                 by a PDC is cached by winbind along with a sequence number also 
5060                 returned by the PDC. This sequence number is incremented by 
5061                 Windows NT whenever any user or group information is modified. If 
5062                 a cached entry has expired, the sequence number is requested from 
5063                 the PDC and compared against the sequence number of the cached entry. 
5064                 If the sequence numbers do not match, then the cached information 
5065                 is discarded and up to date information is requested directly 
5066                 from the PDC.</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2875414"></a>Installation and Configuration</h2></div></div><p>
5067 Many thanks to John Trostel <a href="mailto:jtrostel@snapserver.com" target="_top">jtrostel@snapserver.com</a>
5068 for providing the HOWTO for this section.
5069 </p><p>
5070 This HOWTO describes how to get winbind services up and running 
5071 to control access and authenticate users on your Linux box using 
5072 the winbind services which come with SAMBA 3.0.
5073 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2875442"></a>Introduction</h3></div></div><p>
5074 This HOWTO describes the procedures used to get winbind up and 
5075 running on my RedHat 7.1 system.  Winbind is capable of providing access 
5076 and authentication control for Windows Domain users through an NT 
5077 or Win2K PDC for 'regular' services, such as telnet a nd ftp, as
5078 well for SAMBA services.
5079 </p><p>
5080 This HOWTO has been written from a 'RedHat-centric' perspective, so if 
5081 you are using another distribution, you may have to modify the instructions 
5082 somewhat to fit the way your distribution works.
5083 </p><div class="itemizedlist"><ul type="disc"><li><p>
5084         <span class="emphasis"><em>Why should I to this?</em></span>
5085         </p><p>This allows the SAMBA administrator to rely on the 
5086         authentication mechanisms on the NT/Win2K PDC for the authentication 
5087         of domain members.  NT/Win2K users no longer need to have separate 
5088         accounts on the SAMBA server.
5089         </p></li><li><p>
5090         <span class="emphasis"><em>Who should be reading this document?</em></span>
5091         </p><p>
5092         This HOWTO is designed for system administrators.  If you are 
5093         implementing SAMBA on a file server and wish to (fairly easily) 
5094         integrate existing NT/Win2K users from your PDC onto the
5095         SAMBA server, this HOWTO is for you.  That said, I am no NT or PAM 
5096         expert, so you may find a better or easier way to accomplish 
5097         these tasks.
5098         </p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2875518"></a>Requirements</h3></div></div><p>
5099 If you have a samba configuration file that you are currently 
5100 using... <span class="emphasis"><em>BACK IT UP!</em></span>  If your system already uses PAM, 
5101 <span class="emphasis"><em>back up the <tt>/etc/pam.d</tt> directory 
5102 contents!</em></span> If you haven't already made a boot disk, 
5103 <span class="emphasis"><em>MAKE ONE NOW!</em></span>
5104 </p><p>
5105 Messing with the pam configuration files can make it nearly impossible 
5106 to log in to yourmachine. That's why you want to be able to boot back 
5107 into your machine in single user mode and restore your 
5108 <tt>/etc/pam.d</tt> back to the original state they were in if 
5109 you get frustrated with the way things are going.  ;-)
5110 </p><p>
5111 The latest version of SAMBA (version 3.0 as of this writing), now 
5112 includes a functioning winbindd daemon.  Please refer to the 
5113 <a href="http://samba.org/" target="_top">main SAMBA web page</a> or, 
5114 better yet, your closest SAMBA mirror site for instructions on 
5115 downloading the source code.
5116 </p><p>
5117 To allow Domain users the ability to access SAMBA shares and 
5118 files, as well as potentially other services provided by your 
5119 SAMBA machine, PAM (pluggable authentication modules) must
5120 be setup properly on your machine.  In order to compile the 
5121 winbind modules, you should have at least the pam libraries resident 
5122 on your system.  For recent RedHat systems (7.1, for instance), that 
5123 means <tt>pam-0.74-22</tt>.  For best results, it is helpful to also
5124 install the development packages in <tt>pam-devel-0.74-22</tt>.
5125 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2875611"></a>Testing Things Out</h3></div></div><p>
5126 Before starting, it is probably best to kill off all the SAMBA 
5127 related daemons running on your server.  Kill off all <b>smbd</b>, 
5128 <b>nmbd</b>, and <b>winbindd</b> processes that may 
5129 be running.  To use PAM, you will want to make sure that you have the 
5130 standard PAM package (for RedHat) which supplies the <tt>/etc/pam.d</tt> 
5131 directory structure, including the pam modules are used by pam-aware 
5132 services, several pam libraries, and the <tt>/usr/doc</tt> 
5133 and <tt>/usr/man</tt> entries for pam.  Winbind built better 
5134 in SAMBA if the pam-devel package was also installed.  This package includes 
5135 the header files needed to compile pam-aware applications. For instance, 
5136 my RedHat system has both <tt>pam-0.74-22</tt> and
5137 <tt>pam-devel-0.74-22</tt> RPMs installed.
5138 </p><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2875688"></a>Configure and compile SAMBA</h4></div></div><p>
5139 The configuration and compilation of SAMBA is pretty straightforward.
5140 The first three steps may not be necessary depending upon
5141 whether or not you have previously built the Samba binaries.
5142 </p><pre class="programlisting">
5143 <tt>root#</tt> <b>autoconf</b>
5144 <tt>root#</tt> <b>make clean</b>
5145 <tt>root#</tt> <b>rm config.cache</b>
5146 <tt>root#</tt> <b>./configure</b>
5147 <tt>root#</tt> <b>make</b>
5148 <tt>root#</tt> <b>make install</b>
5149 </pre><p>
5150 This will, by default, install SAMBA in <tt>/usr/local/samba</tt>.
5151 See the main SAMBA documentation if you want to install SAMBA somewhere else.
5152 It will also build the winbindd executable and libraries. 
5153 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2875809"></a>Configure <tt>nsswitch.conf</tt> and the 
5154 winbind libraries on Linux and Solaris</h4></div></div><p>
5155 The libraries needed to run the <b>winbindd</b> daemon 
5156 through nsswitch need to be copied to their proper locations, so
5157 </p><p>
5158 <tt>root#</tt> <b>cp ../samba/source/nsswitch/libnss_winbind.so /lib</b>
5159 </p><p>
5160 I also found it necessary to make the following symbolic link:
5161 </p><p>
5162 <tt>root#</tt> <b>ln -s /lib/libnss_winbind.so /lib/libnss_winbind.so.2</b>
5163 </p><p>And, in the case of Sun solaris:</p><p>
5164 <tt>root#</tt> <b><tt>ln -s /usr/lib/libnss_winbind.so /usr/lib/libnss_winbind.so.1</tt></b>
5165 <tt>root#</tt> <b><tt>ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.1</tt></b>
5166 <tt>root#</tt> <b><tt>ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.2</tt></b>
5167 </p><p>
5168 Now, as root you need to edit <tt>/etc/nsswitch.conf</tt> to 
5169 allow user and group entries to be visible from the <b>winbindd</b> 
5170 daemon.  My <tt>/etc/nsswitch.conf</tt> file look like 
5171 this after editing:
5172 </p><pre class="programlisting">
5173         passwd:     files winbind
5174         shadow:     files 
5175         group:      files winbind
5176 </pre><p>       
5177 The libraries needed by the winbind daemon will be automatically 
5178 entered into the <b>ldconfig</b> cache the next time 
5179 your system reboots, but it 
5180 is faster (and you don't need to reboot) if you do it manually:
5181 </p><p>
5182 <tt>root#</tt> <b>/sbin/ldconfig -v | grep winbind</b>
5183 </p><p>
5184 This makes <tt>libnss_winbind</tt> available to winbindd 
5185 and echos back a check to you.
5186 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2876014"></a>NSS Winbind on AIX</h4></div></div><p>(This section is only for those running AIX)</p><p>
5187 The winbind AIX identification module gets built as libnss_winbind.so in the
5188 nsswitch directory of the samba source.  This file can be copied to
5189 /usr/lib/security, and the AIX naming convention would indicate that it
5190 should be named WINBIND.  A stanza like the following:
5191 </p><pre class="programlisting">
5192 WINBIND:
5193         program = /usr/lib/security/WINBIND
5194         options = authonly
5195 </pre><p>can then be added to
5196 <tt>/usr/lib/security/methods.cfg</tt>.  This module only
5197 supports identification, but there have been success reports using the
5198 standard winbind pam module for authentication.  Use caution configuring
5199 loadable authentication modules as it is possible to make it impossible
5200 to logon to the system.  More information about the AIX authentication
5201 module API can be found at &quot;Kernel Extensions and Device Support
5202 Programming Concepts for AIX&quot;: <a href="#">
5203 Chapter 18. Loadable Authentication Module Programming Interface</a> 
5204 and more information on administering the  modules at <a href="#">
5205 &quot;System Management Guide: Operating System and Devices&quot;</a>.
5206 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2876087"></a>Configure smb.conf</h4></div></div><p>
5207 Several parameters are needed in the smb.conf file to control 
5208 the behavior of <b>winbindd</b>. Configure 
5209 <tt>smb.conf</tt> These are described in more detail in 
5210 the <a href="winbindd.8.html">winbindd(8)</a> man page.  My 
5211 <tt>smb.conf</tt> file was modified to
5212 include the following entries in the [global] section:
5213 </p><pre class="programlisting">
5214 [global]
5215      &lt;...&gt;
5216      # separate domain and username with '+', like DOMAIN+username
5217      <a href="winbindd.8.html#WINBINDSEPARATOR" target="_top">winbind separator</a> = +
5218      # use uids from 10000 to 20000 for domain users
5219      <a href="winbindd.8.html#WINBINDUID" target="_top">winbind uid</a> = 10000-20000
5220      # use gids from 10000 to 20000 for domain groups
5221      <a href="winbindd.8.html#WINBINDGID" target="_top">winbind gid</a> = 10000-20000
5222      # allow enumeration of winbind users and groups
5223      <a href="winbindd.8.html#WINBINDENUMUSERS" target="_top">winbind enum users</a> = yes
5224      <a href="winbindd.8.html#WINBINDENUMGROUP" target="_top">winbind enum groups</a> = yes
5225      # give winbind users a real shell (only needed if they have telnet access)
5226      <a href="winbindd.8.html#TEMPLATEHOMEDIR" target="_top">template homedir</a> = /home/winnt/%D/%U
5227      <a href="winbindd.8.html#TEMPLATESHELL" target="_top">template shell</a> = /bin/bash
5228 </pre></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2876202"></a>Join the SAMBA server to the PDC domain</h4></div></div><p>
5229 Enter the following command to make the SAMBA server join the 
5230 PDC domain, where <i><tt>DOMAIN</tt></i> is the name of 
5231 your Windows domain and <i><tt>Administrator</tt></i> is 
5232 a domain user who has administrative privileges in the domain.
5233 </p><p>
5234 <tt>root#</tt> <b>/usr/local/samba/bin/net join -S PDC -U Administrator</b>
5235 </p><p>
5236 The proper response to the command should be: &quot;Joined the domain 
5237 <i><tt>DOMAIN</tt></i>&quot; where <i><tt>DOMAIN</tt></i> 
5238 is your DOMAIN name.
5239 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2876259"></a>Start up the winbindd daemon and test it!</h4></div></div><p>
5240 Eventually, you will want to modify your smb startup script to 
5241 automatically invoke the winbindd daemon when the other parts of 
5242 SAMBA start, but it is possible to test out just the winbind
5243 portion first.  To start up winbind services, enter the following 
5244 command as root:
5245 </p><p>
5246 <tt>root#</tt> <b>/usr/local/samba/bin/winbindd</b>
5247 </p><p>
5248 Winbindd can now also run in 'dual daemon mode'. This will make it 
5249 run as 2 processes. The first will answer all requests from the cache,
5250 thus making responses to clients faster. The other will
5251 update the cache for the query that the first has just responded.
5252 Advantage of this is that responses stay accurate and are faster. 
5253 You can enable dual daemon mode by adding '-B' to the commandline:
5254 </p><p>
5255 <tt>root#</tt> <b>/usr/local/samba/bin/winbindd -B</b>
5256 </p><p>
5257 I'm always paranoid and like to make sure the daemon 
5258 is really running...
5259 </p><p>
5260 <tt>root#</tt> <b>ps -ae | grep winbindd</b>
5261 </p><p>
5262 This command should produce output like this, if the daemon is running
5263 </p><p>
5264 3025 ?        00:00:00 winbindd
5265 </p><p>
5266 Now... for the real test, try to get some information about the 
5267 users on your PDC
5268 </p><p>
5269 <tt>root#</tt> <b>/usr/local/samba/bin/wbinfo -u</b>
5270 </p><p> 
5271 This should echo back a list of users on your Windows users on 
5272 your PDC.  For example, I get the following response:
5273 </p><pre class="programlisting">
5274         CEO+Administrator
5275         CEO+burdell
5276         CEO+Guest
5277         CEO+jt-ad
5278         CEO+krbtgt
5279         CEO+TsInternetUser
5280 </pre><p>
5281 Obviously, I have named my domain 'CEO' and my <i><tt>winbind
5282 separator</tt></i> is '+'.
5283 </p><p>
5284 You can do the same sort of thing to get group information from 
5285 the PDC:
5286 </p><pre class="programlisting">
5287 <tt>root#</tt> <b>/usr/local/samba/bin/wbinfo -g</b>
5288         CEO+Domain Admins
5289         CEO+Domain Users
5290         CEO+Domain Guests
5291         CEO+Domain Computers
5292         CEO+Domain Controllers
5293         CEO+Cert Publishers
5294         CEO+Schema Admins
5295         CEO+Enterprise Admins
5296         CEO+Group Policy Creator Owners
5297 </pre><p>
5298 The function 'getent' can now be used to get unified 
5299 lists of both local and PDC users and groups.
5300 Try the following command:
5301 </p><p>
5302 <tt>root#</tt> <b>getent passwd</b>
5303 </p><p>
5304 You should get a list that looks like your <tt>/etc/passwd</tt> 
5305 list followed by the domain users with their new uids, gids, home 
5306 directories and default shells.
5307 </p><p>
5308 The same thing can be done for groups with the command
5309 </p><p>
5310 <tt>root#</tt> <b>getent group</b>
5311 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2876504"></a>Fix the init.d startup scripts</h4></div></div><div class="sect4" lang="en"><div class="titlepage"><div><h5 class="title"><a name="id2876511"></a>Linux</h5></div></div><p>
5312 The <b>winbindd</b> daemon needs to start up after the 
5313 <b>smbd</b> and <b>nmbd</b> daemons are running.  
5314 To accomplish this task, you need to modify the startup scripts of your system.
5315 They are located at <tt>/etc/init.d/smb</tt> in RedHat and 
5316 <tt>/etc/init.d/samba</tt> in Debian.
5317 script to add commands to invoke this daemon in the proper sequence.  My 
5318 startup script starts up <b>smbd</b>, 
5319 <b>nmbd</b>, and <b>winbindd</b> from the 
5320 <tt>/usr/local/samba/bin</tt> directory directly.  The 'start' 
5321 function in the script looks like this:
5322 </p><pre class="programlisting">
5323 start() {
5324         KIND=&quot;SMB&quot;
5325         echo -n $&quot;Starting $KIND services: &quot;
5326         daemon /usr/local/samba/bin/smbd $SMBDOPTIONS
5327         RETVAL=$?
5328         echo
5329         KIND=&quot;NMB&quot;
5330         echo -n $&quot;Starting $KIND services: &quot;
5331         daemon /usr/local/samba/bin/nmbd $NMBDOPTIONS
5332         RETVAL2=$?
5333         echo
5334         KIND=&quot;Winbind&quot;
5335         echo -n $&quot;Starting $KIND services: &quot;
5336         daemon /usr/local/samba/bin/winbindd
5337         RETVAL3=$?
5338         echo
5339         [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] &amp;&amp; \
5340                 touch /var/lock/subsys/smb || RETVAL=1
5341         return $RETVAL
5342 }
5343 </pre><p>If you would like to run winbindd in dual daemon mode, replace 
5344 the line 
5345 </p><pre class="programlisting">
5346         daemon /usr/local/samba/bin/winbindd
5347 </pre><p>
5348
5349 in the example above with:
5350
5351 </p><pre class="programlisting">
5352         daemon /usr/local/samba/bin/winbindd -B
5353 </pre><p>.
5354 </p><p>
5355 The 'stop' function has a corresponding entry to shut down the 
5356 services and looks like this:
5357 </p><pre class="programlisting">
5358 stop() {
5359         KIND=&quot;SMB&quot;
5360         echo -n $&quot;Shutting down $KIND services: &quot;
5361         killproc smbd
5362         RETVAL=$?
5363         echo
5364         KIND=&quot;NMB&quot;
5365         echo -n $&quot;Shutting down $KIND services: &quot;
5366         killproc nmbd
5367         RETVAL2=$?
5368         echo
5369         KIND=&quot;Winbind&quot;
5370         echo -n $&quot;Shutting down $KIND services: &quot;
5371         killproc winbindd
5372         RETVAL3=$?
5373         [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] &amp;&amp; \
5374                  rm -f /var/lock/subsys/smb
5375         echo &quot;&quot;
5376         return $RETVAL
5377 }
5378 </pre></div><div class="sect4" lang="en"><div class="titlepage"><div><h5 class="title"><a name="id2876648"></a>Solaris</h5></div></div><p>Winbind doesn't work on solaris 9, see the <a href="#winbind-solaris9" title="Winbind on Solaris 9">Portability</a> chapter for details.</p><p>On solaris, you need to modify the 
5379 <tt>/etc/init.d/samba.server</tt> startup script. It usually 
5380 only starts smbd and nmbd but should now start winbindd too. If you 
5381 have samba installed in <tt>/usr/local/samba/bin</tt>, 
5382 the file could contains something like this:
5383 </p><pre class="programlisting">
5384         ##
5385         ## samba.server
5386         ##
5387
5388         if [ ! -d /usr/bin ]
5389         then                    # /usr not mounted
5390                 exit
5391         fi
5392
5393         killproc() {            # kill the named process(es)
5394                 pid=`/usr/bin/ps -e |
5395                      /usr/bin/grep -w $1 |
5396                      /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
5397                 [ &quot;$pid&quot; != &quot;&quot; ] &amp;&amp; kill $pid
5398         }
5399          
5400         # Start/stop processes required for samba server
5401
5402         case &quot;$1&quot; in
5403
5404         'start')
5405         #
5406         # Edit these lines to suit your installation (paths, workgroup, host)
5407         #
5408         echo Starting SMBD
5409            /usr/local/samba/bin/smbd -D -s \
5410                 /usr/local/samba/smb.conf
5411
5412         echo Starting NMBD
5413            /usr/local/samba/bin/nmbd -D -l \
5414                 /usr/local/samba/var/log -s /usr/local/samba/smb.conf
5415
5416         echo Starting Winbind Daemon
5417            /usr/local/samba/bin/winbindd
5418            ;;
5419
5420         'stop')
5421            killproc nmbd
5422            killproc smbd
5423            killproc winbindd
5424            ;;
5425
5426         *)
5427            echo &quot;Usage: /etc/init.d/samba.server { start | stop }&quot;
5428            ;;
5429         esac
5430 </pre><p>
5431 Again, if you would like to run samba in dual daemon mode, replace 
5432 </p><pre class="programlisting">
5433         /usr/local/samba/bin/winbindd
5434 </pre><p>
5435
5436 in the script above with:
5437
5438 </p><pre class="programlisting">
5439         /usr/local/samba/bin/winbindd -B
5440 </pre><p>
5441 </p></div><div class="sect4" lang="en"><div class="titlepage"><div><h5 class="title"><a name="id2876749"></a>Restarting</h5></div></div><p>
5442 If you restart the <b>smbd</b>, <b>nmbd</b>, 
5443 and <b>winbindd</b> daemons at this point, you
5444 should be able to connect to the samba server as a domain member just as
5445 if you were a local user.
5446 </p></div></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2876785"></a>Configure Winbind and PAM</h4></div></div><p>
5447 If you have made it this far, you know that winbindd and samba are working
5448 together.  If you want to use winbind to provide authentication for other 
5449 services, keep reading.  The pam configuration files need to be altered in
5450 this step.  (Did you remember to make backups of your original 
5451 <tt>/etc/pam.d</tt> files? If not, do it now.)
5452 </p><p>
5453 You will need a pam module to use winbindd with these other services.  This 
5454 module will be compiled in the <tt>../source/nsswitch</tt> directory
5455 by invoking the command
5456 </p><p>
5457 <tt>root#</tt> <b>make nsswitch/pam_winbind.so</b>
5458 </p><p>
5459 from the <tt>../source</tt> directory.  The
5460 <tt>pam_winbind.so</tt> file should be copied to the location of
5461 your other pam security modules.  On my RedHat system, this was the
5462 <tt>/lib/security</tt> directory. On Solaris, the pam security 
5463 modules reside in <tt>/usr/lib/security</tt>.
5464 </p><p>
5465 <tt>root#</tt> <b>cp ../samba/source/nsswitch/pam_winbind.so /lib/security</b>
5466 </p><div class="sect4" lang="en"><div class="titlepage"><div><h5 class="title"><a name="id2876895"></a>Linux/FreeBSD-specific PAM configuration</h5></div></div><p>
5467 The <tt>/etc/pam.d/samba</tt> file does not need to be changed. I 
5468 just left this fileas it was:
5469 </p><pre class="programlisting">
5470         auth    required        /lib/security/pam_stack.so service=system-auth
5471         account required        /lib/security/pam_stack.so service=system-auth
5472 </pre><p>
5473 The other services that I modified to allow the use of winbind 
5474 as an authentication service were the normal login on the console (or a terminal 
5475 session), telnet logins, and ftp service.  In order to enable these 
5476 services, you may first need to change the entries in 
5477 <tt>/etc/xinetd.d</tt> (or <tt>/etc/inetd.conf</tt>).  
5478 RedHat 7.1 uses the new xinetd.d structure, in this case you need 
5479 to change the lines in <tt>/etc/xinetd.d/telnet</tt> 
5480 and <tt>/etc/xinetd.d/wu-ftp</tt> from 
5481 </p><pre class="programlisting">
5482         enable = no
5483 </pre><p>
5484 to
5485 </p><pre class="programlisting">
5486         enable = yes
5487 </pre><p>       
5488 For ftp services to work properly, you will also need to either 
5489 have individual directories for the domain users already present on 
5490 the server, or change the home directory template to a general
5491 directory for all domain users.  These can be easily set using 
5492 the <tt>smb.conf</tt> global entry 
5493 <b>template homedir</b>.
5494 </p><p>
5495 The <tt>/etc/pam.d/ftp</tt> file can be changed 
5496 to allow winbind ftp access in a manner similar to the
5497 samba file.  My <tt>/etc/pam.d/ftp</tt> file was 
5498 changed to look like this:
5499 </p><pre class="programlisting">
5500         auth       required     /lib/security/pam_listfile.so item=user sense=deny \
5501                  file=/etc/ftpusers onerr=succeed
5502         auth       sufficient   /lib/security/pam_winbind.so
5503         auth       required     /lib/security/pam_stack.so service=system-auth
5504         auth       required     /lib/security/pam_shells.so
5505         account    sufficient   /lib/security/pam_winbind.so
5506         account    required     /lib/security/pam_stack.so service=system-auth
5507         session    required     /lib/security/pam_stack.so service=system-auth
5508 </pre><p>
5509 The <tt>/etc/pam.d/login</tt> file can be changed nearly the 
5510 same way.  It now looks like this:
5511 </p><pre class="programlisting">
5512         auth       required     /lib/security/pam_securetty.so
5513         auth       sufficient   /lib/security/pam_winbind.so
5514         auth       sufficient   /lib/security/pam_unix.so use_first_pass
5515         auth       required     /lib/security/pam_stack.so service=system-auth
5516         auth       required     /lib/security/pam_nologin.so
5517         account    sufficient   /lib/security/pam_winbind.so
5518         account    required     /lib/security/pam_stack.so service=system-auth
5519         password   required     /lib/security/pam_stack.so service=system-auth
5520         session    required     /lib/security/pam_stack.so service=system-auth
5521         session    optional     /lib/security/pam_console.so
5522 </pre><p>
5523 In this case, I added the <b>auth sufficient /lib/security/pam_winbind.so</b> 
5524 lines as before, but also added the <b>required pam_securetty.so</b> 
5525 above it, to disallow root logins over the network.  I also added a 
5526 <b>sufficient /lib/security/pam_unix.so use_first_pass</b>
5527 line after the <b>winbind.so</b> line to get rid of annoying 
5528 double prompts for passwords.
5529 </p></div><div class="sect4" lang="en"><div class="titlepage"><div><h5 class="title"><a name="id2877118"></a>Solaris-specific configuration</h5></div></div><p>
5530 The /etc/pam.conf needs to be changed. I changed this file so that my Domain
5531 users can logon both locally as well as telnet.The following are the changes
5532 that I made.You can customize the pam.conf file as per your requirements,but
5533 be sure of those changes because in the worst case it will leave your system
5534 nearly impossible to boot.
5535 </p><pre class="programlisting">
5536         #
5537         #ident  &quot;@(#)pam.conf      1.14    99/09/16 SMI&quot;
5538         #
5539         # Copyright (c) 1996-1999, Sun Microsystems, Inc.
5540         # All Rights Reserved.
5541         #
5542         # PAM configuration
5543         #
5544         # Authentication management
5545         #
5546         login   auth required   /usr/lib/security/pam_winbind.so
5547         login   auth required   /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass 
5548         login   auth required   /usr/lib/security/$ISA/pam_dial_auth.so.1 try_first_pass 
5549         #
5550         rlogin  auth sufficient /usr/lib/security/pam_winbind.so
5551         rlogin  auth sufficient /usr/lib/security/$ISA/pam_rhosts_auth.so.1
5552         rlogin  auth required   /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
5553         #
5554         dtlogin auth sufficient /usr/lib/security/pam_winbind.so
5555         dtlogin auth required   /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
5556         #
5557         rsh     auth required   /usr/lib/security/$ISA/pam_rhosts_auth.so.1
5558         other   auth sufficient /usr/lib/security/pam_winbind.so
5559         other   auth required   /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
5560         #
5561         # Account management
5562         #
5563         login   account sufficient      /usr/lib/security/pam_winbind.so
5564         login   account requisite       /usr/lib/security/$ISA/pam_roles.so.1 
5565         login   account required        /usr/lib/security/$ISA/pam_unix.so.1 
5566         #
5567         dtlogin account sufficient      /usr/lib/security/pam_winbind.so
5568         dtlogin account requisite       /usr/lib/security/$ISA/pam_roles.so.1 
5569         dtlogin account required        /usr/lib/security/$ISA/pam_unix.so.1 
5570         #
5571         other   account sufficient      /usr/lib/security/pam_winbind.so
5572         other   account requisite       /usr/lib/security/$ISA/pam_roles.so.1 
5573         other   account required        /usr/lib/security/$ISA/pam_unix.so.1 
5574         #
5575         # Session management
5576         #
5577         other   session required        /usr/lib/security/$ISA/pam_unix.so.1 
5578         #
5579         # Password management
5580         #
5581         #other   password sufficient     /usr/lib/security/pam_winbind.so
5582         other   password required       /usr/lib/security/$ISA/pam_unix.so.1 
5583         dtsession auth required /usr/lib/security/$ISA/pam_unix.so.1
5584         #
5585         # Support for Kerberos V5 authentication (uncomment to use Kerberos)
5586         #
5587         #rlogin auth optional   /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
5588         #login  auth optional   /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
5589         #dtlogin        auth optional   /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
5590         #other  auth optional   /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
5591         #dtlogin        account optional /usr/lib/security/$ISA/pam_krb5.so.1
5592         #other  account optional /usr/lib/security/$ISA/pam_krb5.so.1
5593         #other  session optional /usr/lib/security/$ISA/pam_krb5.so.1
5594         #other  password optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
5595 </pre><p>
5596 I also added a try_first_pass line after the winbind.so line to get rid of
5597 annoying double prompts for passwords.
5598 </p><p>
5599 Now restart your Samba and try connecting through your application that you
5600 configured in the pam.conf.
5601 </p></div></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2877210"></a>Limitations</h2></div></div><p>Winbind has a number of limitations in its current 
5602         released version that we hope to overcome in future 
5603         releases:</p><div class="itemizedlist"><ul type="disc"><li><p>Winbind is currently only available for 
5604                 the Linux, Solaris and IRIX operating systems, although ports to other operating 
5605                 systems are certainly possible. For such ports to be feasible, 
5606                 we require the C library of the target operating system to 
5607                 support the Name Service Switch and Pluggable Authentication
5608                 Modules systems. This is becoming more common as NSS and 
5609                 PAM gain        support among UNIX vendors.</p></li><li><p>The mappings of Windows NT RIDs to UNIX ids 
5610                 is not made algorithmically and depends on the order in which 
5611                 unmapped users or groups are seen by winbind. It may be difficult 
5612                 to recover the mappings of rid to UNIX id mapping if the file 
5613                 containing this information is corrupted or destroyed.</p></li><li><p>Currently the winbind PAM module does not take 
5614                 into account possible workstation and logon time restrictions 
5615                 that may be been set for Windows NT users, this is
5616                 instead up to the PDC to enforce.</p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2877264"></a>Conclusion</h2></div></div><p>The winbind system, through the use of the Name Service 
5617         Switch, Pluggable Authentication Modules, and appropriate 
5618         Microsoft RPC calls have allowed us to provide seamless 
5619         integration of Microsoft Windows NT domain users on a
5620         UNIX system. The result is a great reduction in the administrative 
5621         cost of running a mixed UNIX and NT network.</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="AdvancedNetworkManagement"></a>Chapter 16. Advanced Network Manangement</h2></div><div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">April 3 2003</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2875143">Configuring Samba Share Access Controls</a></dt><dd><dl><dt><a href="#id2874905">Share Permissions Management</a></dt></dl></dd><dt><a href="#id2874974">Remote Server Administration</a></dt><dt><a href="#id2875057">Network Logon Script Magic</a></dt><dd><dl><dt><a href="#id2877889">Adding printers without user intervention</a></dt></dl></dd></dl></div><p>
5622 This section attempts to document peripheral issues that are of great importance to network
5623 administrators who want to improve network resource access control, to automate the user
5624 environment, and to make their lives a little easier.
5625 </p><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2875143"></a>Configuring Samba Share Access Controls</h2></div></div><p>
5626 This section deals with how to configure Samba per share access control restrictions.
5627 By default samba sets no restrictions on the share itself. Restrictions on the share itself
5628 can be set on MS Windows NT4/200x/XP shares. This can be a very effective way to limit who can
5629 connect to a share. In the absence of specific restrictions the default setting is to allow
5630 the global user <span class="emphasis"><em>Everyone</em></span> Full Control (ie: Full control, Change and Read).
5631 </p><p>
5632 At this time Samba does NOT provide a tool for configuring access control setting on the Share
5633 itself. Samba does have the capacity to store and act on access control settings, but  the only
5634 way to create those settings is to use either the NT4 Server Manager or the Windows 200x MMC for
5635 Computer Management.
5636 </p><p>
5637 Samba stores the per share access control settings in a file called <tt>share_info.tdb</tt>.
5638 The location of this file on your system will depend on how samba was compiled. The default location
5639 for samba's tdb files is under <tt>/usr/local/samba/var</tt>. If the <tt>tdbdump</tt>
5640 utility has been compiled and installed on your system then you can examine the contents of this file
5641 by: <b><tt>tdbdump share_info.tdb</tt></b>.
5642 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2874905"></a>Share Permissions Management</h3></div></div><p>
5643 The best tool for the task is platform dependant. Choose the best tool for your environmemt.
5644 </p><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2874919"></a>Windows NT4 Workstation/Server</h4></div></div><p>
5645 The tool you need to use to manage share permissions on a Samba server is the NT Server Manager.
5646 Server Manager is shipped with Windows NT4 Server products but not with Windows NT4 Workstation.
5647 You can obtain the NT Server Manager for MS Windows NT4 Workstation from Microsoft - see details below.
5648 </p><div class="procedure"><p class="title"><b>Procedure 16.1. Instructions</b></p><ol type="1"><li><p>
5649 Launch the NT4 Server Manager, click on the Samba server you want to administer, then from the menu
5650 select Computer, then click on the Shared Directories entry.
5651 </p></li><li><p>
5652         Now click on the share that you wish to manage, then click on the Properties tab, next click on
5653         the Permissions tab. Now you can Add or change access control settings as you wish.
5654 </p></li></ol></div></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2877329"></a>Windows 200x/XP</h4></div></div><p>
5655 On MS Windows NT4/200x/XP system access control lists on the share itself are set using native
5656 tools, usually from filemanager. For example, in Windows 200x: right click on the shared folder,
5657 then select 'Sharing', then click on 'Permissions'. The default Windows NT4/200x permission allows
5658 <span class="emphasis"><em>Everyone</em></span> Full Control on the Share.
5659 </p><p>
5660 MS Windows 200x and later all comes with a tool called the 'Computer Management' snap-in for the
5661 Microsoft Management Console (MMC). This tool is located by clicking on <tt>Control Panel -&gt;
5662 Administrative Tools -&gt; Computer Management</tt>.
5663 </p><div class="procedure"><p class="title"><b>Procedure 16.2. Instructions</b></p><ol type="1"><li><p>
5664         After launching the MMC with the Computer Management snap-in, click on the menu item 'Action',
5665         select 'Connect to another computer'. If you are not logged onto a domain you will be prompted
5666         to enter a domain login user identifier and a password. This will authenticate you to the domain.
5667         If you where already logged in with administrative privilidge this step is not offered.
5668 </p></li><li><p>
5669 If the Samba server is not shown in the Select Computer box, then type in the name of the target
5670 Samba server in the field 'Name:'. Now click on the [+] next to 'System Tools', then on the [+]
5671 next to 'Shared Folders' in the left panel.
5672 </p></li><li><p>
5673 Now in the right panel, double-click on the share you wish to set access control permissions on.
5674 Then click on the tab 'Share Permissions'. It is now possible to add access control entities
5675 to the shared folder. Do NOT forget to set what type of access (full control, change, read) you
5676 wish to assign for each entry.
5677 </p></li></ol></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>
5678 Be careful. If you take away all permissions from the Everyone user without removing this user
5679 then effectively no user will be able to access the share. This is a result of what is known as
5680 ACL precidence. ie: Everyone with NO ACCESS means that MaryK who is part of the group Everyone
5681 will have no access even if this user is given explicit full control access.
5682 </p></div></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2874974"></a>Remote Server Administration</h2></div></div><p>
5683 <span class="emphasis"><em>How do I get 'User Manager' and 'Server Manager'?</em></span>
5684 </p><p>
5685 Since I don't need to buy an NT4 Server, how do I get the 'User Manager for Domains',
5686 the 'Server Manager'?
5687 </p><p>
5688 Microsoft distributes a version of these tools called nexus for installation on Windows 9x / Me
5689 systems.  The tools set includes:
5690 </p><div class="itemizedlist"><ul type="disc"><li><p>Server Manager</p></li><li><p>User Manager for Domains</p></li><li><p>Event Viewer</p></li></ul></div><p>
5691 Click here to download the archived file <a href="ftp://ftp.microsoft.com/Softlib/MSLFILES/NEXUS.EXE" target="_top">ftp://ftp.microsoft.com/Softlib/MSLFILES/NEXUS.EXE</a>
5692 </p><p>
5693 The Windows NT 4.0 version of the 'User Manager for 
5694 Domains' and 'Server Manager' are available from Microsoft via ftp 
5695 from <a href="ftp://ftp.microsoft.com/Softlib/MSLFILES/SRVTOOLS.EXE" target="_top">ftp://ftp.microsoft.com/Softlib/MSLFILES/SRVTOOLS.EXE</a>
5696 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2875057"></a>Network Logon Script Magic</h2></div></div><p>
5697 This section needs work. Volunteer contributions most welcome. Please send your patches or updates
5698 to <a href="mailto:jht@samba.org" target="_top">John Terpstra</a>.
5699 </p><p>
5700 There are several opportunities for creating a custom network startup configuration environment.
5701 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>No Logon Script</td></tr><tr><td>Simple universal Logon Script that applies to all users</td></tr><tr><td>Use of a conditional Logon Script that applies per user or per group attirbutes</td></tr><tr><td>Use of Samba's Preexec and Postexec functions on access to the NETLOGON share to create
5702         a custom Logon Script and then execute it.</td></tr><tr><td>User of a tool such as KixStart</td></tr></table><p>
5703 The Samba source code tree includes two logon script generation/execution tools. See <tt>examples</tt> directory <tt>genlogon</tt> and <tt>ntlogon</tt> subdirectories.
5704 </p><p>
5705 The following listings are from the genlogon directory.
5706 </p><p>
5707 This is the genlogon.pl file:
5708
5709 </p><pre class="programlisting">
5710         #!/usr/bin/perl
5711         #
5712         # genlogon.pl
5713         #
5714         # Perl script to generate user logon scripts on the fly, when users
5715         # connect from a Windows client.  This script should be called from smb.conf
5716         # with the %U, %G and %L parameters. I.e:
5717         #
5718         #       root preexec = genlogon.pl %U %G %L
5719         #
5720         # The script generated will perform
5721         # the following:
5722         #
5723         # 1. Log the user connection to /var/log/samba/netlogon.log
5724         # 2. Set the PC's time to the Linux server time (which is maintained
5725         #    daily to the National Institute of Standard's Atomic clock on the
5726         #    internet.
5727         # 3. Connect the user's home drive to H: (H for Home).
5728         # 4. Connect common drives that everyone uses.
5729         # 5. Connect group-specific drives for certain user groups.
5730         # 6. Connect user-specific drives for certain users.
5731         # 7. Connect network printers.
5732
5733         # Log client connection
5734         #($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
5735         ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
5736         open LOG, &quot;&gt;&gt;/var/log/samba/netlogon.log&quot;;
5737         print LOG &quot;$mon/$mday/$year $hour:$min:$sec - User $ARGV[0] logged into $ARGV[1]\n&quot;;
5738         close LOG;
5739
5740         # Start generating logon script
5741         open LOGON, &quot;&gt;/shared/netlogon/$ARGV[0].bat&quot;;
5742         print LOGON &quot;\@ECHO OFF\r\n&quot;;
5743
5744         # Connect shares just use by Software Development group
5745         if ($ARGV[1] eq &quot;SOFTDEV&quot; || $ARGV[0] eq &quot;softdev&quot;)
5746         {
5747                 print LOGON &quot;NET USE M: \\\\$ARGV[2]\\SOURCE\r\n&quot;;
5748         }
5749
5750         # Connect shares just use by Technical Support staff
5751         if ($ARGV[1] eq &quot;SUPPORT&quot; || $ARGV[0] eq &quot;support&quot;)
5752         {
5753                 print LOGON &quot;NET USE S: \\\\$ARGV[2]\\SUPPORT\r\n&quot;;
5754         }
5755
5756         # Connect shares just used by Administration staff
5757         If ($ARGV[1] eq &quot;ADMIN&quot; || $ARGV[0] eq &quot;admin&quot;)
5758         {
5759                 print LOGON &quot;NET USE L: \\\\$ARGV[2]\\ADMIN\r\n&quot;;
5760                 print LOGON &quot;NET USE K: \\\\$ARGV[2]\\MKTING\r\n&quot;;
5761         }
5762
5763         # Now connect Printers.  We handle just two or three users a little
5764         # differently, because they are the exceptions that have desktop
5765         # printers on LPT1: - all other user's go to the LaserJet on the
5766         # server.
5767         if ($ARGV[0] eq 'jim'
5768             || $ARGV[0] eq 'yvonne')
5769         {
5770                 print LOGON &quot;NET USE LPT2: \\\\$ARGV[2]\\LJET3\r\n&quot;;
5771                 print LOGON &quot;NET USE LPT3: \\\\$ARGV[2]\\FAXQ\r\n&quot;;
5772         }
5773         else
5774         {
5775                 print LOGON &quot;NET USE LPT1: \\\\$ARGV[2]\\LJET3\r\n&quot;;
5776                 print LOGON &quot;NET USE LPT3: \\\\$ARGV[2]\\FAXQ\r\n&quot;;
5777         }
5778
5779         # All done! Close the output file.
5780         close LOGON;
5781 </pre><p>
5782 </p><p>
5783 Those wishing to use more elaborate or capable logon processing system should check out the following sites:
5784 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>http://www.craigelachie.org/rhacer/ntlogon</td></tr><tr><td>http://www.kixtart.org</td></tr><tr><td>http://support.microsoft.com/default.asp?scid=kb;en-us;189105</td></tr></table><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2877889"></a>Adding printers without user intervention</h3></div></div><p>
5785 Printers may be added automatically during logon script processing through the use of:
5786
5787 </p><pre class="programlisting">
5788         rundll32 printui.dll,PrintUIEntry /?
5789 </pre><p>
5790
5791 See the documentation in the Microsoft knowledgebase article no: 189105 referred to above.
5792 </p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="PolicyMgmt"></a>Chapter 17. System and Account Policies</h2></div><div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">April 3 2003</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2877672">Creating and Managing System Policies</a></dt><dd><dl><dt><a href="#id2877925">Windows 9x/Me Policies</a></dt><dt><a href="#id2878014">Windows NT4 Style Policy Files</a></dt><dt><a href="#id2878140">MS Windows 200x / XP Professional Policies</a></dt></dl></dd><dt><a href="#id2878344">Managing Account/User Policies</a></dt><dd><dl><dt><a href="#id2878457">With Windows NT4/200x</a></dt><dt><a href="#id2878478">With a Samba PDC</a></dt></dl></dd><dt><a href="#id2878502">System Startup and Logon Processing Overview</a></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2877672"></a>Creating and Managing System Policies</h2></div></div><p>
5793 Under MS Windows platforms, particularly those following the release of MS Windows
5794 NT4 and MS Windows 95) it is possible to create a type of file that would be placed
5795 in the NETLOGON share of a domain controller. As the client logs onto the network
5796 this file is read and the contents initiate changes to the registry of the client
5797 machine. This file allows changes to be made to those parts of the registry that
5798 affect users, groups of users, or machines.
5799 </p><p>
5800 For MS Windows 9x/Me this file must be called <tt>Config.POL</tt> and may
5801 be generated using a tool called <tt>poledit.exe</tt>, better known as the
5802 Policy Editor. The policy editor was provided on the Windows 98 installation CD, but
5803 dissappeared again with the introduction of MS Windows Me (Millenium Edition). From
5804 comments from MS Windows network administrators it would appear that this tool became
5805 a part of the MS Windows Me Resource Kit.
5806 </p><p>
5807 MS Windows NT4 Server products include the <span class="emphasis"><em>System Policy Editor</em></span>
5808 under the <tt>Start -&gt; Programs -&gt; Administrative Tools</tt> menu item.
5809 For MS Windows NT4 and later clients this file must be called <tt>NTConfig.POL</tt>.
5810 </p><p>
5811 New with the introduction of MS Windows 2000 was the Microsoft Management Console
5812 or MMC.  This tool is the new wave in the ever changing landscape of Microsoft
5813 methods for management of network access and security. Every new Microsoft product
5814 or technology seems to obsolete the old rules and to introduce newer and more
5815 complex tools and methods. To Microsoft's credit though, the MMC does appear to
5816 be a step forward, but improved functionality comes at a great price.
5817 </p><p>
5818 Before embarking on the configuration of network and system policies it is highly
5819 advisable to read the documentation available from Microsoft's web site regarding
5820 <a href="http://www.microsoft.com/ntserver/management/deployment/planguide/prof_policies.asp" target="_top">
5821 Implementing Profiles and Policies in Windows NT 4.0 from http://www.microsoft.com/ntserver/management/deployment/planguide/prof_policies.asp</a> available from Microsoft.
5822 There are a large number of documents in addition to this old one that should also
5823 be read and understood. Try searching on the Microsoft web site for &quot;Group Policies&quot;.
5824 </p><p>
5825 What follows is a very brief discussion with some helpful notes. The information provided
5826 here is incomplete - you are warned.
5827 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2877925"></a>Windows 9x/Me Policies</h3></div></div><p>
5828 You need the Win98 Group Policy Editor to set Group Profiles up under Windows 9x/Me.
5829 It can be found on the Original full product Win98 installation CD under
5830 <tt>tools/reskit/netadmin/poledit</tt>.  Install this using the
5831 Add/Remove Programs facility and then click on the 'Have Disk' tab.
5832 </p><p>
5833 Use the Group Policy Editor to create a policy file that specifies the location of
5834 user profiles and/or the <tt>My Documents</tt> etc.  stuff. Then
5835 save these settings in a file called <tt>Config.POL</tt> that needs to
5836 be placed in the root of the [NETLOGON] share. If Win98 is configured to log onto
5837 the Samba Domain, it will automatically read this file and update the Win9x/Me registry
5838 of the machine as it logs on.
5839 </p><p>
5840 Further details are covered in the Win98 Resource Kit documentation.
5841 </p><p>
5842 If you do not take the right steps, then every so often Win9x/Me will check the
5843 integrity of the registry and will restore it's settings from the back-up
5844 copy of the registry it stores on each Win9x/Me machine. Hence, you will
5845 occasionally notice things changing back to the original settings.
5846 </p><p>
5847 Install the group policy handler for Win9x to pick up group policies. Look on the
5848 Win98 CD in <tt>\tools\reskit\netadmin\poledit</tt>.
5849 Install group policies on a Win9x client by double-clicking
5850 <tt>grouppol.inf</tt>. Log off and on again a couple of times and see
5851 if Win98 picks up group policies.  Unfortunately this needs to be done on every
5852 Win9x/Me machine that uses group policies.
5853 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2878014"></a>Windows NT4 Style Policy Files</h3></div></div><p>
5854 To create or edit <tt>ntconfig.pol</tt> you must use the NT Server
5855 Policy Editor, <b>poledit.exe</b> which is included with NT4 Server
5856 but <span class="emphasis"><em>not NT Workstation</em></span>. There is a Policy Editor on a NT4
5857 Workstation but it is not suitable for creating <span class="emphasis"><em>Domain Policies</em></span>.
5858 Further, although the Windows 95 Policy Editor can be installed on an NT4
5859 Workstation/Server, it will not work with NT clients. However, the files from
5860 the NT Server will run happily enough on an NT4 Workstation.
5861 </p><p>
5862 You need <tt>poledit.exe, common.adm</tt> and <tt>winnt.adm</tt>.
5863 It is convenient to put the two *.adm files in  the <tt>c:\winnt\inf</tt> 
5864 directory which is where the binary will look for them unless told otherwise. Note also that that
5865 directory is normally 'hidden'.
5866 </p><p>
5867 The Windows NT policy editor is also included with the Service Pack 3 (and
5868 later) for Windows NT 4.0. Extract the files using <b>servicepackname /x</b>,
5869 i.e. that's <b>Nt4sp6ai.exe /x</b> for service pack 6a.  The policy editor,
5870 <b>poledit.exe</b> and the associated template files (*.adm) should
5871 be extracted as well.  It is also possible to downloaded the policy template
5872 files for Office97 and get a copy of the policy editor.  Another possible
5873 location is with the Zero Administration Kit available for download from Microsoft.
5874 </p><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2878116"></a>Registry Tattoos</h4></div></div><p>
5875         With NT4 style registry based policy changes, a large number of settings are not
5876         automatically reversed as the user logs off. Since the settings that were in the
5877         NTConfig.POL file were applied to the client machine registry and that apply to the
5878         hive key HKEY_LOCAL_MACHINE are permanent until explicitly reversed. This is known
5879         as tattooing. It can have serious consequences down-stream and the administrator must
5880         be extremely careful not to lock out the ability to manage the machine at a later date.
5881         </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2878140"></a>MS Windows 200x / XP Professional Policies</h3></div></div><p>
5882 Windows NT4 System policies allows setting of registry parameters specific to
5883 users, groups and computers (client workstations) that are members of the NT4
5884 style domain. Such policy file will work with MS Windows 2000 / XP clients also.
5885 </p><p>
5886 New to MS Windows 2000 Microsoft introduced a new style of group policy that confers
5887 a superset of capabilities compared with NT4 style policies. Obviously, the tool used
5888 to create them is different, and the mechanism for implementing them is much changed.
5889 </p><p>
5890 The older NT4 style registry based policies are known as <span class="emphasis"><em>Administrative Templates</em></span>
5891 in MS Windows 2000/XP Group Policy Objects (GPOs). The later includes ability to set various security
5892 configurations, enforce Internet Explorer browser settings, change and redirect aspects of the
5893 users' desktop (including: the location of <span class="emphasis"><em>My Documents</em></span> files (directory), as
5894 well as intrinsics of where menu items will appear in the Start menu). An additional new
5895 feature is the ability to make available particular software Windows applications to particular
5896 users and/or groups.
5897 </p><p>
5898 Remember: NT4 policy files are named <tt>NTConfig.POL</tt> and are stored in the root
5899 of the NETLOGON share on the domain controllers. A Windows NT4 user enters a username, a password
5900 and selects the domain name to which the logon will attempt to take place. During the logon
5901 process the client machine reads the NTConfig.POL file from the NETLOGON share on the authenticating
5902 server, modifies the local registry values according to the settings in this file.
5903 </p><p>
5904 Windows 2K GPOs are very feature rich. They are NOT stored in the NETLOGON share, rather part of
5905 a Windows 200x policy file is stored in the Active Directory itself and the other part is stored
5906 in a shared (and replicated) volume called the SYSVOL folder. This folder is present on all Active
5907 Directory domain controllers. The part that is stored in the Active Directory itself is called the
5908 group policy container (GPC), and the part that is stored in the replicated share called SYSVOL is
5909 known as the group policy template (GPT).
5910 </p><p>
5911 With NT4 clients the policy file is read and executed upon only as each user logs onto the network.
5912 MS Windows 200x policies are much more complex - GPOs are processed and applied at client machine
5913 startup (machine specific part) and when the user logs onto the network the user specific part
5914 is applied. In MS Windows 200x style policy management each machine and/or user may be subject
5915 to any number of concurently applicable (and applied) policy sets (GPOs). Active Directory allows
5916 the administrator to also set filters over the policy settings. No such equivalent capability
5917 exists with NT4 style policy files.
5918 </p><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2878237"></a>Administration of Win2K / XP Policies</h4></div><div><h4 class="title"><a name="id2878237"></a>Administration of Win2K / XP Policies</h4></div></div><p>
5919 Instead of using the tool called &quot;The System Policy Editor&quot;, commonly called Poledit (from the
5920 executable name poledit.exe), GPOs are created and managed using a Microsoft Management Console
5921 (MMC) snap-in as follows:</p><div class="procedure"><ol type="1"><li><p>
5922 Go to the Windows 200x / XP menu <tt>Start-&gt;Programs-&gt;Administrative Tools</tt>
5923         and select the MMC snap-in called &quot;Active Directory Users and Computers&quot;
5924 </p></li><li><p>
5925 Select the domain or organizational unit (OU) that you wish to manage, then right click
5926 to open the context menu for that object, select the properties item.
5927 </p></li><li><p>
5928 Now left click on the Group Policy tab, then left click on the New tab. Type a name
5929 for the new policy you will create.
5930 </p></li><li><p>
5931 Now left click on the Edit tab to commence the steps needed to create the GPO.
5932 </p></li></ol></div><p>
5933 All policy configuration options are controlled through the use of policy administrative
5934 templates. These files have a .adm extension, both in NT4 as well as in Windows 200x / XP.
5935 Beware however, since the .adm files are NOT interchangible across NT4 and Windows 200x.
5936 The later introduces many new features as well as extended definition capabilities. It is
5937 well beyond the scope of this documentation to explain how to program .adm files, for that
5938 the adminsitrator is referred to the Microsoft Windows Resource Kit for your particular
5939 version of MS Windows.
5940 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
5941 The MS Windows 2000 Resource Kit contains a tool called gpolmig.exe. This tool can be used
5942 to migrate an NT4 NTConfig.POL file into a Windows 200x style GPO. Be VERY careful how you
5943 use this powerful tool. Please refer to the resource kit manuals for specific usage information.
5944 </p></div></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2878344"></a>Managing Account/User Policies</h2></div></div><p>
5945 Policies can define a specific user's settings or the settings for a group of users. The resulting
5946 policy file contains the registry settings for all users, groups, and computers that will be using
5947 the policy file. Separate policy files for each user, group, or computer are not not necessary.
5948 </p><p>
5949 If you create a policy that will be automatically downloaded from validating domain controllers,
5950 you should name the file NTconfig.POL. As system administrator, you have the option of renaming the
5951 policy file and, by modifying the Windows NT-based workstation, directing the computer to update
5952 the policy from a manual path. You can do this by either manually changing the registry or by using
5953 the System Policy Editor. This path can even be a local path such that each machine has its own policy file,
5954 but if a change is necessary to all machines, this change must be made individually to each workstation.
5955 </p><p>
5956 When a Windows NT4/200x/XP machine logs onto the network the NETLOGON share on the authenticating domain 
5957 controller for the presence of the NTConfig.POL file. If one exists it is downloaded, parsed and then
5958 applied to the user's part of the registry.
5959 </p><p>
5960 MS Windows 200x/XP clients that log onto an MS Windows Active Directory security domain may additionally,
5961 acquire policy settings through Group Policy Objects (GPOs) that are defined and stored in Active Directory
5962 itself. The key benefit of using AS GPOs is that they impose no registry <span class="emphasis"><em>tatooing</em></span> effect.
5963 This has considerable advanage compared with the use of NTConfig.POL (NT4) style policy updates.
5964 </p><p>
5965 In addition to user access controls that may be imposed or applied via system and/or group policies
5966 in a manner that works in conjunction with user profiles, the user management environment under
5967 MS Windows NT4/200x/XP allows per domain as well as per user account restrictions to be applied.
5968 Common restrictions that are frequently used includes:
5969 </p><p>
5970 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>Logon Hours</td></tr><tr><td>Password Aging</td></tr><tr><td>Permitted Logon from certain machines only</td></tr><tr><td>Account type (Local or Global)</td></tr><tr><td>User Rights</td></tr></table><p>
5971 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2878457"></a>With Windows NT4/200x</h3></div></div><p>
5972 The tools that may be used to configure these types of controls from the MS Windows environment are:
5973 The NT4 User Manager for domains, the NT4 System and Group Policy Editor, the registry editor (regedt32.exe).
5974 Under MS Windows 200x/XP this is done using the Microsoft Managment Console (MMC) with approapriate
5975 &quot;snap-ins&quot;, the registry editor, and potentially also the NT4 System and Group Policy Editor.
5976 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2878478"></a>With a Samba PDC</h3></div></div><p>
5977 With a Samba Domain Controller, the new tools for managing of user account and policy information includes:
5978 <tt>smbpasswd, pdbedit, net, rpcclient.</tt>. The administrator should read the
5979 man pages for these tools and become familiar with their use.
5980 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2878502"></a>System Startup and Logon Processing Overview</h2></div></div><p>
5981 The following attempts to document the order of processing of system and user policies following a system
5982 reboot and as part of the user logon:
5983 </p><div class="orderedlist"><ol type="1"><li><p>
5984         Network starts, then Remote Procedure Call System Service (RPCSS) and Multiple Universal Naming
5985         Convention Provider (MUP) start
5986         </p></li><li><p>
5987         Where Active Directory is involved, an ordered list of Group Policy Objects (GPOs) is downloaded
5988         and applied. The list may include GPOs that:
5989 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>Apply to the location of machines in a Directory</td></tr><tr><td>Apply only when settings have changed</td></tr><tr><td>Depend on configuration of scope of applicability: local, site, domain, organizational unit, etc.</td></tr></table><p>
5990         No desktop user interface is presented until the above have been processed.
5991         </p></li><li><p>
5992         Execution of start-up scripts (hidden and synchronous by defaut).
5993         </p></li><li><p>
5994         A keyboard action to affect start of logon (Ctrl-Alt-Del).
5995         </p></li><li><p>
5996         User credentials are validated, User profile is loaded (depends on policy settings).
5997         </p></li><li><p>
5998         An ordered list of User GPOs is obtained. The list contents depends on what is configured in respsect of:
5999
6000 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>Is user a domain member, thus subject to particular policies</td></tr><tr><td>Loopback enablement, and the state of the loopback policy (Merge or Replace)</td></tr><tr><td>Location of the Active Directory itself</td></tr><tr><td>Has the list of GPOs changed. No processing is needed if not changed.</td></tr></table><p>
6001         </p></li><li><p>
6002         User Policies are applied from Active Directory. Note: There are several types.
6003         </p></li><li><p>
6004         Logon scripts are run. New to Win2K and Active Directory, logon scripts may be obtained based on Group
6005         Policy objects (hidden and executed synchronously). NT4 style logon scripts are then run in a normal
6006         window.
6007         </p></li><li><p>
6008         The User Interface as determined from the GPOs is presented. Note: In a Samba domain (like and NT4
6009         Domain) machine (system) policies are applied at start-up, User policies are applied at logon.
6010         </p></li></ol></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="ProfileMgmt"></a>Chapter 18. Desktop Profile Management</h2></div><div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">April 3 2003</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2877599">Roaming Profiles</a></dt><dd><dl><dt><a href="#id2877483">Samba Configuration for Profile Handling</a></dt><dt><a href="#id2879080">Windows Client Profile Configuration Information</a></dt><dt><a href="#id2879695">Sharing Profiles between W9x/Me and NT4/200x/XP workstations</a></dt><dt><a href="#id2879742">Profile Migration from Windows NT4/200x Server to Samba</a></dt></dl></dd><dt><a href="#id2879925">Mandatory profiles</a></dt><dt><a href="#id2879970">Creating/Managing Group Profiles</a></dt><dt><a href="#id2880011">Default Profile for Windows Users</a></dt><dd><dl><dt><a href="#id2880040">MS Windows 9x/Me</a></dt><dt><a href="#id2880129">MS Windows NT4 Workstation</a></dt><dt><a href="#id2880513">MS Windows 200x/XP</a></dt></dl></dd></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2877599"></a>Roaming Profiles</h2></div></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>
6011 Roaming profiles support is different for Win9x / Me and Windows NT4/200x.
6012 </p></div><p>
6013 Before discussing how to configure roaming profiles, it is useful to see how
6014 Windows 9x / Me and Windows NT4/200x clients implement these features.
6015 </p><p>
6016 Windows 9x / Me clients send a NetUserGetInfo request to the server to get the user's
6017 profiles location. However, the response does not have room for a separate
6018 profiles location field, only the user's home share. This means that Win9X/Me
6019 profiles are restricted to being stored in the user's home directory.
6020 </p><p>
6021 Windows NT4/200x  clients send a NetSAMLogon RPC request, which contains many fields,
6022 including a separate field for the location of the user's profiles.
6023 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2877483"></a>Samba Configuration for Profile Handling</h3></div></div><p>
6024 This section documents how to configure Samba for MS Windows client profile support.
6025 </p><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2877497"></a>NT4/200x User Profiles</h4></div></div><p>
6026 To support Windowns NT4/200x clients, in the [global] section of smb.conf set the
6027 following (for example):
6028 </p><p>
6029 </p><pre class="programlisting">
6030         logon path = \\profileserver\profileshare\profilepath\%U\moreprofilepath
6031 </pre><p>
6032
6033         This is typically implemented like:
6034
6035 </p><pre class="programlisting">
6036                 logon path = \\%L\Profiles\%u
6037 </pre><p>
6038 where %L translates to the name of the Samba server and %u translates to the user name
6039 </p><p>
6040 The default for this option is \\%N\%U\profile, namely \\sambaserver\username\profile. 
6041 The \\N%\%U service is created automatically by the [homes] service.  If you are using
6042 a samba server for the profiles, you _must_ make the share specified in the logon path
6043 browseable. Please refer to the man page for smb.conf in respect of the different
6044 symantics of %L and %N, as well as %U and %u.
6045 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
6046 MS Windows NT/2K clients at times do not disconnect a connection to a server
6047 between logons. It is recommended to NOT use the <b>homes</b>
6048 meta-service name as part of the profile share path.
6049 </p></div></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2878824"></a>Windows 9x / Me User Profiles</h4></div></div><p>
6050 To support Windows 9x / Me clients, you must use the &quot;logon home&quot; parameter. Samba has
6051 now been fixed so that <b><tt>net use /home</tt></b> now works as well, and it, too, relies
6052 on the <b>logon home</b> parameter.
6053 </p><p>
6054 By using the logon home parameter, you are restricted to putting Win9x / Me
6055 profiles in the user's home directory.   But wait! There is a trick you
6056 can use. If you set the following in the <b>[global]</b> section of your <tt>smb.conf</tt> file:
6057 </p><pre class="programlisting">
6058         logon home = \\%L\%U\.profiles
6059 </pre><p>
6060 then your Windows 9x / Me clients will dutifully put their clients in a subdirectory
6061 of your home directory called <tt>.profiles</tt> (thus making them hidden).
6062 </p><p>
6063 Not only that, but <b><tt>net use /home</tt></b> will also work, because of a feature in
6064 Windows 9x / Me. It removes any directory stuff off the end of the home directory area
6065 and only uses the server and share portion. That is, it looks like you
6066 specified \\%L\%U for <b>logon home</b>.
6067 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2878920"></a>Mixed Windows 9x / Me and Windows NT4/200x User Profiles</h4></div></div><p>
6068 You can support profiles for both Win9X and WinNT clients by setting both the
6069 <b>logon home</b> and <b>logon path</b> parameters. For example:
6070 </p><pre class="programlisting">
6071         logon home = \\%L\%u\.profiles
6072         logon path = \\%L\profiles\%u
6073 </pre></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2878959"></a>Disabling Roaming Profile Support</h4></div></div><p>
6074 A question often asked is &quot;How may I enforce use of local profiles?&quot; or
6075 &quot;How do I disable Roaming Profiles?&quot;
6076 </p><p>
6077 There are three ways of doing this:
6078 </p><div class="itemizedlist"><ul type="disc"><li><p>
6079         <b>In smb.conf:</b> affect the following settings and ALL clients
6080         will be forced to use a local profile:
6081         </p><pre class="programlisting">
6082                 logon home =
6083                 logon path =
6084         </pre></li><li><p>
6085         <b>MS Windows Registry:</b> by using the Microsoft Management Console
6086         gpedit.msc to instruct your MS Windows XP machine to use only a local profile. This
6087         of course modifies registry settings. The full path to the option is:
6088         </p><pre class="programlisting">
6089         Local Computer Policy\
6090                 Computer Configuration\
6091                         Administrative Templates\
6092                                 System\
6093                                         User Profiles\
6094
6095         Disable:        Only Allow Local User Profiles
6096         Disable:        Prevent Roaming Profile Change from Propogating to the Server
6097         </pre><p>
6098         </p></li><li><p>
6099         <b>Change of Profile Type:</b> From the start menu right click on the
6100         MY Computer icon, select <span class="emphasis"><em>Properties</em></span>, click on the &quot;<span class="emphasis"><em>User Profiles</em></span>
6101         tab, select the profile you wish to change from Roaming type to Local, click <span class="emphasis"><em>Change Type</em></span>.
6102         </p></li></ul></div><p>
6103 Consult the MS Windows registry guide for your particular MS Windows version for more
6104 information about which registry keys to change to enforce use of only local user
6105 profiles.
6106 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
6107 The specifics of how to convert a local profile to a roaming profile, or a roaming profile
6108 to a local one vary according to the version of MS Windows you are running. Consult the
6109 Microsoft MS Windows Resource Kit for your version of Windows for specific information.
6110 </p></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2879080"></a>Windows Client Profile Configuration Information</h3></div></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2879088"></a>Windows 9x / Me Profile Setup</h4></div></div><p>
6111 When a user first logs in on Windows 9X, the file user.DAT is created,
6112 as are folders &quot;Start Menu&quot;, &quot;Desktop&quot;, &quot;Programs&quot; and &quot;Nethood&quot;.
6113 These directories and their contents will be merged with the local
6114 versions stored in c:\windows\profiles\username on subsequent logins,
6115 taking the most recent from each.  You will need to use the [global]
6116 options &quot;preserve case = yes&quot;, &quot;short preserve case = yes&quot; and
6117 &quot;case sensitive = no&quot; in order to maintain capital letters in shortcuts
6118 in any of the profile folders.
6119 </p><p>
6120 The user.DAT file contains all the user's preferences.  If you wish to
6121 enforce a set of preferences, rename their user.DAT file to user.MAN,
6122 and deny them write access to this file.
6123 </p><div class="orderedlist"><ol type="1"><li><p>
6124         On the Windows 9x / Me machine, go to Control Panel -&gt; Passwords and
6125         select the User Profiles tab.  Select the required level of
6126         roaming preferences.  Press OK, but do _not_ allow the computer
6127         to reboot.
6128         </p></li><li><p>
6129         On the Windows 9x / Me machine, go to Control Panel -&gt; Network -&gt;
6130         Client for Microsoft Networks -&gt; Preferences.  Select 'Log on to
6131         NT Domain'.  Then, ensure that the Primary Logon is 'Client for
6132         Microsoft Networks'.  Press OK, and this time allow the computer
6133         to reboot.
6134         </p></li></ol></div><p>
6135 Under Windows 9x / Me Profiles are downloaded from the Primary Logon.
6136 If you have the Primary Logon as 'Client for Novell Networks', then
6137 the profiles and logon script will be downloaded from your Novell
6138 Server.  If you have the Primary Logon as 'Windows Logon', then the
6139 profiles will be loaded from the local machine - a bit against the
6140 concept of roaming profiles, it would seem!
6141 </p><p>
6142 You will now find that the Microsoft Networks Login box contains
6143 [user, password, domain] instead of just [user, password].  Type in
6144 the samba server's domain name (or any other domain known to exist,
6145 but bear in mind that the user will be authenticated against this
6146 domain and profiles downloaded from it, if that domain logon server
6147 supports it), user name and user's password.
6148 </p><p>
6149 Once the user has been successfully validated, the Windows 9x / Me machine
6150 will inform you that 'The user has not logged on before' and asks you
6151 if you wish to save the user's preferences?  Select 'yes'.
6152 </p><p>
6153 Once the Windows 9x / Me client comes up with the desktop, you should be able
6154 to examine the contents of the directory specified in the &quot;logon path&quot;
6155 on the samba server and verify that the &quot;Desktop&quot;, &quot;Start Menu&quot;,
6156 &quot;Programs&quot; and &quot;Nethood&quot; folders have been created.
6157 </p><p>
6158 These folders will be cached locally on the client, and updated when
6159 the user logs off (if you haven't made them read-only by then).
6160 You will find that if the user creates further folders or short-cuts,
6161 that the client will merge the profile contents downloaded with the
6162 contents of the profile directory already on the local client, taking
6163 the newest folders and short-cuts from each set.
6164 </p><p>
6165 If you have made the folders / files read-only on the samba server,
6166 then you will get errors from the Windows 9x / Me machine on logon and logout, as
6167 it attempts to merge the local and the remote profile.  Basically, if
6168 you have any errors reported by the Windows 9x / Me machine, check the Unix file
6169 permissions and ownership rights on the profile directory contents,
6170 on the samba server.
6171 </p><p>
6172 If you have problems creating user profiles, you can reset the user's
6173 local desktop cache, as shown below.  When this user then next logs in,
6174 they will be told that they are logging in &quot;for the first time&quot;.
6175 </p><div class="orderedlist"><ol type="1"><li><p>
6176         instead of logging in under the [user, password, domain] dialog,
6177         press escape.
6178         </p></li><li><p>
6179         run the regedit.exe program, and look in:
6180         </p><p>
6181         HKEY_LOCAL_MACHINE\Windows\CurrentVersion\ProfileList
6182         </p><p>
6183         you will find an entry, for each user, of ProfilePath.  Note the
6184         contents of this key (likely to be c:\windows\profiles\username),
6185         then delete the key ProfilePath for the required user.
6186
6187         [Exit the registry editor].
6188
6189         </p></li><li><p>
6190         <span class="emphasis"><em>WARNING</em></span> - before deleting the contents of the
6191         directory listed in the ProfilePath (this is likely to be
6192         <tt>c:\windows\profiles\username)</tt>, ask them if they
6193         have any important files stored on their desktop or in their start menu. 
6194         Delete the contents of the directory ProfilePath (making a backup if any
6195         of the files are needed).
6196         </p><p>
6197         This will have the effect of removing the local (read-only hidden
6198         system file) user.DAT in their profile directory, as well as the
6199         local &quot;desktop&quot;, &quot;nethood&quot;, &quot;start menu&quot; and &quot;programs&quot; folders.
6200         </p></li><li><p>
6201         search for the user's .PWL password-caching file in the c:\windows
6202         directory, and delete it.
6203         </p></li><li><p>
6204         log off the windows 9x / Me client.
6205         </p></li><li><p>
6206         check the contents of the profile path (see &quot;logon path&quot; described
6207         above), and delete the user.DAT or user.MAN file for the user,
6208         making a backup if required.
6209         </p></li></ol></div><p>
6210 If all else fails, increase samba's debug log levels to between 3 and 10,
6211 and / or run a packet trace program such as ethereal or netmon.exe, and
6212 look for error messages.
6213 </p><p>
6214 If you have access to an Windows NT4/200x server, then first set up roaming profiles
6215 and / or netlogons on the Windows NT4/200x server.  Make a packet trace, or examine
6216 the example packet traces provided with Windows NT4/200x server, and see what the
6217 differences are with the equivalent samba trace.
6218 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2879358"></a>Windows NT4 Workstation</h4></div></div><p>
6219 When a user first logs in to a Windows NT Workstation, the profile
6220 NTuser.DAT is created.  The profile location can be now specified
6221 through the &quot;logon path&quot; parameter.
6222 </p><p>
6223 There is a parameter that is now available for use with NT Profiles:
6224 &quot;logon drive&quot;.  This should be set to <tt>H:</tt> or any other drive, and
6225 should be used in conjunction with the new &quot;logon home&quot; parameter.
6226 </p><p>
6227 The entry for the NT4 profile is a _directory_ not a file.  The NT
6228 help on profiles mentions that a directory is also created with a .PDS
6229 extension.  The user, while logging in, must have write permission to
6230 create the full profile path (and the folder with the .PDS extension
6231 for those situations where it might be created.)
6232 </p><p>
6233 In the profile directory, Windows NT4 creates more folders than Windows 9x / Me. 
6234 It creates &quot;Application Data&quot; and others, as well as &quot;Desktop&quot;, &quot;Nethood&quot;,
6235 &quot;Start Menu&quot; and &quot;Programs&quot;.  The profile itself is stored in a file
6236 NTuser.DAT.  Nothing appears to be stored in the .PDS directory, and
6237 its purpose is currently unknown.
6238 </p><p>
6239 You can use the System Control Panel to copy a local profile onto
6240 a samba server (see NT Help on profiles: it is also capable of firing
6241 up the correct location in the System Control Panel for you).  The
6242 NT Help file also mentions that renaming NTuser.DAT to NTuser.MAN
6243 turns a profile into a mandatory one.
6244 </p><p>
6245 The case of the profile is significant.  The file must be called
6246 NTuser.DAT or, for a mandatory profile, NTuser.MAN.
6247 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2879426"></a>Windows 2000/XP Professional</h4></div></div><p>
6248 You must first convert the profile from a local profile to a domain
6249 profile on the MS Windows workstation as follows:
6250 </p><div class="itemizedlist"><ul type="disc"><li><p>
6251         Log on as the LOCAL workstation administrator.
6252         </p></li><li><p>
6253         Right click on the 'My Computer' Icon, select 'Properties'
6254         </p></li><li><p>
6255         Click on the 'User Profiles' tab
6256         </p></li><li><p>
6257         Select the profile you wish to convert (click on it once)
6258         </p></li><li><p>
6259         Click on the button 'Copy To'
6260         </p></li><li><p>
6261         In the &quot;Permitted to use&quot; box, click on the 'Change' button.
6262         </p></li><li><p>
6263         Click on the 'Look in&quot; area that lists the machine name, when you click
6264         here it will open up a selection box. Click on the domain to which the
6265         profile must be accessible.
6266         </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>You will need to log on if a logon box opens up. Eg: In the connect
6267         as: MIDEARTH\root, password: mypassword.</p></div></li><li><p>
6268         To make the profile capable of being used by anyone select 'Everyone'
6269         </p></li><li><p>
6270         Click OK. The Selection box will close.
6271         </p></li><li><p>
6272         Now click on the 'Ok' button to create the profile in the path you
6273         nominated.
6274         </p></li></ul></div><p>
6275 Done. You now have a profile that can be editted using the samba-3.0.0
6276 <tt>profiles</tt> tool.
6277 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
6278 Under NT/2K the use of mandotory profiles forces the use of MS Exchange
6279 storage of mail data. That keeps desktop profiles usable.
6280 </p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><div class="itemizedlist"><ul type="disc"><li><p>
6281 This is a security check new to Windows XP (or maybe only
6282 Windows XP service pack 1).  It can be disabled via a group policy in
6283 Active Directory.  The policy is:</p><p>&quot;Computer Configuration\Administrative Templates\System\User
6284 Profiles\Do not check for user ownership of Roaming Profile Folders&quot;</p><p>...and it should be set to &quot;Enabled&quot;.
6285 Does the new version of samba have an Active Directory analogue?  If so,
6286 then you may be able to set the policy through this.
6287 </p><p>
6288 If you cannot set group policies in samba, then you may be able to set
6289 the policy locally on each machine.  If you want to try this, then do
6290 the following (N.B. I don't know for sure that this will work in the
6291 same way as a domain group policy):
6292 </p></li><li><p>
6293 On the XP workstation log in with an Administrator account.
6294 </p></li><li><p>Click: &quot;Start&quot;, &quot;Run&quot;</p></li><li><p>Type: &quot;mmc&quot;</p></li><li><p>Click: &quot;OK&quot;</p></li><li><p>A Microsoft Management Console should appear.</p></li><li><p>Click: File, &quot;Add/Remove Snap-in...&quot;, &quot;Add&quot;</p></li><li><p>Double-Click: &quot;Group Policy&quot;</p></li><li><p>Click: &quot;Finish&quot;, &quot;Close&quot;</p></li><li><p>Click: &quot;OK&quot;</p></li><li><p>In the &quot;Console Root&quot; window:</p></li><li><p>Expand: &quot;Local Computer Policy&quot;, &quot;Computer Configuration&quot;,</p></li><li><p>&quot;Administrative Templates&quot;, &quot;System&quot;, &quot;User Profiles&quot;</p></li><li><p>Double-Click: &quot;Do not check for user ownership of Roaming Profile</p></li><li><p>Folders&quot;</p></li><li><p>Select: &quot;Enabled&quot;</p></li><li><p>Click: OK&quot;</p></li><li><p>Close the whole console.  You do not need to save the settings (this
6295         refers to the console settings rather than the policies you have
6296         changed).</p></li><li><p>Reboot</p></li></ul></div></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2879695"></a>Sharing Profiles between W9x/Me and NT4/200x/XP workstations</h3></div></div><p>
6297 Sharing of desktop profiles between Windows versions is NOT recommended.
6298 Desktop profiles are an evolving phenomenon and profiles for later versions
6299 of MS Windows clients add features that may interfere with earlier versions
6300 of MS Windows clients. Probably the more salient reason to NOT mix profiles
6301 is that when logging off an earlier version of MS Windows the older format
6302 of profile contents may overwrite information that belongs to the newer
6303 version resulting in loss of profile information content when that user logs
6304 on again with the newer version of MS Windows.
6305 </p><p>
6306 If you then want to share the same Start Menu / Desktop with W9x/Me, you will
6307 need to specify a common location for the profiles. The smb.conf parameters
6308 that need to be common are <span class="emphasis"><em>logon path</em></span> and
6309 <span class="emphasis"><em>logon home</em></span>.
6310 </p><p>
6311 If you have this set up correctly, you will find separate user.DAT and
6312 NTuser.DAT files in the same profile directory.
6313 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2879742"></a>Profile Migration from Windows NT4/200x Server to Samba</h3></div></div><p>
6314 There is nothing to stop you specifying any path that you like for the
6315 location of users' profiles.  Therefore, you could specify that the
6316 profile be stored on a samba server, or any other SMB server, as long as
6317 that SMB server supports encrypted passwords.
6318 </p><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2879759"></a>Windows NT4 Profile Management Tools</h4></div></div><p>
6319 Unfortunately, the Resource Kit information is specific to the version of MS Windows
6320 NT4/200x. The correct resource kit is required for each platform.
6321 </p><p>
6322 Here is a quick guide:
6323 </p><div class="itemizedlist"><ul type="disc"><li><p>
6324 On your NT4 Domain Controller, right click on 'My Computer', then
6325 select the tab labelled 'User Profiles'.
6326 </p></li><li><p>
6327 Select a user profile you want to migrate and click on it.
6328 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>I am using the term &quot;migrate&quot; lossely. You can copy a profile to
6329 create a group profile. You can give the user 'Everyone' rights to the
6330 profile you copy this to. That is what you need to do, since your samba
6331 domain is not a member of a trust relationship with your NT4 PDC.</p></div></li><li><p>Click the 'Copy To' button.</p></li><li><p>In the box labelled 'Copy Profile to' add your new path, eg:
6332         <tt>c:\temp\foobar</tt></p></li><li><p>Click on the button labelled 'Change' in the &quot;Permitted to use&quot; box.</p></li><li><p>Click on the group 'Everyone' and then click OK. This closes the
6333         'chose user' box.</p></li><li><p>Now click OK.</p></li></ul></div><p>
6334 Follow the above for every profile you need to migrate.
6335 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2879852"></a>Side bar Notes</h4></div></div><p>
6336 You should obtain the SID of your NT4 domain. You can use smbpasswd to do
6337 this. Read the man page.</p><p>
6338 With Samba-3.0.0 alpha code you can import all you NT4 domain accounts
6339 using the net samsync method. This way you can retain your profile
6340 settings as well as all your users.
6341 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2879874"></a>moveuser.exe</h4></div></div><p>
6342 The W2K professional resource kit has moveuser.exe. moveuser.exe changes
6343 the security of a profile from one user to another.  This allows the account
6344 domain to change, and/or the user name to change.
6345 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2879890"></a>Get SID</h4></div></div><p>
6346 You can identify the SID by using GetSID.exe from the Windows NT Server 4.0
6347 Resource Kit.
6348 </p><p>
6349 Windows NT 4.0 stores the local profile information in the registry under
6350 the following key:
6351 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
6352 </p><p>
6353 Under the ProfileList key, there will be subkeys named with the SIDs of the
6354 users who have logged on to this computer. (To find the profile information
6355 for the user whose locally cached profile you want to move, find the SID for
6356 the user with the GetSID.exe utility.) Inside of the appropriate user's
6357 subkey, you will see a string value named ProfileImagePath.
6358 </p></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2879925"></a>Mandatory profiles</h2></div></div><p>
6359 A Mandatory Profile is a profile that the user does NOT have the ability to overwrite.
6360 During the user's session it may be possible to change the desktop environment, but
6361 as the user logs out all changes made will be lost. If it is desired to NOT allow the
6362 user any ability to change the desktop environment then this must be done through
6363 policy settings. See previous chapter.
6364 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
6365 Under NO circumstances should the profile directory (or it's contents) be made read-only
6366 as this may render the profile un-usable.
6367 </p></div><p>
6368 For MS Windows NT4/200x/XP the above method can be used to create mandatory profiles
6369 also. To convert a group profile into a mandatory profile simply locate the NTUser.DAT
6370 file in the copied profile and rename it to NTUser.MAN.
6371 </p><p>
6372 For MS Windows 9x / Me it is the User.DAT file that must be renamed to User.MAN to
6373 affect a mandatory profile.
6374 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2879970"></a>Creating/Managing Group Profiles</h2></div></div><p>
6375 Most organisations are arranged into departments. There is a nice benenfit in
6376 this fact since usually most users in a department will require the same desktop
6377 applications and the same desktop layout. MS Windows NT4/200x/XP will allow the
6378 use of Group Profiles. A Group Profile is a profile that is created firstly using
6379 a template (example) user. Then using the profile migration tool (see above) the
6380 profile is assigned access rights for the user group that needs to be given access
6381 to the group profile.
6382 </p><p>
6383 The next step is rather important. PLEASE NOTE: Instead of assigning a group profile
6384 to users (ie: Using User Manager) on a &quot;per user&quot; basis, the group itself is assigned
6385 the now modified profile.
6386 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
6387         Be careful with group profiles, if the user who is a member of a group also
6388         has a personal profile, then the result will be a fusion (merge) of the two.
6389         </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2880011"></a>Default Profile for Windows Users</h2></div></div><p>
6390 MS Windows 9x / Me and NT4/200x/XP will use a default profile for any user for whom
6391 a profile does not already exist. Armed with a knowledge of where the default profile
6392 is located on the Windows workstation, and knowing which registry keys affect the path
6393 from which the default profile is created, it is possible to modify the default profile
6394 to one that has been optimised for the site. This has significant administrative 
6395 advantages.
6396 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2880040"></a>MS Windows 9x/Me</h3></div></div><p>
6397 To enable default per use profiles in Windows 9x / Me you can either use the Windows 98 System
6398 Policy Editor or change the registry directly.
6399 </p><p>
6400 To enable default per user profiles in Windows 9x / Me, launch the System Policy Editor, then
6401 select File -&gt; Open Registry, then click on the Local Computer icon, click on Windows 98 System,
6402 select User Profiles, click on the enable box. Do not forget to save the registry changes.
6403 </p><p>
6404 To modify the registry directly, launch the Registry Editor (regedit.exe), select the hive
6405 <tt>HKEY_LOCAL_MACHINE\Network\Logon</tt>. Now add a DWORD type key with the name
6406 &quot;User Profiles&quot;, to enable user profiles set the value to 1, to disable user profiles set it to 0.
6407 </p><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2880080"></a>How User Profiles Are Handled in Windows 9x / Me?</h4></div></div><p>
6408 When a user logs on to a Windows 9x / Me machine, the local profile path, 
6409 <tt>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\ProfileList</tt>, is checked
6410 for an existing entry for that user:
6411 </p><p>
6412 If the user has an entry in this registry location, Windows 9x / Me checks for a locally cached
6413 version of the user profile. Windows 9x / Me also checks the user's home directory (or other
6414 specified directory if the location has been modified) on the server for the User Profile.
6415 If a profile exists in both locations, the newer of the two is used. If the User Profile exists
6416 on the server, but does not exist on the local machine, the profile on the server is downloaded
6417 and used. If the User Profile only exists on the local machine, that copy is used.
6418 </p><p>
6419 If a User Profile is not found in either location, the Default User Profile from the Windows 9x / Me
6420 machine is used and is copied to a newly created folder for the logged on user. At log off, any
6421 changes that the user made are written to the user's local profile. If the user has a roaming
6422 profile, the changes are written to the user's profile on the server.
6423 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2880129"></a>MS Windows NT4 Workstation</h3></div></div><p>
6424 On MS Windows NT4 the default user profile is obtained from the location
6425 <tt>%SystemRoot%\Profiles</tt> which in a default installation will translate to
6426 <tt>C:\WinNT\Profiles</tt>. Under this directory on a clean install there will be
6427 three (3) directories: <tt>Administrator, All Users, Default User</tt>.
6428 </p><p>
6429 The <tt>All Users</tt> directory contains menu settings that are common across all 
6430 system users. The <tt>Default User</tt> directory contains menu entries that are
6431 customisable per user depending on the profile settings chosen/created.
6432 </p><p>
6433 When a new user first logs onto an MS Windows NT4 machine a new profile is created from:
6434 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>All Users settings</td></tr><tr><td>Default User settings (contains the default NTUser.DAT file)</td></tr></table><p>
6435 When a user logs onto an MS Windows NT4 machine that is a member of a Microsoft security domain
6436 the following steps are followed in respect of profile handling:
6437 </p><div class="orderedlist"><ol type="1"><li><p>
6438         The users' account information which is obtained during the logon process contains
6439         the location of the users' desktop profile. The profile path may be local to the
6440         machine or it may be located on a network share. If there exists a profile at the location
6441         of the path from the user account, then this profile is copied to the location
6442         <tt>%SystemRoot%\Profiles\%USERNAME%</tt>. This profile then inherits the
6443         settings in the <tt>All Users</tt> profile in the <tt>%SystemRoot%\Profiles</tt>
6444         location.
6445         </p></li><li><p>
6446         If the user account has a profile path, but at it's location a profile does not exist,
6447         then a new profile is created in the <tt>%SystemRoot%\Profiles\%USERNAME%</tt>
6448         directory from reading the <tt>Default User</tt> profile.
6449         </p></li><li><p>
6450         If the NETLOGON share on the authenticating server (logon server) contains a policy file
6451         (<tt>NTConfig.POL</tt>) then it's contents are applied to the <tt>NTUser.DAT</tt>
6452         which is applied to the <tt>HKEY_CURRENT_USER</tt> part of the registry. 
6453         </p></li><li><p>
6454         When the user logs out, if the profile is set to be a roaming profile it will be written
6455         out to the location of the profile. The <tt>NTuser.DAT</tt> file is then
6456         re-created from the contents of the <tt>HKEY_CURRENT_USER</tt> contents.
6457         Thus, should there not exist in the NETLOGON share an <tt>NTConfig.POL</tt> at the
6458         next logon, the effect of the provious <tt>NTConfig.POL</tt> will still be held
6459         in the profile. The effect of this is known as <span class="emphasis"><em>tatooing</em></span>.
6460         </p></li></ol></div><p>
6461 MS Windows NT4 profiles may be <span class="emphasis"><em>Local</em></span> or <span class="emphasis"><em>Roaming</em></span>. A Local profile
6462 will stored in the <tt>%SystemRoot%\Profiles\%USERNAME%</tt> location. A roaming profile will
6463 also remain stored in the same way, unless the following registry key is created:
6464 </p><p>
6465 </p><pre class="programlisting">
6466         HKEY_LOCAL_MACHINE\SYSTEM\Software\Microsoft\Windows NT\CurrentVersion\winlogon\
6467         &quot;DeleteRoamingCache&quot;=dword:00000001
6468 </pre><p>
6469
6470 In which case, the local copy (in <tt>%SystemRoot%\Profiles\%USERNAME%</tt>) will be
6471 deleted on logout.
6472 </p><p>
6473 Under MS Windows NT4 default locations for common resources (like <tt>My Documents</tt>
6474 may be redirected to a network share by modifying the following registry keys. These changes may be affected
6475 via use of the System Policy Editor (to do so may require that you create your owns template extension
6476 for the policy editor to allow this to be done through the GUI. Another way to do this is by way of first
6477 creating a default user profile, then while logged in as that user, run regedt32 to edit the key settings.
6478 </p><p>
6479 The Registry Hive key that affects the behaviour of folders that are part of the default user profile
6480 are controlled by entries on Windows NT4 is:
6481 </p><p>
6482 </p><pre class="programlisting">
6483         HKEY_CURRENT_USER
6484                 \Software
6485                         \Microsoft
6486                                 \Windows
6487                                         \CurrentVersion
6488                                                 \Explorer
6489                                                         \User Shell Folders\
6490 </pre><p>
6491 </p><p>
6492 The above hive key contains a list of automatically managed folders. The default entries are:
6493 </p><p>
6494         </p><pre class="programlisting">
6495         Name            Default Value
6496         --------------  -----------------------------------------
6497         AppData         %USERPROFILE%\Application Data
6498         Desktop         %USERPROFILE%\Desktop
6499         Favorites       %USERPROFILE%\Favorites
6500         NetHood         %USERPROFILE%\NetHood
6501         PrintHood       %USERPROFILE%\PrintHood
6502         Programs        %USERPROFILE%\Start Menu\Programs
6503         Recent          %USERPROFILE%\Recent
6504         SendTo          %USERPROFILE%\SendTo
6505         Start Menu      %USERPROFILE%\Start Menu
6506         Startup         %USERPROFILE%\Start Menu\Programs\Startup
6507         </pre><p>
6508         </p><p>
6509 The registry key that contains the location of the default profile settings is:
6510
6511 </p><pre class="programlisting">
6512         HKEY_LOCAL_MACHINE
6513                 \SOFTWARE
6514                         \Microsoft
6515                                 \Windows
6516                                         \CurrentVersion
6517                                                 \Explorer
6518                                                         \User Shell Folders
6519 </pre><p>
6520
6521 The default entries are:
6522
6523 </p><pre class="programlisting">
6524         Common Desktop          %SystemRoot%\Profiles\All Users\Desktop
6525         Common Programs         %SystemRoot%\Profiles\All Users\Programs
6526         Common Start Menu       %SystemRoot%\Profiles\All Users\Start Menu
6527         Common Startup          %SystemRoot%\Profiles\All Users\Start Menu\Progams\Startup
6528 </pre><p>
6529 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2880513"></a>MS Windows 200x/XP</h3></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
6530         MS Windows XP Home Edition does use default per user profiles, but can not participate
6531         in domain security, can not log onto an NT/ADS style domain, and thus can obtain the profile
6532         only from itself. While there are benefits in doing this the beauty of those MS Windows
6533         clients that CAN participate in domain logon processes allows the administrator to create
6534         a global default profile and to enforce it through the use of Group Policy Objects (GPOs).
6535         </p></div><p>
6536 When a new user first logs onto MS Windows 200x/XP machine the default profile is obtained from
6537 <tt>C:\Documents and Settings\Default User</tt>. The administrator can modify (or change
6538 the contents of this location and MS Windows 200x/XP will gladly use it. This is far from the optimum
6539 arrangement since it will involve copying a new default profile to every MS Windows 200x/XP client
6540 workstation. 
6541 </p><p>
6542 When MS Windows 200x/XP participate in a domain security context, and if the default user
6543 profile is not found, then the client will search for a default profile in the NETLOGON share
6544 of the authenticating server. ie: In MS Windows parlance:
6545 <tt>%LOGONSERVER%\NETLOGON\Default User</tt> and if one exits there it will copy this
6546 to the workstation to the <tt>C:\Documents and Settings\</tt> under the Windows
6547 login name of the user.
6548 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
6549         This path translates, in Samba parlance, to the smb.conf [NETLOGON] share. The directory
6550         should be created at the root of this share and must be called <tt>Default Profile</tt>.
6551         </p></div><p>
6552 If a default profile does not exist in this location then MS Windows 200x/XP will use the local
6553 default profile.
6554 </p><p>
6555 On loging out, the users' desktop profile will be stored to the location specified in the registry
6556 settings that pertain to the user. If no specific policies have been created, or passed to the client
6557 during the login process (as Samba does automatically), then the user's profile will be written to
6558 the local machine only under the path <tt>C:\Documents and Settings\%USERNAME%</tt>.
6559 </p><p>
6560 Those wishing to modify the default behaviour can do so through three methods:
6561 </p><div class="itemizedlist"><ul type="disc"><li><p>
6562         Modify the registry keys on the local machine manually and place the new default profile in the
6563         NETLOGON share root - NOT recommended as it is maintenance intensive.
6564         </p></li><li><p>
6565         Create an NT4 style NTConfig.POL file that specified this behaviour and locate this file
6566         in the root of the NETLOGON share along with the new default profile.
6567         </p></li><li><p>
6568         Create a GPO that enforces this through Active Directory, and place the new default profile
6569         in the NETLOGON share.
6570         </p></li></ul></div><p>
6571 The Registry Hive key that affects the behaviour of folders that are part of the default user profile
6572 are controlled by entries on Windows 200x/XP is:
6573 </p><p>
6574 </p><pre class="programlisting">
6575         HKEY_CURRENT_USER
6576                 \Software
6577                         \Microsoft
6578                                 \Windows
6579                                         \CurrentVersion
6580                                                 \Explorer
6581                                                         \User Shell Folders\
6582 </pre><p>
6583 </p><p>
6584 The above hive key contains a list of automatically managed folders. The default entries are:
6585 </p><p>
6586         </p><pre class="programlisting">
6587         Name            Default Value
6588         --------------  -----------------------------------------
6589         AppData         %USERPROFILE%\Application Data
6590         Cache           %USERPROFILE%\Local Settings\Temporary Internet Files
6591         Cookies         %USERPROFILE%\Cookies
6592         Desktop         %USERPROFILE%\Desktop
6593         Favorites       %USERPROFILE%\Favorites
6594         History         %USERPROFILE%\Local Settings\History
6595         Local AppData   %USERPROFILE%\Local Settings\Application Data
6596         Local Settings  %USERPROFILE%\Local Settings
6597         My Pictures     %USERPROFILE%\My Documents\My Pictures
6598         NetHood         %USERPROFILE%\NetHood
6599         Personal        %USERPROFILE%\My Documents
6600         PrintHood       %USERPROFILE%\PrintHood
6601         Programs        %USERPROFILE%\Start Menu\Programs
6602         Recent          %USERPROFILE%\Recent
6603         SendTo          %USERPROFILE%\SendTo
6604         Start Menu      %USERPROFILE%\Start Menu
6605         Startup         %USERPROFILE%\Start Menu\Programs\Startup
6606         Templates       %USERPROFILE%\Templates
6607         </pre><p>
6608         </p><p>
6609 There is also an entry called &quot;Default&quot; that has no value set. The default entry is of type REG_SZ, all
6610 the others are of type REG_EXPAND_SZ.
6611 </p><p>
6612 It makes a huge difference to the speed of handling roaming user profiles if all the folders are
6613 stored on a dedicated location on a network server. This means that it will NOT be necessary to
6614 write the Outlook PST file over the network for every login and logout.
6615 </p><p>
6616 To set this to a network location you could use the following examples:
6617
6618 </p><pre class="programlisting">
6619         %LOGONSERVER%\%USERNAME%\Default Folders
6620 </pre><p>
6621
6622 This would store the folders in the user's home directory under a directory called &quot;Default Folders&quot;
6623
6624 You could also use:
6625
6626 </p><pre class="programlisting">
6627         \\SambaServer\FolderShare\%USERNAME%
6628 </pre><p>
6629
6630 in which case the default folders will be stored in the server named <span class="emphasis"><em>SambaServer</em></span>
6631 in the share called <span class="emphasis"><em>FolderShare</em></span> under a directory that has the name of the MS Windows
6632 user as seen by the Linux/Unix file system.
6633 </p><p>
6634 Please note that once you have created a default profile share, you MUST migrate a user's profile
6635 (default or custom) to it.
6636 </p><p>
6637 MS Windows 200x/XP profiles may be <span class="emphasis"><em>Local</em></span> or <span class="emphasis"><em>Roaming</em></span>.
6638 A roaming profile will be cached locally unless the following registry key is created:
6639 </p><p>
6640 </p><pre class="programlisting">
6641         HKEY_LOCAL_MACHINE\SYSTEM\Software\Microsoft\Windows NT\CurrentVersion\winlogon\
6642         &quot;DeleteRoamingCache&quot;=dword:00000001
6643 </pre><p>
6644
6645 In which case, the local cache copy will be deleted on logout.
6646 </p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="InterdomainTrusts"></a>Chapter 19. Interdomain Trust Relationships</h2></div><div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Rafal Szczesniak</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:mimir@samba.org">mimir@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">April 3, 2003</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2878684">Trust Relationship Background</a></dt><dt><a href="#id2881006">Native MS Windows NT4 Trusts Configuration</a></dt><dd><dl><dt><a href="#id2881019">NT4 as the Trusting Domain (ie. creating the trusted account)</a></dt><dt><a href="#id2881063">NT4 as the Trusted Domain (ie. creating trusted account's password)</a></dt></dl></dd><dt><a href="#id2881087">Configuring Samba NT-style Domain Trusts</a></dt><dd><dl><dt><a href="#id2881114">Samba-3 as the Trusting Domain</a></dt><dt><a href="#id2881210">Samba-3 as the Trusted Domain</a></dt></dl></dd></dl></div><p>
6647 Samba-3 supports NT4 style domain trust relationships. This is feature that many sites
6648 will want to use if they migrate to Samba-3 from and NT4 style domain and do NOT want to
6649 adopt Active Directory or an LDAP based authentication back end. This section explains
6650 some background information regarding trust relationships and how to create them. It is now
6651 possible for Samba-3 to NT4 trust (and vice versa), as well as Samba3 to Samba3 trusts.
6652 </p><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2878684"></a>Trust Relationship Background</h2></div></div><p>
6653 MS Windows NT3.x/4.0 type security domains employ a non-hierarchical security structure.
6654 The limitations of this architecture as it affects the scalability of MS Windows networking
6655 in large organisations is well known. Additionally, the flat-name space that results from
6656 this design significantly impacts the delegation of administrative responsibilities in
6657 large and diverse organisations.
6658 </p><p>
6659 Microsoft developed Active Directory Service (ADS), based on Kerberos and LDAP, as a means
6660 of circumventing the limitations of the older technologies. Not every organisation is ready
6661 or willing to embrace ADS. For small companies the older NT4 style domain security paradigm
6662 is quite adequate, there thus remains an entrenched user base for whom there is no direct
6663 desire to go through a disruptive change to adopt ADS.
6664 </p><p>
6665 Microsoft introduced with MS Windows NT the ability to allow differing security domains
6666 to affect a mechanism so that users from one domain may be given access rights and privileges
6667 in another domain. The language that describes this capability is couched in terms of
6668 <span class="emphasis"><em>Trusts</em></span>. Specifically, one domain will <span class="emphasis"><em>trust</em></span> the users
6669 from another domain. The domain from which users are available to another security domain is
6670 said to be a trusted domain. The domain in which those users have assigned rights and privileges
6671 is the trusting domain. With NT3.x/4.0 all trust relationships are always in one direction only,
6672 thus if users in both domains are to have privileges and rights in each others' domain, then it is
6673 necessary to establish two (2) relationships, one in each direction.
6674 </p><p>
6675 In an NT4 style MS security domain, all trusts are non-transitive. This means that if there
6676 are three (3) domains (let's call them RED, WHITE, and BLUE) where RED and WHITE have a trust
6677 relationship, and WHITE and BLUE have a trust relationship, then it holds that there is no
6678 implied trust between the RED and BLUE domains. ie: Relationships are explicit and not
6679 transitive.
6680 </p><p>
6681 New to MS Windows 2000 ADS security contexts is the fact that trust relationships are two-way
6682 by default. Also, all inter-ADS domain trusts are transitive. In the case of the RED, WHITE and BLUE
6683 domains above, with Windows 2000 and ADS the RED and BLUE domains CAN trust each other. This is
6684 an inherent feature of ADS domains. Samba-3 implements MS Windows NT4
6685 style Interdomain trusts and interoperates with MS Windows 200x ADS
6686 security domains in similar manner to MS Windows NT4 style domains.
6687 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2881006"></a>Native MS Windows NT4 Trusts Configuration</h2></div></div><p>
6688 There are two steps to creating an interdomain trust relationship.
6689 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2881019"></a>NT4 as the Trusting Domain (ie. creating the trusted account)</h3></div></div><p>
6690 For MS Windows NT4, all domain trust relationships are configured using the Domain User Manager.
6691 To affect a two way trust relationship it is necessary for each domain administrator to make
6692 available (for use by an external domain) it's security resources. This is done from the Domain
6693 User Manager Policies entry on the menu bar. From the Policy menu, select Trust Relationships, then
6694 next to the lower box that is labelled &quot;Permitted to Trust this Domain&quot; are two buttons, &quot;Add&quot; and
6695 &quot;Remove&quot;. The &quot;Add&quot; button will open a panel in which needs to be entered the remote domain that
6696 will be able to assign user rights to your domain. In addition it is necessary to enter a password
6697 that is specific to this trust relationship. The password needs to be
6698 typed twice (for standard confirmation).
6699 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2881063"></a>NT4 as the Trusted Domain (ie. creating trusted account's password)</h3></div></div><p>
6700 A trust relationship will work only when the other (trusting) domain makes the appropriate connections
6701 with the trusted domain. To consumate the trust relationship the administrator will launch the
6702 Domain User Manager, from the menu select Policies, then select Trust Relationships, then click on the
6703 &quot;Add&quot; button that is next to the box that is labelled &quot;Trusted Domains&quot;. A panel will open in
6704 which must be entered the name of the remote domain as well as the password assigned to that trust.
6705 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2881087"></a>Configuring Samba NT-style Domain Trusts</h2></div></div><p>
6706 This description is meant to be a fairly short introduction about how to set up a Samba server so
6707 that it could participate in interdomain trust relationships. Trust relationship support in Samba
6708 is in its early stage, so lot of things don't work yet.
6709 </p><p>
6710 Each of the procedures described below is treated as they were performed with Windows NT4 Server on
6711 one end. The remote end could just as well be another Samba-3 domain. It can be clearly seen, after
6712 reading this document, that combining Samba-specific parts of what's written below leads to trust
6713 between domains in purely Samba environment.
6714 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2881114"></a>Samba-3 as the Trusting Domain</h3></div></div><p>
6715 In order to set the Samba PDC to be the trusted party of the relationship first you need
6716 to create special account for the domain that will be the trusting party. To do that,
6717 you can use the 'smbpasswd' utility. Creating the trusted domain account is very
6718 similiar to creating a trusted machine account. Suppose, your domain is
6719 called SAMBA, and the remote domain is called RUMBA. The first step
6720 will be to issue this command from your favourite shell:
6721 </p><p>
6722 </p><pre class="screen">
6723 <tt>deity#</tt> <b><tt>smbpasswd -a -i rumba</tt></b>
6724         New SMB password: XXXXXXXX
6725         Retype SMB password: XXXXXXXX
6726         Added user rumba$
6727 </pre><p>
6728
6729 where <i><tt>-a</tt></i> means to add a new account into the
6730 passdb database and <i><tt>-i</tt></i> means: ''create this
6731 account with the InterDomain trust flag''
6732 </p><p>
6733 The account name will be 'rumba$' (the name of the remote domain)
6734 </p><p>
6735 After issuing this command you'll be asked to enter the password for
6736 the account. You can use any password you want, but be aware that Windows NT will
6737 not change this password until 7 days following account creation.
6738 After the command returns successfully, you can look at the entry for the new account
6739 (in the stardard way depending on your configuration) and see that account's name is
6740 really RUMBA$ and it has 'I' flag in the flags field. Now you're ready to confirm
6741 the trust by establishing it from Windows NT Server.
6742 </p><p>
6743 Open 'User Manager for Domains' and from menu 'Policies' select 'Trust Relationships...'.
6744 Right beside 'Trusted domains' list box press 'Add...' button. You will be prompted for
6745 the trusted domain name and the relationship password. Type in SAMBA, as this is
6746 your domain name, and the password used at the time of account creation.
6747 Press OK and, if everything went without incident, you will see 'Trusted domain relationship
6748 successfully established' message.
6749 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2881210"></a>Samba-3 as the Trusted Domain</h3></div></div><p>
6750 This time activities are somewhat reversed. Again, we'll assume that your domain
6751 controlled by the Samba PDC is called SAMBA and NT-controlled domain is called RUMBA.
6752 </p><p>
6753 The very first thing requirement is to add an account for the SAMBA domain on RUMBA's PDC.
6754 </p><p>
6755 Launch the Domain User Manager, then from the menu select 'Policies', 'Trust Relationships'.
6756 Now, next to 'Trusted Domains' box press the 'Add' button, and type in the name of the trusted
6757 domain (SAMBA) and password securing the relationship.
6758 </p><p>
6759 The password can be arbitrarily chosen. It is easy to change the password
6760 from the Samba server whenever you want. After confirming the password your account is
6761 ready for use. Now it's Samba's turn.
6762 </p><p>
6763 Using your favourite shell while being logged in as root, issue this command:
6764 </p><p>
6765 <tt>deity# </tt><b><tt>net rpc trustdom establish rumba</tt></b>
6766 </p><p>
6767 You will be prompted for the password you just typed on your Windows NT4 Server box.
6768 Do not worry if you see an error message that mentions a returned code of
6769 NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT. It means the
6770 password you gave is correct and the NT4 Server says the account is
6771 ready for interdomain connection and not for ordinary
6772 connection. After that, be patient it can take a while (especially
6773 in large networks), you should see the 'Success' message. Congratulations! Your trust
6774 relationship has just been established.
6775 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
6776 Note that you have to run this command as root because you must have write access to
6777 the <tt>secrets.tdb</tt> file.
6778 </p></div></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="pam"></a>Chapter 20. PAM Configuration for Centrally Managed Authentication</h2></div><div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate"> (Jun 21 2001) </p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2880956">Samba and PAM</a></dt><dd><dl><dt><a href="#id2881738">PAM Configuration in smb.conf</a></dt><dt><a href="#id2881795">Password Synchronisation using pam_smbpass.so</a></dt></dl></dd><dt><a href="#id2882047">Distributed Authentication</a></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2880956"></a>Samba and PAM</h2></div></div><p>
6779 A number of Unix systems (eg: Sun Solaris), as well as the 
6780 xxxxBSD family and Linux, now utilize the Pluggable Authentication 
6781 Modules (PAM) facility to provide all authentication, 
6782 authorization and resource control services. Prior to the 
6783 introduction of PAM, a decision to use an alternative to 
6784 the system password database (<tt>/etc/passwd</tt>) 
6785 would require the provision of alternatives for all programs that provide 
6786 security services. Such a choice would involve provision of 
6787 alternatives to such programs as: <b>login</b>, 
6788 <b>passwd</b>, <b>chown</b>, etc.
6789 </p><p>
6790 PAM provides a mechanism that disconnects these security programs 
6791 from the underlying authentication/authorization infrastructure.
6792 PAM is configured either through one file <tt>/etc/pam.conf</tt> (Solaris), 
6793 or by editing individual files that are located in <tt>/etc/pam.d</tt>.
6794 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
6795         If the PAM authentication module (loadable link library file) is located in the
6796         default location then it is not necessary to specify the path. In the case of
6797         Linux, the default location is <tt>/lib/security</tt>. If the module
6798         is located outside the default then the path must be specified as:
6799         
6800         </p><pre class="programlisting">
6801         auth       required      /other_path/pam_strange_module.so
6802         </pre><p>
6803         </p></div><p>
6804 The following is an example <tt>/etc/pam.d/login</tt> configuration file. 
6805 This example had all options been uncommented is probably not usable 
6806 as it stacks many conditions before allowing successful completion 
6807 of the login process. Essentially all conditions can be disabled 
6808 by commenting them out except the calls to <tt>pam_pwdb.so</tt>.
6809 </p><pre class="programlisting">
6810         #%PAM-1.0
6811         # The PAM configuration file for the `login' service
6812         #
6813         auth            required        pam_securetty.so
6814         auth            required        pam_nologin.so
6815         # auth          required        pam_dialup.so
6816         # auth          optional        pam_mail.so
6817         auth            required        pam_pwdb.so shadow md5
6818         # account       requisite       pam_time.so
6819         account         required        pam_pwdb.so
6820         session         required        pam_pwdb.so
6821         # session       optional        pam_lastlog.so
6822         # password      required        pam_cracklib.so retry=3
6823         password        required        pam_pwdb.so shadow md5
6824 </pre><p>
6825 PAM allows use of replacable modules. Those available on a 
6826 sample system include:
6827 </p><p><tt>$</tt><b><tt>/bin/ls /lib/security</tt></b>
6828 </p><pre class="programlisting">
6829         pam_access.so    pam_ftp.so          pam_limits.so     
6830         pam_ncp_auth.so  pam_rhosts_auth.so  pam_stress.so     
6831         pam_cracklib.so  pam_group.so        pam_listfile.so   
6832         pam_nologin.so   pam_rootok.so       pam_tally.so      
6833         pam_deny.so      pam_issue.so        pam_mail.so       
6834         pam_permit.so    pam_securetty.so    pam_time.so       
6835         pam_dialup.so    pam_lastlog.so      pam_mkhomedir.so  
6836         pam_pwdb.so      pam_shells.so       pam_unix.so       
6837         pam_env.so       pam_ldap.so         pam_motd.so       
6838         pam_radius.so    pam_smbpass.so      pam_unix_acct.so  
6839         pam_wheel.so     pam_unix_auth.so    pam_unix_passwd.so
6840         pam_userdb.so    pam_warn.so         pam_unix_session.so
6841 </pre><p>
6842 The following example for the login program replaces the use of 
6843 the <tt>pam_pwdb.so</tt> module which uses the system 
6844 password database (<tt>/etc/passwd</tt>,
6845 <tt>/etc/shadow</tt>, <tt>/etc/group</tt>) with 
6846 the module <tt>pam_smbpass.so</tt> which uses the Samba 
6847 database which contains the Microsoft MD4 encrypted password 
6848 hashes. This database is stored in either 
6849 <tt>/usr/local/samba/private/smbpasswd</tt>, 
6850 <tt>/etc/samba/smbpasswd</tt>, or in 
6851 <tt>/etc/samba.d/smbpasswd</tt>, depending on the 
6852 Samba implementation for your Unix/Linux system. The 
6853 <tt>pam_smbpass.so</tt> module is provided by 
6854 Samba version 2.2.1 or later. It can be compiled by specifying the 
6855 <b>--with-pam_smbpass</b> options when running Samba's
6856 <tt>configure</tt> script.  For more information
6857 on the <tt>pam_smbpass</tt> module, see the documentation
6858 in the <tt>source/pam_smbpass</tt> directory of the Samba 
6859 source distribution.
6860 </p><pre class="programlisting">
6861         #%PAM-1.0
6862         # The PAM configuration file for the `login' service
6863         #
6864         auth            required        pam_smbpass.so nodelay
6865         account         required        pam_smbpass.so nodelay
6866         session         required        pam_smbpass.so nodelay
6867         password        required        pam_smbpass.so nodelay
6868 </pre><p>
6869 The following is the PAM configuration file for a particular 
6870 Linux system. The default condition uses <tt>pam_pwdb.so</tt>.
6871 </p><pre class="programlisting">
6872         #%PAM-1.0
6873         # The PAM configuration file for the `samba' service
6874         #
6875         auth       required     pam_pwdb.so nullok nodelay shadow audit
6876         account    required     pam_pwdb.so audit nodelay
6877         session    required     pam_pwdb.so nodelay
6878         password   required     pam_pwdb.so shadow md5
6879 </pre><p>
6880 In the following example the decision has been made to use the 
6881 smbpasswd database even for basic samba authentication. Such a 
6882 decision could also be made for the passwd program and would 
6883 thus allow the smbpasswd passwords to be changed using the passwd 
6884 program.
6885 </p><pre class="programlisting">
6886         #%PAM-1.0
6887         # The PAM configuration file for the `samba' service
6888         #
6889         auth       required     pam_smbpass.so nodelay
6890         account    required     pam_pwdb.so audit nodelay
6891         session    required     pam_pwdb.so nodelay
6892         password   required     pam_smbpass.so nodelay smbconf=/etc/samba.d/smb.conf
6893 </pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>PAM allows stacking of authentication mechanisms. It is 
6894 also possible to pass information obtained within one PAM module through 
6895 to the next module in the PAM stack. Please refer to the documentation for 
6896 your particular system implementation for details regarding the specific 
6897 capabilities of PAM in this environment. Some Linux implmentations also 
6898 provide the <tt>pam_stack.so</tt> module that allows all 
6899 authentication to be configured in a single central file. The 
6900 <tt>pam_stack.so</tt> method has some very devoted followers 
6901 on the basis that it allows for easier administration. As with all issues in 
6902 life though, every decision makes trade-offs, so you may want examine the 
6903 PAM documentation for further helpful information.
6904 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2881738"></a>PAM Configuration in smb.conf</h3></div></div><p>
6905 There is an option in smb.conf called <a href="smb.conf.5.html#OBEYPAMRESTRICTIONS" target="_top">obey pam restrictions</a>. 
6906 The following is from the on-line help for this option in SWAT;
6907 </p><p>
6908 When Samba is configured to enable PAM support (i.e. 
6909 <tt>--with-pam</tt>), this parameter will 
6910 control whether or not Samba should obey PAM's account 
6911 and session management directives. The default behavior 
6912 is to use PAM for clear text authentication only and to 
6913 ignore any account or session management. Note that Samba always 
6914 ignores PAM for authentication in the case of 
6915 <a href="smb.conf.5.html#ENCRYPTPASSWORDS" target="_top">encrypt passwords = yes</a>. 
6916 The reason is that PAM modules cannot support the challenge/response 
6917 authentication mechanism needed in the presence of SMB 
6918 password encryption. 
6919 </p><p>Default: <b>obey pam restrictions = no</b></p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2881795"></a>Password Synchronisation using pam_smbpass.so</h3></div></div><p>
6920 pam_smbpass is a PAM module which can be used on conforming systems to
6921 keep the smbpasswd (Samba password) database in sync with the unix
6922 password file. PAM (Pluggable Authentication Modules) is an API supported
6923 under some Unices, such as Solaris, HPUX and Linux, that provides a
6924 generic interface to authentication mechanisms.
6925 </p><p>
6926 For more information on PAM, see http://ftp.kernel.org/pub/linux/libs/pam/
6927 </p><p>
6928 This module authenticates a local smbpasswd user database.  If you require
6929 support for authenticating against a remote SMB server, or if you're
6930 concerned about the presence of suid root binaries on your system, it is
6931 recommended that you use pam_winbind instead.
6932 </p><pre class="programlisting">
6933 Options recognized by this module are as follows:
6934
6935         debug           -       log more debugging info
6936         audit           -       like debug, but also logs unknown usernames
6937         use_first_pass  -       don't prompt the user for passwords;
6938                                 take them from PAM_ items instead
6939         try_first_pass  -       try to get the password from a previous
6940                                 PAM module, fall back to prompting the user
6941         use_authtok     -       like try_first_pass, but *fail* if the new
6942                                 PAM_AUTHTOK has not been previously set.
6943                                 (intended for stacking password modules only)
6944         not_set_pass    -       don't make passwords used by this module
6945                                 available to other modules.
6946         nodelay         -       don't insert ~1 second delays on authentication
6947                                 failure.
6948         nullok          -       null passwords are allowed.
6949         nonull          -       null passwords are not allowed. Used to
6950                                 override the Samba configuration.
6951         migrate         -       only meaningful in an &quot;auth&quot; context;
6952                                 used to update smbpasswd file with a
6953                                 password used for successful authentication.
6954         smbconf=&lt; file &gt;  -     specify an alternate path to the smb.conf
6955                                 file.
6956 </pre><pre class="programlisting">
6957 Thanks go to the following people:
6958
6959         * Andrew Morgan &lt; morgan@transmeta.com &gt;, for providing the Linux-PAM
6960         framework, without which none of this would have happened
6961
6962         * Christian Gafton &lt; gafton@redhat.com &gt; and Andrew Morgan again, for the
6963         pam_pwdb module upon which pam_smbpass was originally based
6964
6965         * Luke Leighton &lt; lkcl@switchboard.net &gt; for being receptive to the idea,
6966         and for the occasional good-natured complaint about the project's status
6967         that keep me working on it :)
6968
6969         * and of course, all the other members of the Samba team
6970         &lt;http://www.samba.org/samba/team.html&gt;, for creating a great product
6971         and for giving this project a purpose
6972
6973         ---------------------
6974         Stephen Langasek &lt; vorlon@netexpress.net &gt;
6975 </pre><p>
6976 The following are examples of the use of pam_smbpass.so in the format of Linux
6977 <tt>/etc/pam.d/</tt> files structure. Those wishing to implement this
6978 tool on other platforms will need to adapt this appropriately.
6979 </p><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2881907"></a>Password Synchonisation Configuration</h4></div></div><p>
6980 A sample PAM configuration that shows the use of pam_smbpass to make
6981 sure private/smbpasswd is kept in sync when /etc/passwd (/etc/shadow)
6982 is changed.  Useful when an expired password might be changed by an
6983 application (such as ssh).
6984 </p><pre class="programlisting">
6985         #%PAM-1.0
6986         # password-sync
6987         #
6988         auth       requisite        pam_nologin.so
6989         auth       required         pam_unix.so
6990         account    required         pam_unix.so
6991         password   requisite        pam_cracklib.so retry=3
6992         password   requisite        pam_unix.so shadow md5 use_authtok try_first_pass
6993         password   required         pam_smbpass.so nullok use_authtok try_first_pass
6994         session    required         pam_unix.so
6995 </pre></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2881941"></a>Password Migration Configuration</h4></div></div><p>
6996 A sample PAM configuration that shows the use of pam_smbpass to migrate
6997 from plaintext to encrypted passwords for Samba.  Unlike other methods,
6998 this can be used for users who have never connected to Samba shares:
6999 password migration takes place when users ftp in, login using ssh, pop
7000 their mail, etc.
7001 </p><pre class="programlisting">
7002         #%PAM-1.0
7003         # password-migration
7004         #
7005         auth       requisite        pam_nologin.so
7006         # pam_smbpass is called IFF pam_unix succeeds.
7007         auth       requisite        pam_unix.so
7008         auth       optional         pam_smbpass.so migrate
7009         account    required         pam_unix.so
7010         password   requisite        pam_cracklib.so retry=3
7011         password   requisite        pam_unix.so shadow md5 use_authtok try_first_pass
7012         password   optional         pam_smbpass.so nullok use_authtok try_first_pass
7013         session    required         pam_unix.so
7014 </pre></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2881978"></a>Mature Password Configuration</h4></div></div><p>
7015 A sample PAM configuration for a 'mature' smbpasswd installation.
7016 private/smbpasswd is fully populated, and we consider it an error if
7017 the smbpasswd doesn't exist or doesn't match the Unix password.
7018 </p><pre class="programlisting">
7019         #%PAM-1.0
7020         # password-mature
7021         #
7022         auth       requisite        pam_nologin.so
7023         auth       required         pam_unix.so
7024         account    required         pam_unix.so
7025         password   requisite        pam_cracklib.so retry=3
7026         password   requisite        pam_unix.so shadow md5 use_authtok try_first_pass
7027         password   required         pam_smbpass.so use_authtok use_first_pass
7028         session    required         pam_unix.so
7029 </pre></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2882011"></a>Kerberos Password Integration Configuration</h4></div></div><p>
7030 A sample PAM configuration that shows pam_smbpass used together with
7031 pam_krb5.  This could be useful on a Samba PDC that is also a member of
7032 a Kerberos realm.
7033 </p><pre class="programlisting">
7034         #%PAM-1.0
7035         # kdc-pdc
7036         #
7037         auth       requisite        pam_nologin.so
7038         auth       requisite        pam_krb5.so
7039         auth       optional         pam_smbpass.so migrate
7040         account    required         pam_krb5.so
7041         password   requisite        pam_cracklib.so retry=3
7042         password   optional         pam_smbpass.so nullok use_authtok try_first_pass
7043         password   required         pam_krb5.so use_authtok try_first_pass
7044         session    required         pam_krb5.so
7045 </pre></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2882047"></a>Distributed Authentication</h2></div></div><p>
7046 The astute administrator will realize from this that the 
7047 combination of <tt>pam_smbpass.so</tt>, 
7048 <b>winbindd</b>, and a distributed 
7049 passdb backend, such as ldap, will allow the establishment of a
7050 centrally managed, distributed 
7051 user/password database that can also be used by all 
7052 PAM (eg: Linux) aware programs and applications. This arrangement 
7053 can have particularly potent advantages compared with the 
7054 use of Microsoft Active Directory Service (ADS) in so far as 
7055 reduction of wide area network authentication traffic.
7056 </p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="VFS"></a>Chapter 21. Stackable VFS modules</h2></div><div><div class="author"><h3 class="author">Jelmer R. Vernooij</h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Alexander Bokovoy</h3></div></div><div><div class="author"><h3 class="author">Tim Potter</h3></div></div><div><div class="author"><h3 class="author">Simo Sorce</h3></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2881331">Introduction and configuration</a></dt><dt><a href="#id2882249">Included modules</a></dt><dd><dl><dt><a href="#id2882256">audit</a></dt><dt><a href="#id2882295">extd_audit</a></dt><dt><a href="#id2882416">recycle</a></dt><dt><a href="#id2882554">netatalk</a></dt></dl></dd><dt><a href="#id2882592">VFS modules available elsewhere</a></dt><dd><dl><dt><a href="#id2882614">DatabaseFS</a></dt><dt><a href="#id2882669">vscan</a></dt></dl></dd></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2881331"></a>Introduction and configuration</h2></div></div><p>
7057 Since samba 3.0, samba supports stackable VFS(Virtual File System) modules.  
7058 Samba passes each request to access the unix file system thru the loaded VFS modules. 
7059 This chapter covers all the modules that come with the samba source and references to 
7060 some external modules.
7061 </p><p>
7062 You may have problems to compile these modules, as shared libraries are
7063 compiled and linked in different ways on different systems.
7064 They currently have been tested against GNU/linux and IRIX.
7065 </p><p>
7066 To use the VFS modules, create a share similar to the one below.  The
7067 important parameter is the <b>vfs object</b> parameter which must point to
7068 the exact pathname of the shared library objects. For example, to log all access 
7069 to files and use a recycle bin:
7070
7071 </p><pre class="programlisting">
7072        [audit]
7073                 comment = Audited /data directory
7074                 path = /data
7075                 vfs object = /path/to/audit.so /path/to/recycle.so
7076                 writeable = yes
7077                 browseable = yes
7078 </pre><p>
7079 </p><p>
7080 The modules are used in the order they are specified.
7081 </p><p>
7082 Further documentation on writing VFS modules for Samba can be found in
7083 the Samba Developers Guide.
7084 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2882249"></a>Included modules</h2></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2882256"></a>audit</h3></div></div><p>A simple module to audit file access to the syslog
7085 facility.  The following operations are logged:
7086 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>share</td></tr><tr><td>connect/disconnect</td></tr><tr><td>directory opens/create/remove</td></tr><tr><td>file open/close/rename/unlink/chmod</td></tr></table><p>
7087 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2882295"></a>extd_audit</h3></div></div><p>
7088 This module is identical with the <span class="emphasis"><em>audit</em></span> module above except
7089 that it sends audit logs to both syslog as well as the smbd log file/s. The 
7090 loglevel for this module is set in the smb.conf file.
7091 </p><p>
7092 The logging information that will be written to the smbd log file is controlled by
7093 the <span class="emphasis"><em>log level</em></span> parameter in <tt>smb.conf</tt>. The
7094 following information will be recorded:
7095 </p><div class="table"><a name="id2882333"></a><p class="title"><b>Table 21.1. Extended Auditing Log Information</b></p><table summary="Extended Auditing Log Information" border="1"><colgroup><col><col></colgroup><thead><tr><th align="center">Log Level</th><th align="center">Log Details - File and Directory Operations</th></tr></thead><tbody><tr><td align="center">0</td><td align="left">Creation / Deletion</td></tr><tr><td align="center">1</td><td align="left">Create / Delete / Rename / Permission Changes</td></tr><tr><td align="center">2</td><td align="left">Create / Delete / Rename / Perm Change / Open / Close</td></tr></tbody></table></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2882416"></a>recycle</h3></div></div><p>
7096 A recycle-bin like module. When used any unlink call
7097 will be intercepted and files moved to the recycle
7098 directory instead of being deleted.
7099 </p><p>Supported options:
7100 </p><div class="variablelist"><dl><dt><span class="term">vfs_recycle_bin:repository</span></dt><dd><p>FIXME</p></dd><dt><span class="term">vfs_recycle_bin:keeptree</span></dt><dd><p>FIXME</p></dd><dt><span class="term">vfs_recycle_bin:versions</span></dt><dd><p>FIXME</p></dd><dt><span class="term">vfs_recycle_bin:touch</span></dt><dd><p>FIXME</p></dd><dt><span class="term">vfs_recycle_bin:maxsize</span></dt><dd><p>FIXME</p></dd><dt><span class="term">vfs_recycle_bin:exclude</span></dt><dd><p>FIXME</p></dd><dt><span class="term">vfs_recycle_bin:exclude_dir</span></dt><dd><p>FIXME</p></dd><dt><span class="term">vfs_recycle_bin:noversions</span></dt><dd><p>FIXME</p></dd></dl></div><p>
7101 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2882554"></a>netatalk</h3></div></div><p>
7102 A netatalk module, that will ease co-existence of samba and
7103 netatalk file sharing services.
7104 </p><p>Advantages compared to the old netatalk module:
7105 </p><table class="simplelist" border="0" summary="Simple list"><tr><td>it doesn't care about creating of .AppleDouble forks, just keeps them in sync</td></tr><tr><td>if share in smb.conf doesn't contain .AppleDouble item in hide or veto list, it will be added automatically</td></tr></table><p>
7106 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2882592"></a>VFS modules available elsewhere</h2></div></div><p>
7107 This section contains a listing of various other VFS modules that 
7108 have been posted but don't currently reside in the Samba CVS 
7109 tree for one reason or another (e.g. it is easy for the maintainer 
7110 to have his or her own CVS tree).
7111 </p><p>
7112 No statemets about the stability or functionality of any module
7113 should be implied due to its presence here.
7114 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2882614"></a>DatabaseFS</h3></div></div><p>
7115 URL: <a href="http://www.css.tayloru.edu/~elorimer/databasefs/index.php" target="_top">http://www.css.tayloru.edu/~elorimer/databasefs/index.php</a>
7116 </p><p>By <a href="mailto:elorimer@css.tayloru.edu" target="_top">Eric Lorimer</a>.</p><p>
7117 I have created a VFS module which implements a fairly complete read-only
7118 filesystem.  It presents information from a database as a filesystem in
7119 a modular and generic way to allow different databases to be used
7120 (originally designed for organizing MP3s under directories such as
7121 &quot;Artists,&quot; &quot;Song Keywords,&quot; etc... I have since applied it to a student
7122 roster database very easily).  The directory structure is stored in the
7123 database itself and the module makes no assumptions about the database
7124 structure beyond the table it requires to run.
7125 </p><p>
7126 Any feedback would be appreciated: comments, suggestions, patches,
7127 etc...  If nothing else, hopefully it might prove useful for someone
7128 else who wishes to create a virtual filesystem.
7129 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2882669"></a>vscan</h3></div></div><p>URL: <a href="http://www.openantivirus.org/" target="_top">http://www.openantivirus.org/</a></p><p>
7130 samba-vscan is a proof-of-concept module for Samba, which
7131 uses the VFS (virtual file system) features of Samba 2.2.x/3.0
7132 alphaX. Of couse, Samba has to be compiled with VFS support. 
7133 samba-vscan supports various virus scanners and is maintained 
7134 by Rainer Link.
7135 </p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="msdfs"></a>Chapter 22. Hosting a Microsoft Distributed File System tree on Samba</h2></div><div><div class="author"><h3 class="author">Shirish Kalele</h3><div class="affiliation"><span class="orgname">Samba Team &amp; Veritas Software<br></span><div class="address"><p><br>
7136                                 <tt>&lt;<a href="mailto:samba@samba.org">samba@samba.org</a>&gt;</tt><br>
7137                         </p></div></div></div></div><div><p class="pubdate">12 Jul 2000</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2882214">Instructions</a></dt><dd><dl><dt><a href="#id2882961">Notes</a></dt></dl></dd></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2882214"></a>Instructions</h2></div></div><p>The Distributed File System (or Dfs) provides a means of 
7138         separating the logical view of files and directories that users 
7139         see from the actual physical locations of these resources on the 
7140         network. It allows for higher availability, smoother storage expansion, 
7141         load balancing etc. For more information about Dfs, refer to  <a href="http://www.microsoft.com/NTServer/nts/downloads/winfeatures/NTSDistrFile/AdminGuide.asp" target="_top">
7142         Microsoft documentation</a>. </p><p>This document explains how to host a Dfs tree on a Unix 
7143         machine (for Dfs-aware clients to browse) using Samba.</p><p>To enable SMB-based DFS for Samba, configure it with the 
7144         <i><tt>--with-msdfs</tt></i> option. Once built, a 
7145         Samba server can be made a Dfs server by setting the global 
7146         boolean <a href="smb.conf.5.html#HOSTMSDFS" target="_top"><i><tt>
7147         host msdfs</tt></i></a> parameter in the <tt>smb.conf
7148         </tt> file. You designate a share as a Dfs root using the share 
7149         level boolean <a href="smb.conf.5.html#MSDFSROOT" target="_top"><i><tt>
7150         msdfs root</tt></i></a> parameter. A Dfs root directory on 
7151         Samba hosts Dfs links in the form of symbolic links that point 
7152         to other servers. For example, a symbolic link
7153         <tt>junction-&gt;msdfs:storage1\share1</tt> in 
7154         the share directory acts as the Dfs junction. When Dfs-aware 
7155         clients attempt to access the junction link, they are redirected 
7156         to the storage location (in this case, \\storage1\share1).</p><p>Dfs trees on Samba work with all Dfs-aware clients ranging 
7157         from Windows 95 to 2000.</p><p>Here's an example of setting up a Dfs tree on a Samba 
7158         server.</p><pre class="programlisting">
7159 # The smb.conf file:
7160 [global]
7161         netbios name = SAMBA
7162         host msdfs   = yes
7163
7164 [dfs]
7165         path = /export/dfsroot
7166         msdfs root = yes
7167         </pre><p>In the /export/dfsroot directory we set up our dfs links to 
7168         other servers on the network.</p><p><tt>root# </tt><b><tt>cd /export/dfsroot</tt></b></p><p><tt>root# </tt><b><tt>chown root /export/dfsroot</tt></b></p><p><tt>root# </tt><b><tt>chmod 755 /export/dfsroot</tt></b></p><p><tt>root# </tt><b><tt>ln -s msdfs:storageA\\shareA linka</tt></b></p><p><tt>root# </tt><b><tt>ln -s msdfs:serverB\\share,serverC\\share linkb</tt></b></p><p>You should set up the permissions and ownership of 
7169         the directory acting as the Dfs root such that only designated 
7170         users can create, delete or modify the msdfs links. Also note 
7171         that symlink names should be all lowercase. This limitation exists 
7172         to have Samba avoid trying all the case combinations to get at 
7173         the link name. Finally set up the symbolic links to point to the 
7174         network shares you want, and start Samba.</p><p>Users on Dfs-aware clients can now browse the Dfs tree 
7175         on the Samba server at \\samba\dfs. Accessing 
7176         links linka or linkb (which appear as directories to the client) 
7177         takes users directly to the appropriate shares on the network.</p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2882961"></a>Notes</h3></div></div><div class="itemizedlist"><ul type="disc"><li><p>Windows clients need to be rebooted 
7178                         if a previously mounted non-dfs share is made a dfs 
7179                         root or vice versa. A better way is to introduce a 
7180                         new share and make it the dfs root.</p></li><li><p>Currently there's a restriction that msdfs 
7181                         symlink names should all be lowercase.</p></li><li><p>For security purposes, the directory 
7182                         acting as the root of the Dfs tree should have ownership 
7183                         and permissions set so that only designated users can 
7184                         modify the symbolic links in the directory.</p></li></ul></div></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="integrate-ms-networks"></a>Chapter 23. Integrating MS Windows networks with Samba</h2></div><div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate"> (Jan 01 2001) </p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2882745">Name Resolution in a pure Unix/Linux world</a></dt><dd><dl><dt><a href="#id2883178">/etc/hosts</a></dt><dt><a href="#id2883316">/etc/resolv.conf</a></dt><dt><a href="#id2883360">/etc/host.conf</a></dt><dt><a href="#id2883403">/etc/nsswitch.conf</a></dt></dl></dd><dt><a href="#id2883498">Name resolution as used within MS Windows networking</a></dt><dd><dl><dt><a href="#id2883030">The NetBIOS Name Cache</a></dt><dt><a href="#id2883069">The LMHOSTS file</a></dt><dt><a href="#id2883112">HOSTS file</a></dt><dt><a href="#id2883144">DNS Lookup</a></dt><dt><a href="#id2883156">WINS Lookup</a></dt></dl></dd></dl></div><p>
7185 This section deals with NetBIOS over TCP/IP name to IP address resolution. If
7186 your MS Windows clients are NOT configured to use NetBIOS over TCP/IP then this
7187 section does not apply to your installation. If your installation involves use of
7188 NetBIOS over TCP/IP then this section may help you to resolve networking problems.
7189 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
7190         NetBIOS over TCP/IP has nothing to do with NetBEUI. NetBEUI is NetBIOS
7191         over Logical Link Control (LLC). On modern networks it is highly advised
7192         to NOT run NetBEUI at all. Note also that there is NO such thing as
7193         NetBEUI over TCP/IP - the existence of such a protocol is a complete
7194         and utter mis-apprehension.
7195 </p></div><p>
7196 Since the introduction of MS Windows 2000 it is possible to run MS Windows networking
7197 without the use of NetBIOS over TCP/IP. NetBIOS over TCP/IP uses UDP port 137 for NetBIOS
7198 name resolution and uses TCP port 139 for NetBIOS session services. When NetBIOS over
7199 TCP/IP is disabled on MS Windows 2000 and later clients then only TCP port 445 will be
7200 used and UDP port 137 and TCP port 139 will not.
7201 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
7202 When using Windows 2000 or later clients, if NetBIOS over TCP/IP is NOT disabled, then
7203 the client will use UDP port 137 (NetBIOS Name Service, also known as the Windows Internet
7204 Name Service or WINS), TCP port 139 AND TCP port 445 (for actual file and print traffic).
7205 </p></div><p>
7206 When NetBIOS over TCP/IP is disabled the use of DNS is essential. Most installations that
7207 disable NetBIOS over TCP/IP today use MS Active Directory Service (ADS). ADS requires
7208 Dynamic DNS with Service Resource Records (SRV RR) and with Incremental Zone Transfers (IXFR).
7209 Use of DHCP with ADS is recommended as a further means of maintaining central control
7210 over client workstation network configuration.
7211 </p><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2882745"></a>Name Resolution in a pure Unix/Linux world</h2></div></div><p>
7212 The key configuration files covered in this section are:
7213 </p><div class="itemizedlist"><ul type="disc"><li><p><tt>/etc/hosts</tt></p></li><li><p><tt>/etc/resolv.conf</tt></p></li><li><p><tt>/etc/host.conf</tt></p></li><li><p><tt>/etc/nsswitch.conf</tt></p></li></ul></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2883178"></a><tt>/etc/hosts</tt></h3></div></div><p>
7214 Contains a static list of IP Addresses and names.
7215 eg:
7216 </p><pre class="programlisting">
7217         127.0.0.1       localhost localhost.localdomain
7218         192.168.1.1     bigbox.caldera.com      bigbox  alias4box
7219 </pre><p>
7220 The purpose of <tt>/etc/hosts</tt> is to provide a 
7221 name resolution mechanism so that uses do not need to remember 
7222 IP addresses.
7223 </p><p>
7224 Network packets that are sent over the physical network transport 
7225 layer communicate not via IP addresses but rather using the Media 
7226 Access Control address, or MAC address. IP Addresses are currently 
7227 32 bits in length and are typically presented as four (4) decimal 
7228 numbers that are separated by a dot (or period). eg: 168.192.1.1
7229 </p><p>
7230 MAC Addresses use 48 bits (or 6 bytes) and are typically represented 
7231 as two digit hexadecimal numbers separated by colons. eg: 
7232 40:8e:0a:12:34:56
7233 </p><p>
7234 Every network interfrace must have an MAC address. Associated with 
7235 a MAC address there may be one or more IP addresses. There is NO 
7236 relationship between an IP address and a MAC address, all such assignments 
7237 are arbitary or discretionary in nature. At the most basic level all 
7238 network communications takes place using MAC addressing. Since MAC 
7239 addresses must be globally unique, and generally remains fixed for 
7240 any particular interface, the assignment of an IP address makes sense 
7241 from a network management perspective. More than one IP address can 
7242 be assigned per MAC address. One address must be the primary IP address, 
7243 this is the address that will be returned in the ARP reply.
7244 </p><p>
7245 When a user or a process wants to communicate with another machine 
7246 the protocol implementation ensures that the &quot;machine name&quot; or &quot;host 
7247 name&quot; is resolved to an IP address in a manner that is controlled 
7248 by the TCP/IP configuration control files. The file 
7249 <tt>/etc/hosts</tt> is one such file.
7250 </p><p>
7251 When the IP address of the destination interface has been 
7252 determined a protocol called ARP/RARP is used to identify 
7253 the MAC address of the target interface. ARP stands for Address 
7254 Resolution Protocol, and is a broadcast oriented method that 
7255 uses UDP (User Datagram Protocol) to send a request to all 
7256 interfaces on the local network segment using the all 1's MAC 
7257 address. Network interfaces are programmed to respond to two 
7258 MAC addresses only; their own unique address and the address 
7259 ff:ff:ff:ff:ff:ff. The reply packet from an ARP request will 
7260 contain the MAC address and the primary IP address for each 
7261 interface.
7262 </p><p>
7263 The <tt>/etc/hosts</tt> file is foundational to all 
7264 Unix/Linux TCP/IP installations and as a minumum will contain 
7265 the localhost and local network interface IP addresses and the 
7266 primary names by which they are known within the local machine. 
7267 This file helps to prime the pump so that a basic level of name 
7268 resolution can exist before any other method of name resolution 
7269 becomes available.
7270 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2883316"></a><tt>/etc/resolv.conf</tt></h3></div></div><p>
7271 This file tells the name resolution libraries:
7272 </p><div class="itemizedlist"><ul type="disc"><li><p>The name of the domain to which the machine 
7273         belongs
7274         </p></li><li><p>The name(s) of any domains that should be 
7275         automatically searched when trying to resolve unqualified 
7276         host names to their IP address
7277         </p></li><li><p>The name or IP address of available Domain 
7278         Name Servers that may be asked to perform name to address 
7279         translation lookups
7280         </p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2883360"></a><tt>/etc/host.conf</tt></h3></div></div><p>
7281 <tt>/etc/host.conf</tt> is the primary means by 
7282 which the setting in /etc/resolv.conf may be affected. It is a 
7283 critical configuration file.  This file controls the order by 
7284 which name resolution may procede. The typical structure is:
7285 </p><pre class="programlisting">
7286         order hosts,bind
7287         multi on
7288 </pre><p>
7289 then both addresses should be returned. Please refer to the 
7290 man page for host.conf for further details.
7291 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2883403"></a><tt>/etc/nsswitch.conf</tt></h3></div></div><p>
7292 This file controls the actual name resolution targets. The 
7293 file typically has resolver object specifications as follows:
7294 </p><pre class="programlisting">
7295         # /etc/nsswitch.conf
7296         #
7297         # Name Service Switch configuration file.
7298         #
7299
7300         passwd:         compat
7301         # Alternative entries for password authentication are:
7302         # passwd:       compat files nis ldap winbind
7303         shadow:         compat
7304         group:          compat
7305
7306         hosts:          files nis dns
7307         # Alternative entries for host name resolution are:
7308         # hosts:        files dns nis nis+ hesoid db compat ldap wins
7309         networks:       nis files dns
7310
7311         ethers:         nis files
7312         protocols:      nis files
7313         rpc:            nis files
7314         services:       nis files
7315 </pre><p>
7316 Of course, each of these mechanisms requires that the appropriate 
7317 facilities and/or services are correctly configured.
7318 </p><p>
7319 It should be noted that unless a network request/message must be 
7320 sent, TCP/IP networks are silent. All TCP/IP communications assumes a 
7321 principal of speaking only when necessary.
7322 </p><p>
7323 Starting with version 2.2.0 samba has Linux support for extensions to 
7324 the name service switch infrastructure so that linux clients will 
7325 be able to obtain resolution of MS Windows NetBIOS names to IP 
7326 Addresses. To gain this functionality Samba needs to be compiled 
7327 with appropriate arguments to the make command (ie: <b>make 
7328 nsswitch/libnss_wins.so</b>). The resulting library should 
7329 then be installed in the <tt>/lib</tt> directory and 
7330 the &quot;wins&quot; parameter needs to be added to the &quot;hosts:&quot; line in 
7331 the <tt>/etc/nsswitch.conf</tt> file. At this point it 
7332 will be possible to ping any MS Windows machine by it's NetBIOS 
7333 machine name, so long as that machine is within the workgroup to 
7334 which both the samba machine and the MS Windows machine belong.
7335 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2883498"></a>Name resolution as used within MS Windows networking</h2></div></div><p>
7336 MS Windows networking is predicated about the name each machine 
7337 is given. This name is known variously (and inconsistently) as 
7338 the &quot;computer name&quot;, &quot;machine name&quot;, &quot;networking name&quot;, &quot;netbios name&quot;, 
7339 &quot;SMB name&quot;. All terms mean the same thing with the exception of 
7340 &quot;netbios name&quot; which can apply also to the name of the workgroup or the 
7341 domain name. The terms &quot;workgroup&quot; and &quot;domain&quot; are really just a 
7342 simply name with which the machine is associated. All NetBIOS names 
7343 are exactly 16 characters in length. The 16th character is reserved. 
7344 It is used to store a one byte value that indicates service level 
7345 information for the NetBIOS name that is registered. A NetBIOS machine 
7346 name is therefore registered for each service type that is provided by 
7347 the client/server.
7348 </p><p>
7349 The following are typical NetBIOS name/service type registrations:
7350 </p><pre class="programlisting">
7351         Unique NetBIOS Names:
7352                 MACHINENAME&lt;00&gt;   = Server Service is running on MACHINENAME
7353                 MACHINENAME&lt;03&gt; = Generic Machine Name (NetBIOS name)
7354                 MACHINENAME&lt;20&gt; = LanMan Server service is running on MACHINENAME
7355                 WORKGROUP&lt;1b&gt; = Domain Master Browser
7356
7357         Group Names:
7358                 WORKGROUP&lt;03&gt; = Generic Name registered by all members of WORKGROUP
7359                 WORKGROUP&lt;1c&gt; = Domain Controllers / Netlogon Servers
7360                 WORKGROUP&lt;1d&gt; = Local Master Browsers
7361                 WORKGROUP&lt;1e&gt; = Internet Name Resolvers
7362 </pre><p>
7363 It should be noted that all NetBIOS machines register their own 
7364 names as per the above. This is in vast contrast to TCP/IP 
7365 installations where traditionally the system administrator will 
7366 determine in the /etc/hosts or in the DNS database what names 
7367 are associated with each IP address.
7368 </p><p>
7369 One further point of clarification should be noted, the <tt>/etc/hosts</tt> 
7370 file and the DNS records do not provide the NetBIOS name type information 
7371 that MS Windows clients depend on to locate the type of service that may 
7372 be needed. An example of this is what happens when an MS Windows client 
7373 wants to locate a domain logon server. It finds this service and the IP 
7374 address of a server that provides it by performing a lookup (via a 
7375 NetBIOS broadcast) for enumeration of all machines that have 
7376 registered the name type *&lt;1c&gt;. A logon request is then sent to each 
7377 IP address that is returned in the enumerated list of IP addresses. Which 
7378 ever machine first replies then ends up providing the logon services.
7379 </p><p>
7380 The name &quot;workgroup&quot; or &quot;domain&quot; really can be confusing since these 
7381 have the added significance of indicating what is the security 
7382 architecture of the MS Windows network. The term &quot;workgroup&quot; indicates 
7383 that the primary nature of the network environment is that of a 
7384 peer-to-peer design. In a WORKGROUP all machines are responsible for 
7385 their own security, and generally such security is limited to use of 
7386 just a password (known as SHARE MODE security). In most situations 
7387 with peer-to-peer networking the users who control their own machines 
7388 will simply opt to have no security at all. It is possible to have 
7389 USER MODE security in a WORKGROUP environment, thus requiring use 
7390 of a user name and a matching password.
7391 </p><p>
7392 MS Windows networking is thus predetermined to use machine names 
7393 for all local and remote machine message passing. The protocol used is 
7394 called Server Message Block (SMB) and this is implemented using 
7395 the NetBIOS protocol (Network Basic Input Output System). NetBIOS can 
7396 be encapsulated using LLC (Logical Link Control) protocol - in which case 
7397 the resulting protocol is called NetBEUI (Network Basic Extended User 
7398 Interface). NetBIOS can also be run over IPX (Internetworking Packet 
7399 Exchange) protocol as used by Novell NetWare, and it can be run 
7400 over TCP/IP protocols - in which case the resulting protocol is called 
7401 NBT or NetBT, the NetBIOS over TCP/IP.
7402 </p><p>
7403 MS Windows machines use a complex array of name resolution mechanisms. 
7404 Since we are primarily concerned with TCP/IP this demonstration is 
7405 limited to this area.
7406 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2883030"></a>The NetBIOS Name Cache</h3></div></div><p>
7407 All MS Windows machines employ an in memory buffer in which is 
7408 stored the NetBIOS names and IP addresses for all external 
7409 machines that that machine has communicated with over the 
7410 past 10-15 minutes. It is more efficient to obtain an IP address 
7411 for a machine from the local cache than it is to go through all the 
7412 configured name resolution mechanisms.
7413 </p><p>
7414 If a machine whose name is in the local name cache has been shut 
7415 down before the name had been expired and flushed from the cache, then 
7416 an attempt to exchange a message with that machine will be subject 
7417 to time-out delays. i.e.: Its name is in the cache, so a name resolution 
7418 lookup will succeed, but the machine can not respond. This can be 
7419 frustrating for users - but it is a characteristic of the protocol.
7420 </p><p>
7421 The MS Windows utility that allows examination of the NetBIOS 
7422 name cache is called &quot;nbtstat&quot;. The Samba equivalent of this 
7423 is called &quot;nmblookup&quot;.
7424 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2883069"></a>The LMHOSTS file</h3></div></div><p>
7425 This file is usually located in MS Windows NT 4.0 or 
7426 2000 in <tt>C:\WINNT\SYSTEM32\DRIVERS\ETC</tt> and contains 
7427 the IP Address and the machine name in matched pairs. The 
7428 <tt>LMHOSTS</tt> file performs NetBIOS name 
7429 to IP address mapping.
7430 </p><p>
7431 It typically looks like:
7432 </p><pre class="programlisting">
7433         # Copyright (c) 1998 Microsoft Corp.
7434         #
7435         # This is a sample LMHOSTS file used by the Microsoft Wins Client (NetBIOS
7436         # over TCP/IP) stack for Windows98
7437         #
7438         # This file contains the mappings of IP addresses to NT computernames
7439         # (NetBIOS) names.  Each entry should be kept on an individual line.
7440         # The IP address should be placed in the first column followed by the
7441         # corresponding computername. The address and the comptername
7442         # should be separated by at least one space or tab. The &quot;#&quot; character
7443         # is generally used to denote the start of a comment (see the exceptions
7444         # below).
7445         #
7446         # This file is compatible with Microsoft LAN Manager 2.x TCP/IP lmhosts
7447         # files and offers the following extensions:
7448         #
7449         #      #PRE
7450         #      #DOM:&lt;domain&gt;
7451         #      #INCLUDE &lt;filename&gt;
7452         #      #BEGIN_ALTERNATE
7453         #      #END_ALTERNATE
7454         #      \0xnn (non-printing character support)
7455         #
7456         # Following any entry in the file with the characters &quot;#PRE&quot; will cause
7457         # the entry to be preloaded into the name cache. By default, entries are
7458         # not preloaded, but are parsed only after dynamic name resolution fails.
7459         #
7460         # Following an entry with the &quot;#DOM:&lt;domain&gt;&quot; tag will associate the
7461         # entry with the domain specified by &lt;domain&gt;. This affects how the
7462         # browser and logon services behave in TCP/IP environments. To preload
7463         # the host name associated with #DOM entry, it is necessary to also add a
7464         # #PRE to the line. The &lt;domain&gt; is always preloaded although it will not
7465         # be shown when the name cache is viewed.
7466         #
7467         # Specifying &quot;#INCLUDE &lt;filename&gt;&quot; will force the RFC NetBIOS (NBT)
7468         # software to seek the specified &lt;filename&gt; and parse it as if it were
7469         # local. &lt;filename&gt; is generally a UNC-based name, allowing a
7470         # centralized lmhosts file to be maintained on a server.
7471         # It is ALWAYS necessary to provide a mapping for the IP address of the
7472         # server prior to the #INCLUDE. This mapping must use the #PRE directive.
7473         # In addtion the share &quot;public&quot; in the example below must be in the
7474         # LanManServer list of &quot;NullSessionShares&quot; in order for client machines to
7475         # be able to read the lmhosts file successfully. This key is under
7476         # \machine\system\currentcontrolset\services\lanmanserver\parameters\nullsessionshares
7477         # in the registry. Simply add &quot;public&quot; to the list found there.
7478         #
7479         # The #BEGIN_ and #END_ALTERNATE keywords allow multiple #INCLUDE
7480         # statements to be grouped together. Any single successful include
7481         # will cause the group to succeed.
7482         #
7483         # Finally, non-printing characters can be embedded in mappings by
7484         # first surrounding the NetBIOS name in quotations, then using the
7485         # \0xnn notation to specify a hex value for a non-printing character.
7486         #
7487         # The following example illustrates all of these extensions:
7488         #
7489         # 102.54.94.97     rhino         #PRE #DOM:networking  #net group's DC
7490         # 102.54.94.102    &quot;appname  \0x14&quot;                    #special app server
7491         # 102.54.94.123    popular            #PRE             #source server
7492         # 102.54.94.117    localsrv           #PRE             #needed for the include
7493         #
7494         # #BEGIN_ALTERNATE
7495         # #INCLUDE \\localsrv\public\lmhosts
7496         # #INCLUDE \\rhino\public\lmhosts
7497         # #END_ALTERNATE
7498         #
7499         # In the above example, the &quot;appname&quot; server contains a special
7500         # character in its name, the &quot;popular&quot; and &quot;localsrv&quot; server names are
7501         # preloaded, and the &quot;rhino&quot; server name is specified so it can be used
7502         # to later #INCLUDE a centrally maintained lmhosts file if the &quot;localsrv&quot;
7503         # system is unavailable.
7504         #
7505         # Note that the whole file is parsed including comments on each lookup,
7506         # so keeping the number of comments to a minimum will improve performance.
7507         # Therefore it is not advisable to simply add lmhosts file entries onto the
7508         # end of this file.
7509 </pre></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2883112"></a>HOSTS file</h3></div></div><p>
7510 This file is usually located in MS Windows NT 4.0 or 2000 in 
7511 <tt>C:\WINNT\SYSTEM32\DRIVERS\ETC</tt> and contains 
7512 the IP Address and the IP hostname in matched pairs. It can be 
7513 used by the name resolution infrastructure in MS Windows, depending 
7514 on how the TCP/IP environment is configured. This file is in 
7515 every way the equivalent of the Unix/Linux <tt>/etc/hosts</tt> file.
7516 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2883144"></a>DNS Lookup</h3></div></div><p>
7517 This capability is configured in the TCP/IP setup area in the network 
7518 configuration facility. If enabled an elaborate name resolution sequence 
7519 is followed the precise nature of which is dependant on what the NetBIOS 
7520 Node Type parameter is configured to. A Node Type of 0 means use 
7521 NetBIOS broadcast (over UDP broadcast) is first used if the name 
7522 that is the subject of a name lookup is not found in the NetBIOS name 
7523 cache. If that fails then DNS, HOSTS and LMHOSTS are checked. If set to 
7524 Node Type 8, then a NetBIOS Unicast (over UDP Unicast) is sent to the 
7525 WINS Server to obtain a lookup before DNS, HOSTS, LMHOSTS, or broadcast 
7526 lookup is used.
7527 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2883156"></a>WINS Lookup</h3></div></div><p>
7528 A WINS (Windows Internet Name Server) service is the equivaent of the 
7529 rfc1001/1002 specified NBNS (NetBIOS Name Server). A WINS server stores 
7530 the names and IP addresses that are registered by a Windows client 
7531 if the TCP/IP setup has been given at least one WINS Server IP Address.
7532 </p><p>
7533 To configure Samba to be a WINS server the following parameter needs 
7534 to be added to the <tt>smb.conf</tt> file:
7535 </p><pre class="programlisting">
7536         wins support = Yes
7537 </pre><p>
7538 To configure Samba to use a WINS server the following parameters are 
7539 needed in the <tt>smb.conf</tt> file:
7540 </p><pre class="programlisting">
7541         wins support = No
7542         wins server = xxx.xxx.xxx.xxx
7543 </pre><p>
7544 where <i><tt>xxx.xxx.xxx.xxx</tt></i> is the IP address 
7545 of the WINS server.
7546 </p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="securing-samba"></a>Chapter 24. Securing Samba</h2></div><div><div class="author"><h3 class="author">Andrew Tridgell</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:tridge@samba.org">tridge@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">17 March 2003</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2883603">Introduction</a></dt><dt><a href="#id2883619">Using host based protection</a></dt><dt><a href="#id2884070">Using interface protection</a></dt><dt><a href="#id2884122">Using a firewall</a></dt><dt><a href="#id2884164">Using a IPC$ share deny</a></dt><dt><a href="#id2883724">NTLMv2 Security</a></dt><dt><a href="#id2883760">Upgrading Samba</a></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2883603"></a>Introduction</h2></div></div><p>
7547 This note was attached to the Samba 2.2.8 release notes as it contained an
7548 important security fix.  The information contained here applies to Samba
7549 installations in general.
7550 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2883619"></a>Using host based protection</h2></div></div><p>
7551 In many installations of Samba the greatest threat comes for outside
7552 your immediate network. By default Samba will accept connections from
7553 any host, which means that if you run an insecure version of Samba on
7554 a host that is directly connected to the Internet you can be
7555 especially vulnerable.
7556 </p><p>
7557 One of the simplest fixes in this case is to use the <b>hosts allow</b> and
7558 <b>hosts deny</b> options in the Samba <tt>smb.conf</tt> configuration file to only
7559 allow access to your server from a specific range of hosts. An example
7560 might be:
7561 </p><pre class="programlisting">
7562         hosts allow = 127.0.0.1 192.168.2.0/24 192.168.3.0/24
7563         hosts deny = 0.0.0.0/0
7564 </pre><p>
7565 The above will only allow SMB connections from 'localhost' (your own
7566 computer) and from the two private networks 192.168.2 and
7567 192.168.3. All other connections will be refused as soon
7568 as the client sends its first packet. The refusal will be marked as a
7569 'not listening on called name' error.
7570 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2884070"></a>Using interface protection</h2></div></div><p>
7571 By default Samba will accept connections on any network interface that
7572 it finds on your system. That means if you have a ISDN line or a PPP
7573 connection to the Internet then Samba will accept connections on those
7574 links. This may not be what you want.
7575 </p><p>
7576 You can change this behaviour using options like the following:
7577 </p><pre class="programlisting">
7578         interfaces = eth* lo
7579         bind interfaces only = yes
7580 </pre><p>
7581 This tells Samba to only listen for connections on interfaces with a
7582 name starting with 'eth' such as eth0, eth1, plus on the loopback
7583 interface called 'lo'. The name you will need to use depends on what
7584 OS you are using, in the above I used the common name for Ethernet
7585 adapters on Linux.
7586 </p><p>
7587 If you use the above and someone tries to make a SMB connection to
7588 your host over a PPP interface called 'ppp0' then they will get a TCP
7589 connection refused reply. In that case no Samba code is run at all as
7590 the operating system has been told not to pass connections from that
7591 interface to any samba process.
7592 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2884122"></a>Using a firewall</h2></div></div><p>
7593 Many people use a firewall to deny access to services that they don't
7594 want exposed outside their network. This can be a very good idea,
7595 although I would recommend using it in conjunction with the above
7596 methods so that you are protected even if your firewall is not active
7597 for some reason.
7598 </p><p>
7599 If you are setting up a firewall then you need to know what TCP and
7600 UDP ports to allow and block. Samba uses the following:
7601 </p><pre class="programlisting">
7602         UDP/137    - used by nmbd
7603         UDP/138    - used by nmbd
7604         TCP/139    - used by smbd
7605         TCP/445    - used by smbd
7606 </pre><p>
7607 The last one is important as many older firewall setups may not be
7608 aware of it, given that this port was only added to the protocol in
7609 recent years. 
7610 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2884164"></a>Using a IPC$ share deny</h2></div></div><p>
7611 If the above methods are not suitable, then you could also place a
7612 more specific deny on the IPC$ share that is used in the recently
7613 discovered security hole. This allows you to offer access to other
7614 shares while denying access to IPC$ from potentially untrustworthy
7615 hosts.
7616 </p><p>
7617 To do that you could use:
7618 </p><pre class="programlisting">
7619         [ipc$]
7620              hosts allow = 192.168.115.0/24 127.0.0.1
7621              hosts deny = 0.0.0.0/0
7622 </pre><p>
7623 this would tell Samba that IPC$ connections are not allowed from
7624 anywhere but the two listed places (localhost and a local
7625 subnet). Connections to other shares would still be allowed. As the
7626 IPC$ share is the only share that is always accessible anonymously
7627 this provides some level of protection against attackers that do not
7628 know a username/password for your host.
7629 </p><p>
7630 If you use this method then clients will be given a 'access denied'
7631 reply when they try to access the IPC$ share. That means that those
7632 clients will not be able to browse shares, and may also be unable to
7633 access some other resources. 
7634 </p><p>
7635 This is not recommended unless you cannot use one of the other
7636 methods listed above for some reason.
7637 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2883724"></a>NTLMv2 Security</h2></div></div><p>
7638 To configure NTLMv2 authentication the following registry keys are worth knowing about:
7639 </p><p>
7640 </p><pre class="programlisting">
7641         [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
7642         &quot;lmcompatibilitylevel&quot;=dword:00000003
7643
7644         0x3 - Send NTLMv2 response only. Clients will use NTLMv2 authentication,
7645         use NTLMv2 session security if the server supports it. Domain
7646         controllers accept LM, NTLM and NTLMv2 authentication.
7647
7648         [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0]
7649         &quot;NtlmMinClientSec&quot;=dword:00080000
7650
7651         0x80000 - NTLMv2 session security. If either NtlmMinClientSec or
7652         NtlmMinServerSec is set to 0x80000, the connection will fail if NTLMv2
7653         session security is not negotiated.
7654 </pre><p>
7655 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2883760"></a>Upgrading Samba</h2></div></div><p>
7656 Please check regularly on <a href="http://www.samba.org/" target="_top">http://www.samba.org/</a> for updates and
7657 important announcements.  Occasionally security releases are made and 
7658 it is highly recommended to upgrade Samba when a security vulnerability
7659 is discovered.
7660 </p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="unicode"></a>Chapter 25. Unicode/Charsets</h2></div><div><div class="author"><h3 class="author">Jelmer R. Vernooij</h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">TAKAHASHI Motonobu</h3><div class="affiliation"><div class="address"><p><tt>&lt;<a href="mailto:monyo@home.monyo.com">monyo@home.monyo.com</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">25 March 2003</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2884358">What are charsets and unicode?</a></dt><dt><a href="#id2884428">Samba and charsets</a></dt><dt><a href="#id2884517">Conversion from old names</a></dt><dt><a href="#id2884562">Japanese charsets</a></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2884358"></a>What are charsets and unicode?</h2></div></div><p>
7661 Computers communicate in numbers. In texts, each number will be 
7662 translated to a corresponding letter. The meaning that will be assigned 
7663 to a certain number depends on the <span class="emphasis"><em>character set(charset)
7664 </em></span> that is used. 
7665 A charset can be seen as a table that is used to translate numbers to 
7666 letters. Not all computers use the same charset (there are charsets 
7667 with German umlauts, Japanese characters, etc). Usually a charset contains 
7668 256 characters, which means that storing a character with it takes 
7669 exactly one byte. </p><p>
7670 There are also charsets that support even more characters, 
7671 but those need twice(or even more) as much storage space. These 
7672 charsets can contain <b>256 * 256 = 65536</b> characters, which
7673 is more then all possible characters one could think of. They are called 
7674 multibyte charsets (because they use more then one byte to 
7675 store one character). 
7676 </p><p>
7677 A standardised multibyte charset is unicode, info is available at 
7678 <a href="http://www.unicode.org/" target="_top">www.unicode.org</a>. 
7679 A big advantage of using a multibyte charset is that you only need one; no 
7680 need to make sure two computers use the same charset when they are 
7681 communicating.
7682 </p><p>Old windows clients used to use single-byte charsets, named 
7683 'codepages' by microsoft. However, there is no support for 
7684 negotiating the charset to be used in the smb protocol. Thus, you 
7685 have to make sure you are using the same charset when talking to an old client.
7686 Newer clients (Windows NT, 2K, XP) talk unicode over the wire.
7687 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2884428"></a>Samba and charsets</h2></div></div><p>
7688 As of samba 3.0, samba can (and will) talk unicode over the wire. Internally, 
7689 samba knows of three kinds of character sets: 
7690 </p><div class="variablelist"><dl><dt><span class="term">unix charset</span></dt><dd><p>
7691                 This is the charset used internally by your operating system. 
7692                 The default is <tt>ASCII</tt>, which is fine for most 
7693                 systems.
7694                 </p></dd><dt><span class="term">display charset</span></dt><dd><p>This is the charset samba will use to print messages
7695                 on your screen. It should generally be the same as the <b>unix charset</b>.
7696                 </p></dd><dt><span class="term">dos charset</span></dt><dd><p>This is the charset samba uses when communicating with 
7697                 DOS and Windows 9x clients. It will talk unicode to all newer clients.
7698                 The default depends on the charsets you have installed on your system.
7699                 Run <b>testparm -v | grep &quot;dos charset&quot;</b> to see 
7700                 what the default is on your system. 
7701                 </p></dd></dl></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2884517"></a>Conversion from old names</h2></div></div><p>Because previous samba versions did not do any charset conversion, 
7702 characters in filenames are usually not correct in the unix charset but only 
7703 for the local charset used by the DOS/Windows clients.</p><p>The following script from Steve Langasek converts all 
7704 filenames from CP850 to the iso8859-15 charset.</p><p>
7705 <tt>#</tt><b><tt>find <i><tt>/path/to/share</tt></i> -type f -exec bash -c 'CP=&quot;{}&quot;; ISO=`echo -n &quot;$CP&quot; | iconv -f cp850 \
7706   -t iso8859-15`; if [ &quot;$CP&quot; != &quot;$ISO&quot; ]; then mv &quot;$CP&quot; &quot;$ISO&quot;; fi' \;
7707 </tt></b>
7708 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2884562"></a>Japanese charsets</h2></div></div><p>Samba doesn't work correctly with Japanese charsets yet. Here are
7709 points of attention when setting it up:</p><div class="itemizedlist"><ul type="disc"><li><p>You should set <b>mangling method =
7710 hash</b></p></li><li><p>There are various iconv() implementations around and not
7711 all of  them work equally well. glibc2's iconv() has a critical problem
7712 in CP932.  libiconv-1.8 works with CP932 but still has some problems and
7713 does not  work with EUC-JP.</p></li><li><p>You should set <b>dos charset = CP932</b>, not
7714 Shift_JIS, SJIS...</p></li><li><p>Currently only <b>unix charset = CP932</b>
7715 will work (but still has some problems...) because of iconv() issues.
7716 <b>unix charset = EUC-JP</b> doesn't work well because of
7717 iconv() issues.</p></li><li><p>Currently Samba 3.0 does not support <b>unix charset
7718 = UTF8-MAC/CAP/HEX/JIS*</b></p></li></ul></div><p>More information (in Japanese) is available at: <a href="http://www.atmarkit.co.jp/flinux/special/samba3/samba3a.html" target="_top">http://www.atmarkit.co.jp/flinux/special/samba3/samba3a.html</a>.</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="locking"></a>Chapter 26. File and Record Locking</h2></div><div><div class="author"><h3 class="author">Jeremy Allison</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jra@samba.org">jra@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Jelmer R. Vernooij</h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2884210">Discussion</a></dt><dt><a href="#id2884872">Samba Opportunistic Locking Control</a></dt><dt><a href="#id2884987">MS Windows Opportunistic Locking and Caching Controls</a></dt><dd><dl><dt><a href="#id2885212">Workstation Service Entries</a></dt><dt><a href="#id2885239">Server Service Entries</a></dt></dl></dd><dt><a href="#id2885320">Persistent Data Corruption</a></dt><dt><a href="#id2885350">Additional Reading</a></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2884210"></a>Discussion</h2></div></div><p>
7719 One area which sometimes causes trouble is locking.
7720 </p><p>
7721 There are two types of locking which need to be performed by a SMB server.
7722 The first is <span class="emphasis"><em>record locking</em></span> which allows a client to lock
7723 a range of bytes in a open file.  The second is the <span class="emphasis"><em>deny modes</em></span>
7724 that are specified when a file is open.
7725 </p><p>
7726 Record locking semantics under Unix is very different from record locking under
7727 Windows. Versions of Samba before 2.2 have tried to use the native fcntl() unix
7728 system call to implement proper record locking between different Samba clients.
7729 This can not be fully correct due to several reasons. The simplest is the fact
7730 that a Windows client is allowed to lock a byte range up to 2^32 or 2^64,
7731 depending on the client OS. The unix locking only supports byte ranges up to 2^31.
7732 So it is not possible to correctly satisfy a lock request above 2^31. There are
7733 many more differences, too many to be listed here.
7734 </p><p>
7735 Samba 2.2 and above implements record locking completely independent of the
7736 underlying unix system. If a byte range lock that the client requests happens
7737 to fall into the range 0-2^31, Samba hands this request down to the Unix system.
7738 All other locks can not be seen by unix anyway.
7739 </p><p>
7740 Strictly a SMB server should check for locks before every read and write call on
7741 a file. Unfortunately with the way fcntl() works this can be slow and may overstress
7742 the rpc.lockd. It is also almost always unnecessary as clients are supposed to
7743 independently make locking calls before reads and writes anyway if locking is
7744 important to them. By default Samba only makes locking calls when explicitly asked
7745 to by a client, but if you set <span class="emphasis"><em>strict locking = yes</em></span> then it
7746 will make lock checking calls on every read and write.
7747 </p><p>
7748 You can also disable by range locking completely using <span class="emphasis"><em>locking = no</em></span>.
7749 This is useful for those shares that don't support locking or don't need it
7750 (such as cdroms). In this case Samba fakes the return codes of locking calls to
7751 tell clients that everything is OK.
7752 </p><p>
7753 The second class of locking is the <span class="emphasis"><em>deny modes</em></span>. These 
7754 are set by an application when it opens a file to determine what types of
7755 access should be allowed simultaneously with its open. A client may ask for
7756 DENY_NONE, DENY_READ, DENY_WRITE or DENY_ALL. There are also special compatibility
7757 modes called DENY_FCB and  DENY_DOS.
7758 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2884872"></a>Samba Opportunistic Locking Control</h2></div></div><p>
7759 Opportunistic locking essentially means that the client is allowed to download and cache
7760 a file on their hard drive while making changes; if a second client wants to access the
7761 file, the first client receives a break and must synchronise the file back to the server.
7762 This can give significant performance gains in some cases; some programs insist on
7763 synchronising the contents of the entire file back to the server for a single change.
7764 </p><p>
7765 Level1 Oplocks (aka just plain &quot;oplocks&quot;) is another term for opportunistic locking.
7766 </p><p>
7767 Level2 Oplocks provids opportunistic locking for a file that will be treated as
7768 <span class="emphasis"><em>read only</em></span>. Typically this is used on files that are read-only or
7769 on files that the client has no initial intention to write to at time of opening the file.
7770 </p><p>
7771 Kernel Oplocks are essentially a method that allows the Linux kernel to co-exist with
7772 Samba's oplocked files, although this has provided better integration of MS Windows network
7773 file locking with the under lying OS, SGI IRIX and Linux are the only two OS's that are
7774 oplock aware at this time.
7775 </p><p>
7776 Unless your system supports kernel oplocks, you should disable oplocks if you are
7777 accessing the same files from both Unix/Linux and SMB clients. Regardless, oplocks should
7778 always be disabled if you are sharing a database file (e.g., Microsoft Access) between
7779 multiple clients, as any break the first client receives will affect synchronisation of
7780 the entire file (not just the single record), which will result in a noticable performance
7781 impairment and, more likely, problems accessing the database in the first place. Notably,
7782 Microsoft Outlook's personal folders (*.pst) react very badly to oplocks. If in doubt,
7783 disable oplocks and tune your system from that point.
7784 </p><p>
7785 If client-side caching is desirable and reliable on your network, you will benefit from
7786 turning on oplocks. If your network is slow and/or unreliable, or you are sharing your
7787 files among other file sharing mechanisms (e.g., NFS) or across a WAN, or multiple people
7788 will be accessing the same files frequently, you probably will not benefit from the overhead
7789 of your client sending oplock breaks and will instead want to disable oplocks for the share.
7790 </p><p>
7791 Another factor to consider is the perceived performance of file access. If oplocks provide no
7792 measurable speed benefit on your network, it might not be worth the hassle of dealing with them.
7793 </p><p>
7794 You can disable oplocks on a per-share basis with the following:
7795
7796 </p><pre class="programlisting">
7797         oplocks = False
7798         level2 oplocks = False
7799 </pre><p>
7800
7801 Alternately, you could disable oplocks on a per-file basis within the share:
7802
7803 </p><pre class="programlisting">
7804         veto oplock files = /*.mdb/*.MDB/*.dbf/*.DBF/
7805 </pre><p>
7806 </p><p>
7807 If you are experiencing problems with oplocks as apparent from Samba's log entries,
7808 you may want to play it safe and disable oplocks and level2 oplocks.
7809 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2884987"></a>MS Windows Opportunistic Locking and Caching Controls</h2></div></div><p>
7810 There is a known issue when running applications (like Norton Anti-Virus) on a Windows 2000/ XP
7811 workstation computer that can affect any application attempting to access shared database files
7812 across a network. This is a result of a default setting configured in the Windows 2000/XP
7813 operating system known as <span class="emphasis"><em>Opportunistic Locking</em></span>. When a workstation
7814 attempts to access shared data files located on another Windows 2000/XP computer,
7815 the Windows 2000/XP operating system will attempt to increase performance by locking the
7816 files and caching information locally. When this occurs, the application is unable to
7817 properly function, which results in an <span class="emphasis"><em>Access Denied</em></span>
7818  error message being displayed during network operations.
7819 </p><p>
7820 All Windows operating systems in the NT family that act as database servers for data files
7821 (meaning that data files are stored there and accessed by other Windows PCs) may need to
7822 have opportunistic locking disabled in order to minimize the risk of data file corruption.
7823 This includes Windows 9x/Me, Windows NT, Windows 200x and Windows XP.
7824 </p><p>
7825 If you are using a Windows NT family workstation in place of a server, you must also
7826 disable opportunistic locking (oplocks) on that workstation. For example, if you use a
7827 PC with the Windows NT Workstation operating system instead of Windows NT Server, and you
7828 have data files located on it that are accessed from other Windows PCs, you may need to
7829 disable oplocks on that system.
7830 </p><p>
7831 The major difference is the location in the Windows registry where the values for disabling
7832 oplocks are entered. Instead of the LanManServer location, the LanManWorkstation location
7833 may be used.
7834 </p><p>
7835 You can verify (or change or add, if necessary) this Registry value using the Windows
7836 Registry Editor. When you change this registry value, you will have to reboot the PC
7837 to ensure that the new setting goes into effect.
7838 </p><p>
7839 The location of the client registry entry for opportunistic locking has changed in
7840 Windows 2000 from the earlier location in Microsoft Windows NT.
7841 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
7842 Windows 2000 will still respect the EnableOplocks registry value used to disable oplocks
7843 in earlier versions of Windows.
7844 </p></div><p>
7845 You can also deny the granting of opportunistic locks by changing the following registry entries:
7846 </p><p>
7847 </p><pre class="programlisting">
7848         HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MRXSmb\Parameters\
7849
7850                 OplocksDisabled REG_DWORD 0 or 1
7851                 Default: 0 (not disabled)
7852 </pre><p>
7853 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
7854 The OplocksDisabled registry value configures Windows clients to either request or not
7855 request opportunistic locks on a remote file. To disable oplocks, the value of
7856  OplocksDisabled must be set to 1.
7857 </p></div><p>
7858 </p><pre class="programlisting">
7859         HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
7860
7861                 EnableOplocks REG_DWORD 0 or 1
7862                 Default: 1 (Enabled by Default)
7863
7864                 EnableOpLockForceClose REG_DWORD 0 or 1
7865                 Default: 0 (Disabled by Default)
7866 </pre><p>
7867 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
7868 The EnableOplocks value configures Windows-based servers (including Workstations sharing
7869 files) to allow or deny opportunistic locks on local files.
7870 </p></div><p>
7871 To force closure of open oplocks on close or program exit EnableOpLockForceClose must be set to 1.
7872 </p><p>
7873 An illustration of how level II oplocks work:
7874 </p><div class="itemizedlist"><ul type="disc"><li><p>
7875         Station 1 opens the file, requesting oplock.
7876         </p></li><li><p>
7877         Since no other station has the file open, the server grants station 1 exclusive oplock.
7878         </p></li><li><p>
7879         Station 2 opens the file, requesting oplock.
7880         </p></li><li><p>
7881         Since station 1 has not yet written to the file, the server asks station 1 to Break
7882         to Level II Oplock.
7883         </p></li><li><p>
7884         Station 1 complies by flushing locally buffered lock information to the server.
7885         </p></li><li><p>
7886         Station 1 informs the server that it has Broken to Level II Oplock (alternatively,
7887         station 1 could have closed the file).
7888         </p></li><li><p>
7889         The server responds to station 2's open request, granting it level II oplock.
7890         Other stations can likewise open the file and obtain level II oplock.
7891         </p></li><li><p>
7892         Station 2 (or any station that has the file open) sends a write request SMB.
7893         The server returns the write response.
7894         </p></li><li><p>
7895         The server asks all stations that have the file open to Break to None, meaning no
7896         station holds any oplock on the file. Because the workstations can have no cached
7897         writes or locks at this point, they need not respond to the break-to-none advisory;
7898         all they need do is invalidate locally cashed read-ahead data.
7899         </p></li></ul></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2885212"></a>Workstation Service Entries</h3></div></div><pre class="programlisting">
7900         \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters
7901
7902         UseOpportunisticLocking   REG_DWORD   0 or 1
7903         Default: 1 (true)
7904 </pre><p>
7905 Indicates whether the redirector should use opportunistic-locking (oplock) performance
7906 enhancement. This parameter should be disabled only to isolate problems.
7907 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2885239"></a>Server Service Entries</h3></div></div><pre class="programlisting">
7908         \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
7909
7910         EnableOplocks   REG_DWORD   0 or 1
7911         Default: 1 (true)
7912 </pre><p>
7913 Specifies whether the server allows clients to use oplocks on files. Oplocks are a
7914 significant performance enhancement, but have the potential to cause lost cached
7915 data on some networks, particularly wide-area networks.
7916 </p><pre class="programlisting">
7917         MinLinkThroughput   REG_DWORD   0 to infinite bytes per second
7918         Default: 0
7919 </pre><p>
7920 Specifies the minimum link throughput allowed by the server before it disables
7921 raw and opportunistic locks for this connection.
7922 </p><pre class="programlisting">
7923         MaxLinkDelay   REG_DWORD   0 to 100,000 seconds
7924         Default: 60
7925 </pre><p>
7926 Specifies the maximum time allowed for a link delay. If delays exceed this number,
7927 the server disables raw I/O and opportunistic locking for this connection.
7928 </p><pre class="programlisting">
7929         OplockBreakWait   REG_DWORD   10 to 180 seconds
7930         Default: 35
7931 </pre><p>
7932 Specifies the time that the server waits for a client to respond to an oplock break
7933 request. Smaller values can allow detection of crashed clients more quickly but can
7934 potentially cause loss of cached data.
7935 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2885320"></a>Persistent Data Corruption</h2></div></div><p>
7936 If you have applied all of the settings discussed in this paper but data corruption problems
7937 and other symptoms persist, here are some additional things to check out:
7938 </p><p>
7939 We have credible reports from developers that faulty network hardware, such as a single
7940 faulty network card, can cause symptoms similar to read caching and data corruption.
7941 If you see persistent data corruption even after repeated reindexing, you may have to
7942 rebuild the data files in question. This involves creating a new data file with the
7943 same definition as the file to be rebuilt and transferring the data from the old file
7944 to the new one. There are several known methods for doing this that can be found in
7945 our Knowledge Base.
7946 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2885350"></a>Additional Reading</h2></div></div><p>
7947 You may want to check for an updated version of this white paper on our Web site from
7948 time to time. Many of our white papers are updated as information changes. For those papers,
7949 the Last Edited date is always at the top of the paper.
7950 </p><p>
7951 Section of the Microsoft MSDN Library on opportunistic locking: 
7952 </p><p>
7953 Opportunistic Locks, Microsoft Developer Network (MSDN), Windows Development &gt;
7954 Windows Base Services &gt; Files and I/O &gt; SDK Documentation &gt; File Storage &gt; File Systems
7955 &gt; About File Systems &gt; Opportunistic Locks, Microsoft Corporation.
7956 <a href="http://msdn.microsoft.com/library/en-us/fileio/storage_5yk3.asp" target="_top">http://msdn.microsoft.com/library/en-us/fileio/storage_5yk3.asp</a>
7957 </p><p>
7958 Microsoft Knowledge Base Article Q224992 &quot;Maintaining Transactional Integrity with OPLOCKS&quot;,
7959 Microsoft Corporation, April 1999, <a href="=http://support.microsoft.com/default.aspx?scid=kb;en-us;Q224992" target="_top">http://support.microsoft.com/default.aspx?scid=kb;en-us;Q224992</a>.
7960 </p><p>
7961 Microsoft Knowledge Base Article Q296264 &quot;Configuring Opportunistic Locking in Windows 2000&quot;,
7962 Microsoft Corporation, April 2001, <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q296264" target="_top">http://support.microsoft.com/default.aspx?scid=kb;en-us;Q296264</a>.
7963 </p><p>
7964 Microsoft Knowledge Base Article Q129202 &quot;PC Ext: Explanation of Opportunistic Locking on Windows NT&quot;,
7965  Microsoft Corporation, April 1995, <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q129202" target="_top">http://support.microsoft.com/default.aspx?scid=kb;en-us;Q129202</a>.
7966 </p></div></div></div><div class="part" lang="en"><div class="titlepage"><div><h1 class="title"><a name="troubleshooting"></a>Troubleshooting</h1></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>27. <a href="#diagnosis">The samba checklist</a></dt><dd><dl><dt><a href="#id2884776">Introduction</a></dt><dt><a href="#id2884810">Assumptions</a></dt><dt><a href="#id2793401">The tests</a></dt><dt><a href="#id2886854">Still having troubles?</a></dt></dl></dd><dt>28. <a href="#problems">Analysing and solving samba problems</a></dt><dd><dl><dt><a href="#id2790687">Diagnostics tools</a></dt><dt><a href="#id2887096">Installing 'Network Monitor' on an NT Workstation or a Windows 9x box</a></dt><dt><a href="#id2887237">Useful URL's</a></dt><dt><a href="#id2887343">Getting help from the mailing lists</a></dt><dt><a href="#id2887497">How to get off the mailinglists</a></dt></dl></dd><dt>29. <a href="#bugreport">Reporting Bugs</a></dt><dd><dl><dt><a href="#id2887016">Introduction</a></dt><dt><a href="#id2886937">General info</a></dt><dt><a href="#id2887713">Debug levels</a></dt><dt><a href="#id2887849">Internal errors</a></dt><dt><a href="#id2887942">Attaching to a running process</a></dt><dt><a href="#id2887989">Patches</a></dt></dl></dd></dl></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="diagnosis"></a>Chapter 27. The samba checklist</h2></div><div><div class="author"><h3 class="author">Andrew Tridgell</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:tridge@samba.org">tridge@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Jelmer R. Vernooij</h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">Wed Jan 15</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2884776">Introduction</a></dt><dt><a href="#id2884810">Assumptions</a></dt><dt><a href="#id2793401">The tests</a></dt><dt><a href="#id2886854">Still having troubles?</a></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2884776"></a>Introduction</h2></div></div><p>
7967 This file contains a list of tests you can perform to validate your
7968 Samba server. It also tells you what the likely cause of the problem
7969 is if it fails any one of these steps. If it passes all these tests
7970 then it is probably working fine.
7971 </p><p>
7972 You should do ALL the tests, in the order shown. We have tried to
7973 carefully choose them so later tests only use capabilities verified in
7974 the earlier tests.  However, do not stop at the first error as there
7975 have been some instances when continuing with the tests has helped
7976 to solve a problem.
7977 </p><p>
7978 If you send one of the samba mailing lists  an email saying &quot;it doesn't work&quot;
7979 and you have not followed this test procedure then you should not be surprised
7980 if your email is ignored.
7981 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2884810"></a>Assumptions</h2></div></div><p>
7982 In all of the tests it is assumed you have a Samba server called 
7983 BIGSERVER and a PC called ACLIENT both in workgroup TESTGROUP.
7984 </p><p>
7985 The procedure is similar for other types of clients.
7986 </p><p>
7987 It is also assumed you know the name of an available share in your
7988 <tt>smb.conf</tt>. I will assume this share is called <i><tt>tmp</tt></i>.
7989 You can add a <i><tt>tmp</tt></i> share like this by adding the
7990 following to <tt>smb.conf</tt>:
7991 </p><pre class="programlisting">
7992
7993 [tmp]
7994  comment = temporary files 
7995  path = /tmp
7996  read only = yes
7997
7998 </pre><p>
7999 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
8000 These tests assume version 3.0 or later of the samba suite.
8001 Some commands shown did not exist in earlier versions. 
8002 </p></div><p>
8003 Please pay attention to the error messages you receive. If any error message
8004 reports that your server is being unfriendly you should first check that your
8005 IP name resolution is correctly set up. eg: Make sure your <tt>/etc/resolv.conf</tt>
8006 file points to name servers that really do exist.
8007 </p><p>
8008 Also, if you do not have DNS server access for name resolution please check
8009 that the settings for your <tt>smb.conf</tt> file results in <b>dns proxy = no</b>. The
8010 best way to check this is with <b><tt>testparm smb.conf</tt></b>.
8011 </p><p>
8012 It is helpful to monitor the log files during testing by using the
8013 <b>tail -F <i><tt>log_file_name</tt></i></b> in a separate
8014 terminal console (use ctrl-alt-F1 through F6 or multiple terminals in X). 
8015 Relevant log files can be found (for default installations) in
8016 <tt>/usr/local/samba/var</tt>.  Also, connection logs from
8017 machines can be found here or possibly in <tt>/var/log/samba</tt>
8018 depending on how or if you specified logging in your <tt>smb.conf</tt> file.
8019 </p><p>
8020 If you make changes to your <tt>smb.conf</tt> file while going through these test,
8021 don't forget to restart smbd and nmbd.
8022 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2793401"></a>The tests</h2></div></div><div class="procedure"><p class="title"><b>Procedure 27.1. Diagnosing your samba server</b></p><ol type="1"><li><p>
8023 In the directory in which you store your <tt>smb.conf</tt> file, run the command
8024 <b><tt>testparm smb.conf</tt></b>. If it reports any errors then your <tt>smb.conf</tt>
8025 configuration file is faulty.
8026 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
8027 Your <tt>smb.conf</tt> file may be located in: <tt>/etc/samba</tt>
8028 Or in:   <tt>/usr/local/samba/lib</tt>
8029 </p></div></li><li><p>
8030 Run the command <b><tt>ping BIGSERVER</tt></b> from the PC and 
8031 <b><tt>ping ACLIENT</tt></b> from
8032 the unix box. If you don't get a valid response then your TCP/IP
8033 software is not correctly installed. 
8034 </p><p>
8035 Note that you will need to start a &quot;dos prompt&quot; window on the PC to
8036 run ping.
8037 </p><p>
8038 If you get a message saying &quot;host not found&quot; or similar then your DNS
8039 software or <tt>/etc/hosts</tt> file is not correctly setup.
8040 It is possible to
8041 run samba without DNS entries for the server and client, but I assume
8042 you do have correct entries for the remainder of these tests. 
8043 </p><p>
8044 Another reason why ping might fail is if your host is running firewall 
8045 software. You will need to relax the rules to let in the workstation
8046 in question, perhaps by allowing access from another subnet (on Linux
8047 this is done via the ipfwadm program.)
8048 </p><p>
8049 Note: Modern Linux distributions install ipchains/iptables by default. 
8050 This is a common problem that is often overlooked.
8051 </p></li><li><p>
8052 Run the command <b><tt>smbclient -L BIGSERVER</tt></b> on the unix box. You
8053 should get a list of available shares back. 
8054 </p><p>
8055 If you get a error message containing the string &quot;Bad password&quot; then
8056 you probably have either an incorrect <b>hosts allow</b>, 
8057 <b>hosts deny</b> or <b>valid users</b> line in your 
8058 <tt>smb.conf</tt>, or your guest account is not
8059 valid. Check what your guest account is using testparm and
8060 temporarily remove any <b>hosts allow</b>, <b>hosts deny</b>, <b>valid users</b> or <b>invalid users</b> lines.
8061 </p><p>
8062 If you get a &quot;connection refused&quot; response then the smbd server may
8063 not be running. If you installed it in inetd.conf then you probably edited
8064 that file incorrectly. If you installed it as a daemon then check that
8065 it is running, and check that the netbios-ssn port is in a LISTEN
8066 state using <b><tt>netstat -a</tt></b>.
8067 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
8068 Some Unix / Linux systems use <b>xinetd</b> in place of
8069 <b>inetd</b>. Check your system documentation for the location
8070 of the control file/s for your particular system implementation of
8071 this network super daemon.
8072 </p></div><p>
8073 If you get a &quot;session request failed&quot; then the server refused the
8074 connection. If it says &quot;Your server software is being unfriendly&quot; then
8075 its probably because you have invalid command line parameters to smbd,
8076 or a similar fatal problem with the initial startup of smbd. Also
8077 check your config file (<tt>smb.conf</tt>) for syntax errors with testparm
8078 and that the various directories where samba keeps its log and lock
8079 files exist.
8080 </p><p>
8081 There are a number of reasons for which smbd may refuse or decline
8082 a session request. The most common of these involve one or more of
8083 the following <tt>smb.conf</tt> file entries:
8084 </p><pre class="programlisting">
8085         hosts deny = ALL
8086         hosts allow = xxx.xxx.xxx.xxx/yy
8087         bind interfaces only = Yes
8088 </pre><p>
8089 In the above, no allowance has been made for any session requests that
8090 will automatically translate to the loopback adaptor address 127.0.0.1.
8091 To solve this problem change these lines to:
8092 </p><pre class="programlisting">
8093         hosts deny = ALL
8094         hosts allow = xxx.xxx.xxx.xxx/yy 127.
8095 </pre><p>
8096 Do NOT use the <b>bind interfaces only</b> parameter where you 
8097 may wish to
8098 use the samba password change facility, or where smbclient may need to
8099 access a local service for name resolution or for local resource
8100 connections. (Note: the <b>bind interfaces only</b> parameter deficiency
8101 where it will not allow connections to the loopback address will be
8102 fixed soon).
8103 </p><p>
8104 Another common cause of these two errors is having something already running 
8105 on port 139, such as Samba (ie: smbd is running from inetd already) or
8106 something like Digital's Pathworks. Check your <tt>inetd.conf</tt> file before trying
8107 to start smbd as a daemon, it can avoid a lot of frustration!
8108 </p><p>
8109 And yet another possible cause for failure of this test is when the subnet mask
8110 and / or broadcast address settings are incorrect. Please check that the
8111 network interface IP Address / Broadcast Address / Subnet Mask settings are
8112 correct and that Samba has correctly noted these in the <tt>log.nmb</tt> file.
8113 </p></li><li><p>
8114 Run the command <b><tt>nmblookup -B BIGSERVER __SAMBA__</tt></b>. You should get the
8115 IP address of your Samba server back.
8116 </p><p>
8117 If you don't then nmbd is incorrectly installed. Check your <tt>inetd.conf</tt>
8118 if you run it from there, or that the daemon is running and listening
8119 to udp port 137.
8120 </p><p>
8121 One common problem is that many inetd implementations can't take many
8122 parameters on the command line. If this is the case then create a
8123 one-line script that contains the right parameters and run that from
8124 inetd.
8125 </p></li><li><p>run the command <b><tt>nmblookup -B ACLIENT '*'</tt></b></p><p>
8126 You should get the PCs IP address back. If you don't then the client
8127 software on the PC isn't installed correctly, or isn't started, or you
8128 got the name of the PC wrong. 
8129 </p><p>
8130 If ACLIENT doesn't resolve via DNS then use the IP address of the
8131 client in the above test.
8132 </p></li><li><p>
8133 Run the command <b><tt>nmblookup -d 2 '*'</tt></b>
8134 </p><p>
8135 This time we are trying the same as the previous test but are trying
8136 it via a broadcast to the default broadcast address. A number of
8137 Netbios/TCPIP hosts on the network should respond, although Samba may
8138 not catch all of the responses in the short time it listens. You
8139 should see &quot;got a positive name query response&quot; messages from several
8140 hosts.
8141 </p><p>
8142 If this doesn't give a similar result to the previous test then
8143 nmblookup isn't correctly getting your broadcast address through its
8144 automatic mechanism. In this case you should experiment with the
8145 <b>interfaces</b> option in <tt>smb.conf</tt> to manually configure your IP
8146 address, broadcast and netmask. 
8147 </p><p>
8148 If your PC and server aren't on the same subnet then you will need to
8149 use the <i><tt>-B</tt></i> option to set the broadcast address to that of the PCs
8150 subnet.
8151 </p><p>
8152 This test will probably fail if your subnet mask and broadcast address are
8153 not correct. (Refer to TEST 3 notes above).
8154 </p></li><li><p>
8155 Run the command <b><tt>smbclient //BIGSERVER/TMP</tt></b>. You should 
8156 then be prompted for a password. You should use the password of the account
8157 you are logged into the unix box with. If you want to test with
8158 another account then add the <i><tt>-U <i><tt>accountname</tt></i></tt></i> option to the end of
8159 the command line.  eg: 
8160 <b><tt>smbclient //bigserver/tmp -Ujohndoe</tt></b>
8161 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
8162 It is possible to specify the password along with the username
8163 as follows:
8164 <b><tt>smbclient //bigserver/tmp -Ujohndoe%secret</tt></b>
8165 </p></div><p>
8166 Once you enter the password you should get the <tt>smb&gt;</tt> prompt. If you
8167 don't then look at the error message. If it says &quot;invalid network
8168 name&quot; then the service &quot;tmp&quot; is not correctly setup in your <tt>smb.conf</tt>.
8169 </p><p>
8170 If it says &quot;bad password&quot; then the likely causes are:
8171 </p><div class="orderedlist"><ol type="1"><li><p>
8172         you have shadow passords (or some other password system) but didn't
8173         compile in support for them in smbd
8174         </p></li><li><p>
8175         your <b>valid users</b> configuration is incorrect
8176         </p></li><li><p>
8177         you have a mixed case password and you haven't enabled the <b>password
8178         level</b> option at a high enough level
8179         </p></li><li><p>
8180         the <b>path =</b> line in <tt>smb.conf</tt> is incorrect. Check it with testparm
8181         </p></li><li><p>
8182         you enabled password encryption but didn't create the SMB encrypted
8183         password file
8184         </p></li></ol></div><p>
8185 Once connected you should be able to use the commands 
8186 <b>dir</b> <b>get</b> <b>put</b> etc. 
8187 Type <b>help <i><tt>command</tt></i></b> for instructions. You should
8188 especially check that the amount of free disk space shown is correct
8189 when you type <b>dir</b>.
8190 </p></li><li><p>
8191 On the PC, type the command <b><tt>net view \\BIGSERVER</tt></b>. You will 
8192 need to do this from within a &quot;dos prompt&quot; window. You should get back a 
8193 list of available shares on the server.
8194 </p><p>
8195 If you get a &quot;network name not found&quot; or similar error then netbios
8196 name resolution is not working. This is usually caused by a problem in
8197 nmbd. To overcome it you could do one of the following (you only need
8198 to choose one of them):
8199 </p><div class="orderedlist"><ol type="1"><li><p>
8200         fixup the nmbd installation
8201 </p></li><li><p>
8202         add the IP address of BIGSERVER to the <b>wins server</b> box in the
8203         advanced tcp/ip setup on the PC.
8204 </p></li><li><p>
8205         enable windows name resolution via DNS in the advanced section of
8206         the tcp/ip setup
8207 </p></li><li><p>
8208         add BIGSERVER to your lmhosts file on the PC.
8209 </p></li></ol></div><p>
8210 If you get a &quot;invalid network name&quot; or &quot;bad password error&quot; then the
8211 same fixes apply as they did for the <b><tt>smbclient -L</tt></b> test above. In
8212 particular, make sure your <b>hosts allow</b> line is correct (see the man
8213 pages)
8214 </p><p>
8215 Also, do not overlook that fact that when the workstation requests the
8216 connection to the samba server it will attempt to connect using the 
8217 name with which you logged onto your Windows machine. You need to make
8218 sure that an account exists on your Samba server with that exact same
8219 name and password.
8220 </p><p>
8221 If you get &quot;specified computer is not receiving requests&quot; or similar
8222 it probably means that the host is not contactable via tcp services.
8223 Check to see if the host is running tcp wrappers, and if so add an entry in
8224 the <tt>hosts.allow</tt> file for your client (or subnet, etc.)
8225 </p></li><li><p>
8226 Run the command <b><tt>net use x: \\BIGSERVER\TMP</tt></b>. You should 
8227 be prompted for a password then you should get a &quot;command completed 
8228 successfully&quot; message. If not then your PC software is incorrectly 
8229 installed or your smb.conf is incorrect. make sure your <b>hosts allow</b>
8230 and other config lines in <tt>smb.conf</tt> are correct.
8231 </p><p>
8232 It's also possible that the server can't work out what user name to
8233 connect you as. To see if this is the problem add the line <b>user =
8234 <i><tt>username</tt></i></b> to the <b>[tmp]</b> section of 
8235 <tt>smb.conf</tt> where <i><tt>username</tt></i> is the
8236 username corresponding to the password you typed. If you find this
8237 fixes things you may need the username mapping option. 
8238 </p><p>
8239 It might also be the case that your client only sends encrypted passwords 
8240 and you have <b>encrypt passwords = no</b> in <tt>smb.conf</tt>
8241 Turn it back on to fix.
8242 </p></li><li><p>
8243 Run the command <b><tt>nmblookup -M <i><tt>testgroup</tt></i></tt></b> where 
8244 <i><tt>testgroup</tt></i> is the name of the workgroup that your Samba server and 
8245 Windows PCs belong to. You should get back the IP address of the 
8246 master browser for that workgroup.
8247 </p><p>
8248 If you don't then the election process has failed. Wait a minute to
8249 see if it is just being slow then try again. If it still fails after
8250 that then look at the browsing options you have set in <tt>smb.conf</tt>. Make
8251 sure you have <b>preferred master = yes</b> to ensure that 
8252 an election is held at startup.
8253 </p></li><li><p>
8254 &gt;From file manager try to browse the server. Your samba server should
8255 appear in the browse list of your local workgroup (or the one you
8256 specified in smb.conf). You should be able to double click on the name
8257 of the server and get a list of shares. If you get a &quot;invalid
8258 password&quot; error when you do then you are probably running WinNT and it
8259 is refusing to browse a server that has no encrypted password
8260 capability and is in user level security mode. In this case either set
8261 <b>security = server</b> AND 
8262 <b>password server = Windows_NT_Machine</b> in your
8263 <tt>smb.conf</tt> file, or make sure <b>encrypted passwords</b> is
8264 set to &quot;yes&quot;.
8265 </p></li></ol></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2886854"></a>Still having troubles?</h2></div></div><p>Read the chapter on 
8266 <a href="#problems" title="Chapter 28. Analysing and solving samba problems">Analysing and Solving Problems</a>.
8267 </p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="problems"></a>Chapter 28. Analysing and solving samba problems</h2></div><div><div class="author"><h3 class="author">Gerald (Jerry) Carter</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jerry@samba.org">jerry@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Jelmer R. Vernooij</h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">David Bannon</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:dbannon@samba.org">dbannon@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">8 Apr 2003</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2790687">Diagnostics tools</a></dt><dt><a href="#id2887096">Installing 'Network Monitor' on an NT Workstation or a Windows 9x box</a></dt><dt><a href="#id2887237">Useful URL's</a></dt><dt><a href="#id2887343">Getting help from the mailing lists</a></dt><dt><a href="#id2887497">How to get off the mailinglists</a></dt></dl></div><p>
8268 There are many sources of information available in the form 
8269 of mailing lists, RFC's and documentation.  The docs that come 
8270 with the samba distribution contain very good explanations of 
8271 general SMB topics such as browsing.</p><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2790687"></a>Diagnostics tools</h2></div></div><p>
8272 One of the best diagnostic tools for debugging problems is Samba itself.  
8273 You can use the -d option for both smbd and nmbd to specify what 
8274 'debug level' at which to run.  See the man pages on smbd, nmbd  and 
8275 smb.conf for more information on debugging options.  The debug 
8276 level can range from 1 (the default) to 10 (100 for debugging passwords).
8277 </p><p>
8278 Another helpful method of debugging is to compile samba using the 
8279 <b>gcc -g </b> flag.   This will include debug 
8280 information in the binaries and allow you to attach gdb to the 
8281 running smbd / nmbd process.  In order to attach gdb to an smbd 
8282 process for an NT workstation, first get the workstation to make the 
8283 connection. Pressing ctrl-alt-delete and going down to the domain box 
8284 is sufficient (at least, on the first time you join the domain) to 
8285 generate a 'LsaEnumTrustedDomains'. Thereafter, the workstation 
8286 maintains an open connection, and therefore there will be an smbd 
8287 process running (assuming that you haven't set a really short smbd 
8288 idle timeout)  So, in between pressing ctrl alt delete, and actually 
8289 typing in your password, you can attach gdb and continue.
8290 </p><p>
8291 Some useful samba commands worth investigating:
8292 </p><div class="itemizedlist"><ul type="disc"><li><p>testparam | more</p></li><li><p>smbclient -L //{netbios name of server}</p></li></ul></div><p>
8293 An SMB enabled version of tcpdump is available from 
8294 <a href="http://www.tcpdump.org/" target="_top">http://www.tcpdup.org/</a>.
8295 Ethereal, another good packet sniffer for Unix and Win32
8296 hosts, can be downloaded from <a href="http://www.ethereal.com/" target="_top">http://www.ethereal.com</a>.
8297 </p><p>
8298 For tracing things on the Microsoft Windows NT, Network Monitor 
8299 (aka. netmon) is available on the Microsoft Developer Network CD's, 
8300 the Windows NT Server install CD and the SMS CD's.  The version of 
8301 netmon that ships with SMS allows for dumping packets between any two 
8302 computers (i.e. placing the network interface in promiscuous mode).  
8303 The version on the NT Server install CD will only allow monitoring 
8304 of network traffic directed to the local NT box and broadcasts on the 
8305 local subnet.  Be aware that Ethereal can read and write netmon 
8306 formatted files.
8307 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2887096"></a>Installing 'Network Monitor' on an NT Workstation or a Windows 9x box</h2></div></div><p>
8308 Installing netmon on an NT workstation requires a couple 
8309 of steps.  The following are for installing Netmon V4.00.349, which comes 
8310 with Microsoft Windows NT Server 4.0, on Microsoft Windows NT 
8311 Workstation 4.0.  The process should be similar for other versions of 
8312 Windows NT / Netmon.  You will need both the Microsoft Windows 
8313 NT Server 4.0 Install CD and the Workstation 4.0 Install CD.
8314 </p><p>
8315 Initially you will need to install 'Network Monitor Tools and Agent' 
8316 on the NT Server.  To do this 
8317 </p><div class="itemizedlist"><ul type="disc"><li><p>Goto Start - Settings - Control Panel - 
8318         Network - Services - Add </p></li><li><p>Select the 'Network Monitor Tools and Agent' and 
8319         click on 'OK'.</p></li><li><p>Click 'OK' on the Network Control Panel.
8320         </p></li><li><p>Insert the Windows NT Server 4.0 install CD 
8321         when prompted.</p></li></ul></div><p>
8322 At this point the Netmon files should exist in 
8323 <tt>%SYSTEMROOT%\System32\netmon\*.*</tt>.    
8324 Two subdirectories exist as well, <tt>parsers\</tt> 
8325 which contains the necessary DLL's for parsing the netmon packet 
8326 dump, and <tt>captures\</tt>.
8327 </p><p>
8328 In order to install the Netmon tools on an NT Workstation, you will 
8329 first need to install the 'Network  Monitor Agent' from the Workstation 
8330 install CD.
8331 </p><div class="itemizedlist"><ul type="disc"><li><p>Goto Start - Settings - Control Panel - 
8332         Network - Services - Add</p></li><li><p>Select the 'Network Monitor Agent' and click 
8333         on 'OK'.</p></li><li><p>Click 'OK' on the Network Control Panel.
8334         </p></li><li><p>Insert the Windows NT Workstation 4.0 install 
8335         CD when prompted.</p></li></ul></div><p>
8336 Now copy the files from the NT Server in %SYSTEMROOT%\System32\netmon\*.* 
8337 to %SYSTEMROOT%\System32\netmon\*.* on the Workstation and set 
8338 permissions as  you deem appropriate for your site. You will need 
8339 administrative rights on the NT box to run netmon.
8340 </p><p>
8341 To install Netmon on a Windows 9x box install the network monitor agent 
8342 from the Windows 9x CD (\admin\nettools\netmon).  There is a readme 
8343 file located with the netmon driver files on the CD if you need 
8344 information on how to do this.  Copy the files from a working 
8345 Netmon installation.
8346 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2887237"></a>Useful URL's</h2></div></div><div class="itemizedlist"><ul type="disc"><li><p>Home of Samba site <a href="http://samba.org" target="_top">
8347       http://samba.org</a>. We have a mirror near you !</p></li><li><p> The <span class="emphasis"><em>Development</em></span> document 
8348 on the Samba mirrors might mention your problem. If so,
8349 it might mean that the developers are working on it.</p></li><li><p>See how Scott Merrill simulates a BDC behavior at 
8350        <a href="http://www.skippy.net/linux/smb-howto.html" target="_top">
8351        http://www.skippy.net/linux/smb-howto.html</a>. </p></li><li><p>Although 2.0.7 has almost had its day as a PDC, David Bannon will
8352        keep the 2.0.7 PDC pages at <a href="http://bioserve.latrobe.edu.au/samba" target="_top">
8353        http://bioserve.latrobe.edu.au/samba</a> going for a while yet.</p></li><li><p>Misc links to CIFS information 
8354        <a href="http://samba.org/cifs/" target="_top">http://samba.org/cifs/</a></p></li><li><p>NT Domains for Unix <a href="http://mailhost.cb1.com/~lkcl/ntdom/" target="_top">
8355        http://mailhost.cb1.com/~lkcl/ntdom/</a></p></li><li><p>FTP site for older SMB specs: 
8356        <a href="ftp://ftp.microsoft.com/developr/drg/CIFS/" target="_top">
8357        ftp://ftp.microsoft.com/developr/drg/CIFS/</a></p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2887343"></a>Getting help from the mailing lists</h2></div></div><p>
8358 There are a number of Samba related mailing lists. Go to <a href="http://samba.org" target="_top">http://samba.org</a>, click on your nearest mirror
8359 and then click on <b>Support</b> and then click on <b>
8360 Samba related mailing lists</b>.
8361 </p><p>
8362 For questions relating to Samba TNG go to
8363 <a href="http://www.samba-tng.org/" target="_top">http://www.samba-tng.org/</a> 
8364 It has been requested that you don't post questions about Samba-TNG to the
8365 main stream Samba lists.</p><p>
8366 If you post a message to one of the lists please observe the following guide lines :
8367 </p><div class="itemizedlist"><ul type="disc"><li><p> Always remember that the developers are volunteers, they are 
8368 not paid and they never guarantee to produce a particular feature at 
8369 a particular time. Any time lines are 'best guess' and nothing more.
8370 </p></li><li><p> Always mention what version of samba you are using and what 
8371 operating system its running under. You should probably list the
8372 relevant sections of your <tt>smb.conf</tt> file, at least the options 
8373 in [global] that affect PDC support.</p></li><li><p>In addition to the version, if you obtained Samba via
8374 CVS mention the date when you last checked it out.</p></li><li><p> Try and make your question clear and brief, lots of long, 
8375 convoluted questions get deleted before they are completely read ! 
8376 Don't post html encoded messages (if you can select colour or font 
8377 size its html).</p></li><li><p> If you run one of those nifty 'I'm on holidays' things when 
8378 you are away, make sure its configured  to not answer mailing lists.
8379 </p></li><li><p> Don't cross post. Work out which is the best list to post to 
8380 and see what happens, i.e. don't post to both samba-ntdom and samba-technical.
8381 Many people active on the lists subscribe to more 
8382 than one list and get annoyed to see the same message two or more times. 
8383 Often someone will see a message and thinking it would be better dealt 
8384 with on another, will forward it on for you.</p></li><li><p>You might include <span class="emphasis"><em>partial</em></span>
8385 log files written at a debug level set to as much as 20.  
8386 Please don't send the entire log but enough to give the context of the 
8387 error messages.</p></li><li><p>(Possibly) If you have a complete netmon trace ( from the opening of 
8388 the pipe to the error ) you can send the *.CAP file as well.</p></li><li><p>Please think carefully before attaching a document to an email.
8389 Consider pasting the relevant parts into the body of the message. The samba
8390 mailing lists go to a huge number of people, do they all need a copy of your 
8391 smb.conf in their attach directory?</p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2887497"></a>How to get off the mailinglists</h2></div></div><p>To have your name removed from a samba mailing list, go to the
8392 same place you went to to get on it. Go to <a href="http://lists.samba.org/" target="_top">http://lists.samba.org</a>, 
8393 click on your nearest mirror and then click on <b>Support</b> and 
8394 then click on <b> Samba related mailing lists</b>. Or perhaps see 
8395 <a href="http://lists.samba.org/mailman/roster/samba-ntdom" target="_top">here</a>
8396 </p><p>
8397 Please don't post messages to the list asking to be removed, you will just
8398 be referred to the above address (unless that process failed in some way...)
8399 </p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="bugreport"></a>Chapter 29. Reporting Bugs</h2></div><div><div class="author"><h3 class="author">Jelmer R. Vernooij</h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author"></h3><div class="affiliation"><span class="orgname">Samba Team<br></span></div></div></div><div><p class="pubdate"> 27 June 1997 </p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2887016">Introduction</a></dt><dt><a href="#id2886937">General info</a></dt><dt><a href="#id2887713">Debug levels</a></dt><dt><a href="#id2887849">Internal errors</a></dt><dt><a href="#id2887942">Attaching to a running process</a></dt><dt><a href="#id2887989">Patches</a></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2887016"></a>Introduction</h2></div></div><p>Please report bugs using <a href="https://bugzilla.samba.org/" target="_top">bugzilla</a>.</p><p>
8400 Please take the time to read this file before you submit a bug
8401 report. Also, please see if it has changed between releases, as we
8402 may be changing the bug reporting mechanism at some time.
8403 </p><p>
8404 Please also do as much as you can yourself to help track down the
8405 bug. Samba is maintained by a dedicated group of people who volunteer
8406 their time, skills and efforts. We receive far more mail about it than
8407 we can possibly answer, so you have a much higher chance of an answer
8408 and a fix if you send us a &quot;developer friendly&quot; bug report that lets
8409 us fix it fast. 
8410 </p><p>
8411 Do not assume that if you post the bug to the comp.protocols.smb
8412 newsgroup or the mailing list that we will read it. If you suspect that your 
8413 problem is not a bug but a configuration problem then it is better to send 
8414 it to the Samba mailing list, as there are (at last count) 5000 other users on
8415 that list that may be able to help you.
8416 </p><p>
8417 You may also like to look though the recent mailing list archives,
8418 which are conveniently accessible on the Samba web pages
8419 at <a href="http://samba.org/samba/" target="_top">http://samba.org/samba/</a>.
8420 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2886937"></a>General info</h2></div></div><p>
8421 Before submitting a bug report check your config for silly
8422 errors. Look in your log files for obvious messages that tell you that
8423 you've misconfigured something and run testparm to test your config
8424 file for correct syntax.
8425 </p><p>
8426 Have you run through the <a href="#diagnosis" title="Chapter 27. The samba checklist">diagnosis</a>? 
8427 This is very important.
8428 </p><p>
8429 If you include part of a log file with your bug report then be sure to
8430 annotate it with exactly what you were doing on the client at the
8431 time, and exactly what the results were.
8432 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2887713"></a>Debug levels</h2></div></div><p>
8433 If the bug has anything to do with Samba behaving incorrectly as a
8434 server (like refusing to open a file) then the log files will probably
8435 be very useful. Depending on the problem a log level of between 3 and
8436 10 showing the problem may be appropriate. A higher level givesmore
8437 detail, but may use too much disk space.
8438 </p><p>
8439 To set the debug level use <b>log level =</b> in your 
8440 <tt>smb.conf</tt>. You may also find it useful to set the log 
8441 level higher for just one machine and keep separate logs for each machine. 
8442 To do this use:
8443 </p><pre class="programlisting">
8444 log level = 10
8445 log file = /usr/local/samba/lib/log.%m
8446 include = /usr/local/samba/lib/smb.conf.%m
8447 </pre><p>
8448 then create a file 
8449 <tt>/usr/local/samba/lib/smb.conf.<i><tt>machine</tt></i></tt> where
8450 <i><tt>machine</tt></i> is the name of the client you wish to debug. In that file
8451 put any <tt>smb.conf</tt> commands you want, for example 
8452 <b>log level=</b> may be useful. This also allows you to 
8453 experiment with different security systems, protocol levels etc on just 
8454 one machine.
8455 </p><p>
8456 The <tt>smb.conf</tt> entry <b>log level =</b> 
8457 is synonymous with the entry <b>debuglevel =</b> that has been 
8458 used in older versions of Samba and is being retained for backwards 
8459 compatibility of <tt>smb.conf</tt> files.
8460 </p><p>
8461 As the <b>log level =</b> value is increased you will record 
8462 a significantly increasing level of debugging information. For most 
8463 debugging operations you may not need a setting higher than 3. Nearly 
8464 all bugs can be tracked at a setting of 10, but be prepared for a VERY 
8465 large volume of log data.
8466 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2887849"></a>Internal errors</h2></div></div><p>
8467 If you get a &quot;INTERNAL ERROR&quot; message in your log files it means that
8468 Samba got an unexpected signal while running. It is probably a
8469 segmentation fault and almost certainly means a bug in Samba (unless
8470 you have faulty hardware or system software).
8471 </p><p>
8472 If the message came from smbd then it will probably be accompanied by
8473 a message which details the last SMB message received by smbd. This
8474 info is often very useful in tracking down the problem so please
8475 include it in your bug report.
8476 </p><p>
8477 You should also detail how to reproduce the problem, if
8478 possible. Please make this reasonably detailed.
8479 </p><p>
8480 You may also find that a core file appeared in a <tt>corefiles</tt>
8481 subdirectory of the directory where you keep your samba log
8482 files. This file is the most useful tool for tracking down the bug. To
8483 use it you do this:
8484 </p><p><b>gdb smbd core</b></p><p>
8485 adding appropriate paths to smbd and core so gdb can find them. If you
8486 don't have gdb then try <b><tt>dbx</tt></b>. Then within the debugger use the
8487 command <b><tt>where</tt></b> to give a stack trace of where the problem
8488 occurred. Include this in your mail.
8489 </p><p>
8490 If you know any assembly language then do a <b><tt>disass</tt></b> of the routine
8491 where the problem occurred (if its in a library routine then
8492 disassemble the routine that called it) and try to work out exactly
8493 where the problem is by looking at the surrounding code. Even if you
8494 don't know assembly then incuding this info in the bug report can be
8495 useful. 
8496 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2887942"></a>Attaching to a running process</h2></div></div><p>
8497 Unfortunately some unixes (in particular some recent linux kernels)
8498 refuse to dump a core file if the task has changed uid (which smbd
8499 does often). To debug with this sort of system you could try to attach
8500 to the running process using <b><tt>gdb smbd <i><tt>PID</tt></i></tt></b> where you get <i><tt>PID</tt></i> from
8501 smbstatus. Then use <b><tt>c</tt></b> to continue and try to cause the core dump
8502 using the client. The debugger should catch the fault and tell you
8503 where it occurred.
8504 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2887989"></a>Patches</h2></div></div><p>
8505 The best sort of bug report is one that includes a fix! If you send us
8506 patches please use <b><tt>diff -u</tt></b> format if your version of 
8507 diff supports it, otherwise use <b><tt>diff -c4</tt></b>. Make sure 
8508 you do the diff against a clean version of the source and let me know 
8509 exactly what version you used. 
8510 </p></div></div></div><div class="part" lang="en"><div class="titlepage"><div><h1 class="title"><a name="Appendixes"></a>Appendixes</h1></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>30. <a href="#compiling">How to compile SAMBA</a></dt><dd><dl><dt><a href="#id2887580">Access Samba source code via CVS</a></dt><dd><dl><dt><a href="#id2887587">Introduction</a></dt><dt><a href="#id2887620">CVS Access to samba.org</a></dt></dl></dd><dt><a href="#id2888377">Accessing the samba sources via rsync and ftp</a></dt><dt><a href="#id2888418">Verifying Samba's PGP signature</a></dt><dt><a href="#id2888501">Building the Binaries</a></dt><dd><dl><dt><a href="#id2888639">Compiling samba with Active Directory support</a></dt></dl></dd><dt><a href="#id2888786">Starting the smbd and nmbd</a></dt><dd><dl><dt><a href="#id2888853">Starting from inetd.conf</a></dt><dt><a href="#id2889045">Alternative: starting it as a daemon</a></dt></dl></dd></dl></dd><dt>31. <a href="#NT4Migration">Migration from NT4 PDC to Samba-3 PDC</a></dt><dd><dl><dt><a href="#id2888159">Planning and Getting Started</a></dt><dd><dl><dt><a href="#id2888028">Objectives</a></dt><dt><a href="#id2889725">Steps In Migration Process</a></dt></dl></dd><dt><a href="#id2889980">Migration Options</a></dt><dd><dl><dt><a href="#id2890062">Planning for Success</a></dt><dt><a href="#id2890304">Samba Implementation Choices</a></dt></dl></dd></dl></dd><dt>32. <a href="#Portability">Portability</a></dt><dd><dl><dt><a href="#id2889273">HPUX</a></dt><dt><a href="#id2889171">SCO Unix</a></dt><dt><a href="#id2889194">DNIX</a></dt><dt><a href="#id2890671">RedHat Linux Rembrandt-II</a></dt><dt><a href="#id2890709">AIX</a></dt><dd><dl><dt><a href="#id2890716">Sequential Read Ahead</a></dt></dl></dd><dt><a href="#id2890741">Solaris</a></dt><dd><dl><dt><a href="#id2890748">Locking improvements</a></dt><dt><a href="#winbind-solaris9">Winbind on Solaris 9</a></dt></dl></dd></dl></dd><dt>33. <a href="#Other-Clients">Samba and other CIFS clients</a></dt><dd><dl><dt><a href="#id2890402">Macintosh clients?</a></dt><dt><a href="#id2890976">OS2 Client</a></dt><dd><dl><dt><a href="#id2890983">How can I configure OS/2 Warp Connect or 
8511                 OS/2 Warp 4 as a client for Samba?</a></dt><dt><a href="#id2891066">How can I configure OS/2 Warp 3 (not Connect), 
8512                 OS/2 1.2, 1.3 or 2.x for Samba?</a></dt><dt><a href="#id2891126">Are there any other issues when OS/2 (any version) 
8513                 is used as a client?</a></dt><dt><a href="#id2891155">How do I get printer driver download working 
8514                 for OS/2 clients?</a></dt></dl></dd><dt><a href="#id2891218">Windows for Workgroups</a></dt><dd><dl><dt><a href="#id2891226">Use latest TCP/IP stack from Microsoft</a></dt><dt><a href="#id2891257">Delete .pwl files after password change</a></dt><dt><a href="#id2891287">Configure WfW password handling</a></dt><dt><a href="#id2891313">Case handling of passwords</a></dt><dt><a href="#id2891344">Use TCP/IP as default protocol</a></dt><dt><a href="#id2891361">Speed improvement</a></dt></dl></dd><dt><a href="#id2891388">Windows '95/'98</a></dt><dd><dl><dt><a href="#id2891458">Speed improvement</a></dt></dl></dd><dt><a href="#id2891475">Windows 2000 Service Pack 2</a></dt><dt><a href="#id2891585">Windows NT 3.1</a></dt></dl></dd><dt>34. <a href="#SWAT">SWAT - The Samba Web Admininistration Tool</a></dt><dd><dl><dt><a href="#id2890961">SWAT Features and Benefits</a></dt><dd><dl><dt><a href="#id2890837">Enabling SWAT for use</a></dt><dt><a href="#id2891873">Securing SWAT through SSL</a></dt><dt><a href="#id2891946">The SWAT Home Page</a></dt><dt><a href="#id2892010">Global Settings</a></dt><dt><a href="#id2892118">Share Settings</a></dt><dt><a href="#id2892167">Printers Settings</a></dt><dt><a href="#id2892216">The SWAT Wizard</a></dt><dt><a href="#id2892261">The Status Page</a></dt><dt><a href="#id2892300">The View Page</a></dt><dt><a href="#id2892316">The Password Change Page</a></dt></dl></dd></dl></dd><dt>35. <a href="#speed">Samba performance issues</a></dt><dd><dl><dt><a href="#id2891608">Comparisons</a></dt><dt><a href="#id2891653">Socket options</a></dt><dt><a href="#id2892541">Read size</a></dt><dt><a href="#id2892584">Max xmit</a></dt><dt><a href="#id2892637">Log level</a></dt><dt><a href="#id2892660">Read raw</a></dt><dt><a href="#id2892717">Write raw</a></dt><dt><a href="#id2892759">Slow Logins</a></dt><dt><a href="#id2892781">Client tuning</a></dt></dl></dd></dl></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="compiling"></a>Chapter 30. How to compile SAMBA</h2></div><div><div class="author"><h3 class="author"></h3><div class="affiliation"><span class="orgname">Samba Team<br></span></div></div></div><div><div class="author"><h3 class="author">Jelmer R. Vernooij</h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate"> (22 May 2001) </p></div><div><p class="pubdate"> 18 March 2003 </p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2887580">Access Samba source code via CVS</a></dt><dd><dl><dt><a href="#id2887587">Introduction</a></dt><dt><a href="#id2887620">CVS Access to samba.org</a></dt></dl></dd><dt><a href="#id2888377">Accessing the samba sources via rsync and ftp</a></dt><dt><a href="#id2888418">Verifying Samba's PGP signature</a></dt><dt><a href="#id2888501">Building the Binaries</a></dt><dd><dl><dt><a href="#id2888639">Compiling samba with Active Directory support</a></dt></dl></dd><dt><a href="#id2888786">Starting the smbd and nmbd</a></dt><dd><dl><dt><a href="#id2888853">Starting from inetd.conf</a></dt><dt><a href="#id2889045">Alternative: starting it as a daemon</a></dt></dl></dd></dl></div><p>
8515 You can obtain the samba source from the <a href="http://samba.org/" target="_top">samba website</a>. To obtain a development version, 
8516 you can download samba from CVS or using rsync.
8517 </p><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2887580"></a>Access Samba source code via CVS</h2></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2887587"></a>Introduction</h3></div></div><p>
8518 Samba is developed in an open environment.  Developers use CVS
8519 (Concurrent Versioning System) to &quot;checkin&quot; (also known as 
8520 &quot;commit&quot;) new source code.  Samba's various CVS branches can
8521 be accessed via anonymous CVS using the instructions
8522 detailed in this chapter.
8523 </p><p>
8524 This chapter is a modified version of the instructions found at
8525 <a href="http://samba.org/samba/cvs.html" target="_top">http://samba.org/samba/cvs.html</a>
8526 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2887620"></a>CVS Access to samba.org</h3></div></div><p>
8527 The machine samba.org runs a publicly accessible CVS 
8528 repository for access to the source code of several packages, 
8529 including samba, rsync and jitterbug. There are two main ways of 
8530 accessing the CVS server on this host.
8531 </p><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2887636"></a>Access via CVSweb</h4></div></div><p>
8532 You can access the source code via your 
8533 favourite WWW browser. This allows you to access the contents of 
8534 individual files in the repository and also to look at the revision 
8535 history and commit logs of individual files. You can also ask for a diff 
8536 listing between any two versions on the repository.
8537 </p><p>
8538 Use the URL : <a href="http://samba.org/cgi-bin/cvsweb" target="_top">http://samba.org/cgi-bin/cvsweb</a>
8539 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2888200"></a>Access via cvs</h4></div></div><p>
8540 You can also access the source code via a 
8541 normal cvs client.  This gives you much more control over what you can 
8542 do with the repository and allows you to checkout whole source trees 
8543 and keep them up to date via normal cvs commands. This is the 
8544 preferred method of access if you are a developer and not
8545 just a casual browser.
8546 </p><p>
8547 To download the latest cvs source code, point your
8548 browser at the URL : <a href="http://www.cyclic.com/" target="_top">http://www.cyclic.com/</a>.
8549 and click on the 'How to get cvs' link. CVS is free software under 
8550 the GNU GPL (as is Samba).  Note that there are several graphical CVS clients
8551 which provide a graphical interface to the sometimes mundane CVS commands.
8552 Links to theses clients are also available from http://www.cyclic.com.
8553 </p><p>
8554 To gain access via anonymous cvs use the following steps. 
8555 For this example it is assumed that you want a copy of the 
8556 samba source code. For the other source code repositories 
8557 on this system just substitute the correct package name
8558 </p><div class="orderedlist"><ol type="1"><li><p>
8559         Install a recent copy of cvs. All you really need is a 
8560         copy of the cvs client binary. 
8561         </p></li><li><p>
8562         Run the command 
8563         </p><p>
8564         <b><tt>cvs -d :pserver:cvs@samba.org:/cvsroot login</tt></b>
8565         </p><p>
8566         When it asks you for a password type <b><tt>cvs</tt></b>.
8567         </p></li><li><p>
8568         Run the command 
8569         </p><p>
8570         <b><tt>cvs -d :pserver:cvs@samba.org:/cvsroot co samba</tt></b>
8571         </p><p>
8572         This will create a directory called samba containing the 
8573         latest samba source code (i.e. the HEAD tagged cvs branch). This 
8574         currently corresponds to the 3.0 development tree. 
8575         </p><p>
8576         CVS branches other then HEAD can be obtained by using the <i><tt>-r</tt></i>
8577         and defining a tag name.  A list of branch tag names can be found on the
8578         &quot;Development&quot; page of the samba web site.  A common request is to obtain the
8579         latest 2.2 release code.  This could be done by using the following userinput.
8580         </p><p>
8581         <b><tt>cvs -d :pserver:cvs@samba.org:/cvsroot co -r SAMBA_2_2 samba</tt></b>
8582         </p></li><li><p>
8583         Whenever you want to merge in the latest code changes use 
8584         the following command from within the samba directory: 
8585         </p><p>
8586         <b><tt>cvs update -d -P</tt></b>
8587         </p></li></ol></div></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2888377"></a>Accessing the samba sources via rsync and ftp</h2></div></div><p>
8588         pserver.samba.org also exports unpacked copies of most parts of the CVS tree at <a href="ftp://pserver.samba.org/pub/unpacked" target="_top">ftp://pserver.samba.org/pub/unpacked</a> and also via anonymous rsync at rsync://pserver.samba.org/ftp/unpacked/. I recommend using rsync rather than ftp.
8589         See <a href="http://rsync.samba.org/" target="_top">the rsync homepage</a> for more info on rsync.                       
8590         </p><p>
8591         The disadvantage of the unpacked trees
8592         is that they do not support automatic
8593         merging of local changes like CVS does.
8594         rsync access is most convenient for an 
8595         initial install.                       
8596         </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2888418"></a>Verifying Samba's PGP signature</h2></div></div><p>
8597 In these days of insecurity, it's strongly recommended that you verify the PGP signature for any
8598 source file before installing it. According to Jerry Carter of the Samba Team, only about 22% of
8599 all Samba downloads have had a corresponding PGP signature download (a very low percentage, which
8600 should be considered a bad thing). Even if you're not downloading from a mirror site, verifying PGP
8601 signatures should be a standard reflex.
8602 </p><p>
8603 With that said, go ahead and download the following files:
8604 </p><pre class="programlisting">
8605      $ wget http://us1.samba.org/samba/ftp/samba-2.2.8a.tar.asc
8606      $ wget http://us1.samba.org/samba/ftp/samba-pubkey.asc
8607 </pre><p>
8608 The first file is the PGP signature for the Samba source file; the other is the Samba public
8609 PGP key itself. Import the public PGP key with:
8610 </p><pre class="programlisting">
8611      $ gpg --import samba-pubkey.asc
8612 </pre><p>
8613 And verify the Samba source code integrity with:
8614 </p><pre class="programlisting">
8615      $ gzip -d samba-2.2.8a.tar.gz
8616      $ gpg --verify samba-2.2.8a.tar.asc
8617 </pre><p>
8618 If you receive a message like, &quot;Good signature from Samba Distribution Verification Key...&quot;
8619 then all is well. The warnings about trust relationships can be ignored. An example of what
8620 you would not want to see would be:
8621 </p><pre class="programlisting">
8622      gpg: BAD signature from &quot;Samba Distribution Verification Key&quot;
8623 </pre></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2888501"></a>Building the Binaries</h2></div></div><p>To do this, first run the program <b><tt>./configure
8624         </tt></b> in the source directory. This should automatically 
8625         configure Samba for your operating system. If you have unusual 
8626         needs then you may wish to run</p><p><tt>root# </tt><b><tt>./configure --help
8627         </tt></b></p><p>first to see what special options you can enable.
8628         Then executing</p><p><tt>root# </tt><b><tt>make</tt></b></p><p>will create the binaries. Once it's successfully 
8629         compiled you can use </p><p><tt>root# </tt><b><tt>make install</tt></b></p><p>to install the binaries and manual pages. You can 
8630         separately install the binaries and/or man pages using</p><p><tt>root# </tt><b><tt>make installbin
8631         </tt></b></p><p>and</p><p><tt>root# </tt><b><tt>make installman
8632         </tt></b></p><p>Note that if you are upgrading for a previous version 
8633         of Samba you might like to know that the old versions of 
8634         the binaries will be renamed with a &quot;.old&quot; extension. You 
8635         can go back to the previous version with</p><p><tt>root# </tt><b><tt>make revert
8636         </tt></b></p><p>if you find this version a disaster!</p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2888639"></a>Compiling samba with Active Directory support</h3></div></div><p>In order to compile samba with ADS support, you need to have installed
8637         on your system:</p><div class="itemizedlist"><ul type="disc"><li><p>the MIT kerberos development libraries
8638             (either install from the sources or use a package). The
8639             heimdal libraries will not work.</p></li><li><p>the OpenLDAP development libraries.</p></li></ul></div><p>If your kerberos libraries are in a non-standard location then
8640           remember to add the configure option --with-krb5=DIR.</p><p>After you run configure make sure that <tt>include/config.h</tt> it generates contains lines like this:</p><pre class="programlisting">
8641 #define HAVE_KRB5 1
8642 #define HAVE_LDAP 1
8643 </pre><p>If it doesn't then configure did not find your krb5 libraries or
8644             your ldap libraries. Look in config.log to figure out why and fix
8645                   it.</p><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2888706"></a>Installing the required packages for Debian</h4></div></div><p>On Debian you need to install the following packages:</p><p>
8646         </p><div class="itemizedlist"><ul type="disc"><li>libkrb5-dev</li><li>krb5-user</li></ul></div><p>
8647         </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2888736"></a>Installing the required packages for RedHat</h4></div></div><p>On RedHat this means you should have at least: </p><p>
8648         </p><div class="itemizedlist"><ul type="disc"><li>krb5-workstation (for kinit)</li><li>krb5-libs (for linking with)</li><li>krb5-devel (because you are compiling from source)</li></ul></div><p>
8649         </p><p>in addition to the standard development environment.</p><p>Note that these are not standard on a RedHat install, and you may need
8650         to get them off CD2.</p></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2888786"></a>Starting the smbd and nmbd</h2></div></div><p>You must choose to start smbd and nmbd either
8651         as daemons or from inetdDon't try
8652         to do both!  Either you can put them in <tt>
8653         inetd.conf</tt> and have them started on demand
8654         by inetd, or you can start them as
8655         daemons either from the command line or in <tt>
8656         /etc/rc.local</tt>. See the man pages for details
8657         on the command line options. Take particular care to read
8658         the bit about what user you need to be in order to start
8659         Samba.  In many cases you must be root.</p><p>The main advantage of starting smbd
8660         and nmbd using the recommended daemon method
8661         is that they will respond slightly more quickly to an initial connection
8662         request.</p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2888853"></a>Starting from inetd.conf</h3></div></div><p>NOTE; The following will be different if 
8663                 you use NIS, NIS+ or LDAP to distribute services maps.</p><p>Look at your <tt>/etc/services</tt>. 
8664                 What is defined at port 139/tcp. If nothing is defined 
8665                 then add a line like this:</p><p><b><tt>netbios-ssn     139/tcp</tt></b></p><p>similarly for 137/udp you should have an entry like:</p><p><b><tt>netbios-ns     137/udp</tt></b></p><p>Next edit your <tt>/etc/inetd.conf</tt> 
8666                 and add two lines something like this:</p><pre class="programlisting">
8667                 netbios-ssn stream tcp nowait root /usr/local/samba/bin/smbd smbd 
8668                 netbios-ns dgram udp wait root /usr/local/samba/bin/nmbd nmbd 
8669                 </pre><p>The exact syntax of <tt>/etc/inetd.conf</tt> 
8670                 varies between unixes. Look at the other entries in inetd.conf 
8671                 for a guide.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Some unixes already have entries like netbios_ns 
8672                 (note the underscore) in <tt>/etc/services</tt>. 
8673                 You must either edit <tt>/etc/services</tt> or
8674                 <tt>/etc/inetd.conf</tt> to make them consistent.</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>On many systems you may need to use the 
8675                 <b>interfaces</b> option in <tt>smb.conf</tt> to specify the IP address 
8676                 and netmask of your interfaces. Run ifconfig 
8677                 as root if you don't know what the broadcast is for your
8678                 net. nmbd tries to determine it at run 
8679                 time, but fails on some unixes. 
8680                 </p></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Many unixes only accept around 5 
8681                 parameters on the command line in <tt>inetd.conf</tt>. 
8682                 This means you shouldn't use spaces between the options and 
8683                 arguments, or you should use a script, and start the script 
8684                 from <b>inetd</b>.</p></div><p>Restart <b>inetd</b>, perhaps just send 
8685                 it a HUP. If you have installed an earlier version of 
8686                 nmbd then you may need to kill nmbd as well.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2889045"></a>Alternative: starting it as a daemon</h3></div></div><p>To start the server as a daemon you should create 
8687                 a script something like this one, perhaps calling 
8688                 it <tt>startsmb</tt>.</p><pre class="programlisting">
8689                 #!/bin/sh
8690                 /usr/local/samba/bin/smbd -D 
8691                 /usr/local/samba/bin/nmbd -D 
8692                 </pre><p>then make it executable with <b>chmod 
8693                 +x startsmb</b></p><p>You can then run <b>startsmb</b> by 
8694                 hand or execute it from <tt>/etc/rc.local</tt>
8695                 </p><p>To kill it send a kill signal to the processes 
8696                 <b>nmbd</b> and <b>smbd</b>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If you use the SVR4 style init system then 
8697                 you may like to look at the <tt>examples/svr4-startup</tt>
8698                 script to make Samba fit into that system.</p></div></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="NT4Migration"></a>Chapter 31. Migration from NT4 PDC to Samba-3 PDC</h2></div><div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">April 3, 2003</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2888159">Planning and Getting Started</a></dt><dd><dl><dt><a href="#id2888028">Objectives</a></dt><dt><a href="#id2889725">Steps In Migration Process</a></dt></dl></dd><dt><a href="#id2889980">Migration Options</a></dt><dd><dl><dt><a href="#id2890062">Planning for Success</a></dt><dt><a href="#id2890304">Samba Implementation Choices</a></dt></dl></dd></dl></div><p>
8699 This is a rough guide to assist those wishing to migrate from NT4 domain control to
8700 Samba-3 based domain control.
8701 </p><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2888159"></a>Planning and Getting Started</h2></div></div><p>
8702 In the IT world there is often a saying that all problems are encountered because of
8703 poor planning. The corrollary to this saying is that not all problems can be anticpated
8704 and planned for. Then again, good planning will anticpate most show stopper type situations.
8705 </p><p>
8706 Those wishing to migrate from MS Windows NT4 domain control to a Samba-3 domain control
8707 environment would do well to develop a detailed migration plan. So here are a few pointers to
8708 help migration get under way.
8709 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2888028"></a>Objectives</h3></div></div><p>
8710 The key objective for most organisations will be to make the migration from MS Windows NT4 
8711 to Samba-3 domain control as painless as possible. One of the challenges you may experience
8712 in your migration process may well be one of convincing management that the new environment
8713 should remain in place. Many who have introduced open source technologies have experienced
8714 pressure to return to a Microsoft based platform solution at the first sign of trouble. 
8715 </p><p>
8716 It is strongly advised that before attempting a migration to a Samba-3 controlled network
8717 that every possible effort be made to gain all-round commitment to the change. Firstly, you
8718 should know precisely <span class="emphasis"><em>why</em></span> the change is important for the organisation.
8719 Possible motivations to make a change include:
8720 </p><div class="itemizedlist"><ul type="disc"><li><p>Improve network manageability</p></li><li><p>Obtain better user level functionality</p></li><li><p>Reduce network operating costs</p></li><li><p>Reduce exposure caused by Microsoft withdrawal of NT4 support</p></li><li><p>Avoid MS License 6 implications</p></li><li><p>Reduce organisation's dependency on Microsoft</p></li></ul></div><p>
8721 It is vital that it be well recognised that Samba-3 is NOT MS Windows NT4. Samba-3 offers
8722 an alternative solution that is both different from MS Windows NT4 and that offers some
8723 advantages compared with it. It should also be recognised that Samba-3 lacks many of the
8724 features that Microsoft has promoted as core values in migration from MS Windows NT4 to 
8725 MS Windows 2000 and beyond (with or without Active Directory services).
8726 </p><p>
8727 What are the features that Samba-3 can NOT provide?
8728 </p><div class="itemizedlist"><ul type="disc"><li><p>Active Directory Server</p></li><li><p>Group Policy Objects (in Active Direcrtory)</p></li><li><p>Machine Policy objects</p></li><li><p>Logon Scripts in Active Directorty</p></li><li><p>Software Application and Access Controls in Active Directory</p></li></ul></div><p>
8729 The features that Samba-3 DOES provide and that may be of compelling interest to your site
8730 includes:
8731 </p><div class="itemizedlist"><ul type="disc"><li><p>Lower Cost of Ownership</p></li><li><p>Global availability of support with no strings attached</p></li><li><p>Dynamic SMB Servers (ie:Can run more than one server per Unix/Linux system)</p></li><li><p>Creation of on-the-fly logon scripts</p></li><li><p>Creation of on-the-fly Policy Files</p></li><li><p>Greater Stability, Reliability, Performance and Availability</p></li><li><p>Manageability via an ssh connection</p></li><li><p>Flexible choices of back-end authentication technologies (tdbsam, ldapsam, mysqlsam)</p></li><li><p>Ability to implement a full single-signon architecture</p></li><li><p>Ability to distribute authentication systems for absolute minimum wide area network bandwidth demand</p></li></ul></div><p>
8732 Before migrating a network from MS Windows NT4 to Samba-3 it is vital that all necessary factors are
8733 considered. Users should be educated about changes they may experience so that the change will be a
8734 welcome one and not become an obstacle to the work they need to do. The following are some of the
8735 factors that will go into a successful migration:
8736 </p><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2889498"></a>Domain Layout</h4></div></div><p>
8737 Samba-3 can be configured as a domain controller, a back-up domain controller (probably best called
8738 a secondary controller), a domain member, or as a stand-alone server. The Windows network security
8739 domain context should be sized and scoped before implementation. Particular attention needs to be
8740 paid to the location of the primary domain controller (PDC) as well as backup controllers (BDCs).
8741 It should be noted that one way in which Samba-3 differs from Microsoft technology is that if one
8742 chooses to use an LDAP authentication backend then the same database can be used by several different
8743 domains. This means that in a complex organisation there can be a single LDAP database, that itself
8744 can be distributed, that can simultaneously serve multiple domains (that can also be widely distributed).
8745 </p><p>
8746 It is recommended that from a design perspective, the number of users per server, as well as the number
8747 of servers, per domain should be scaled according to needs and should also consider server capacity
8748 and network bandwidth.
8749 </p><p>
8750 A physical network segment may house several domains, each of which may span multiple network segments.
8751 Where domains span routed network segments it is most advisable to consider and test the performance
8752 implications of the design and layout of a network. A Centrally located domain controller that is being
8753 designed to serve mulitple routed network segments may result in severe performance problems if the
8754 response time (eg: ping timing) between the remote segment and the PDC is more than 100 ms. In situations
8755 where the delay is too long it is highly recommended to locate a backup controller (BDC) to serve as
8756 the local authentication and access control server.
8757 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2889551"></a>Server Share and Directory Layout</h4></div></div><p>
8758 There are few cardinal rules to effective network design that can be broken with impunity.
8759 The most important rule of effective network management is that simplicity is king in every
8760 well controlled network. Every part of the infrastructure must be managed, the more complex
8761 it is, the greater will be the demand of keeping systems secure and functional.
8762 </p><p>
8763 The nature of the data that must be stored needs to be born in mind when deciding how many
8764 shares must be created. The physical disk space layout should also be taken into account
8765 when designing where share points will be created. Keep in mind that all data needs to be
8766 backed up, thus the simpler the disk layout the easier it will be to keep track of what must
8767 be backed up to tape or other off-line storage medium. Always plan and implement for minimum
8768 maintenance. Leave nothing to chance in your design, above all, do not leave backups to chance:
8769 Backup and test, validate every backup, create a disaster recovery plan and prove that it works.
8770 </p><p>
8771 Users should be grouped according to data access control needs. File and directory access 
8772 is best controlled via group permissions and the use of the &quot;sticky bit&quot; on group controlled
8773 directories may substantially avoid file access complaints from samba share users.
8774 </p><p>
8775 Many network administrators who are new to the game will attempt to use elaborate techniques
8776 to set access controls, on files, directories, shares, as well as in share definitions.
8777 There is the ever present danger that that administrator's successor will not understand the
8778 complex mess that has been inherited. Remember, apparent job security through complex design
8779 and implementation may ultimately cause loss of operations and downtime to users as the new
8780 administrator learns to untangle your web. Keep access controls simple and effective and
8781 make sure that users will never be interrupted by the stupidity of complexity.
8782 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2889612"></a>Logon Scripts</h4></div></div><p>
8783 Please refer to the section of this document on Advanced Network Adminsitration for information
8784 regarding the network logon script options for Samba-3. Logon scripts can help to ensure that
8785 all users gain share and printer connections they need.
8786 </p><p>
8787 Logon scripts can be created on-the-fly so that all commands executed are specific to the
8788 rights and privilidges granted to the user. The preferred controls should be affected through
8789 group membership so that group information can be used to custom create a logong script using
8790 the <tt>root preexec</tt> parameters to the <tt>NETLOGON</tt> share.
8791 </p><p>
8792 Some sites prefer to use a tool such as <tt>kixstart</tt> to establish a controlled
8793 user environment. In any case you may wish to do a google search for logon script process controls.
8794 In particular, you may wish to explore the use of the Microsoft knowledgebase article KB189105 that
8795 deals with how to add printers without user intervention via the logon script process.
8796 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2889670"></a>Profile Migration/Creation</h4></div></div><p>
8797 User and Group Profiles may be migrated using the tools described in the section titled Desktop Profile
8798 Management.
8799 </p><p>
8800 Profiles may also be managed using the Samba-3 tool <tt>profiles</tt>. This tool allows
8801 the MS Windows NT style security identifiers (SIDs) that are stored inside the profile NTuser.DAT file
8802 to be changed to the SID of the Samba-3 domain.
8803 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2889700"></a>User and Group Accounts</h4></div></div><p>
8804 It is possible to migrate all account settings from an MS Windows NT4 domain to Samba-3. Before
8805 attempting to migrate user and group accounts it is STRONGLY advised to create in Samba-3 the
8806 groups that are present on the MS Windows NT4 domain <span class="emphasis"><em>AND</em></span> to connect these to
8807 suitable Unix/Linux groups. Following this simple advice will mean that all user and group attributes
8808 should migrate painlessly.
8809 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2889725"></a>Steps In Migration Process</h3></div></div><p>
8810 The approximate migration process is described below.
8811 </p><div class="itemizedlist"><ul type="disc"><li><p>
8812 You will have an NT4 PDC that has the users, groups, policies and profiles to be migrated
8813 </p></li><li><p>
8814 Samba-3 set up as a DC with netlogon share, profile share, etc.
8815 </p></li></ul></div><div class="procedure"><p class="title"><b>Procedure 31.1. The Account Migration Process</b></p><ol type="1"><li><p>Create a BDC account for the samba server using NT Server Manager</p><ol type="a"><li><p>Samba must NOT be running</p></li></ol></li><li><p>rpcclient NT4PDC -U Administrator%passwd</p><ol type="a"><li><p>lsaquery</p></li><li><p>Note the SID returned</p></li></ol></li><li><p>net getsid -S NT4PDC -w DOMNAME -U Administrator%passwd</p><ol type="a"><li><p>Note the SID</p></li></ol></li><li><p>net getlocalsid</p><ol type="a"><li><p>Note the SID, now check that all three SIDS reported are the same!</p></li></ol></li><li><p>net rpc join -S NT4PDC -w DOMNAME -U Administrator%passwd</p></li><li><p>net rpc vampire -S NT4PDC -U administrator%passwd</p></li><li><p>pdbedit -l</p><ol type="a"><li><p>Note - did the users migrate?</p></li></ol></li><li><p>initGrps.sh DOMNAME</p></li><li><p>net groupmap list</p><ol type="a"><li><p>Now check that all groups are recognised</p></li></ol></li><li><p>net rpc campire -S NT4PDC -U administrator%passwd</p></li><li><p>pdbedit -lv</p><ol type="a"><li><p>Note - check that all group membership has been migrated</p></li></ol></li></ol></div><p>
8816 Now it is time to migrate all the profiles, then migrate all policy files.
8817 More later.
8818 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2889980"></a>Migration Options</h2></div></div><p>
8819 Based on feedback from many sites as well as from actual installation and maintenance
8820 experience sites that wish to migrate from MS Windows NT4 Domain Control to a Samba
8821 based solution fit into three basic categories.
8822 </p><div class="table"><a name="id2889997"></a><p class="title"><b>Table 31.1. The 3 Major Site Types</b></p><table summary="The 3 Major Site Types" border="1"><colgroup><col><col></colgroup><thead><tr><th>Number of Users</th><th>Description</th></tr></thead><tbody><tr><td>&lt; 50</td><td><p>Want simple conversion with NO pain</p></td></tr><tr><td>50 - 250</td><td><p>Want new features, can manage some in-house complexity</p></td></tr><tr><td>&gt; 250</td><td><p>Solution/Implementation MUST scale well, complex needs. Cross departmental decision process. Local expertise in most areas</p></td></tr></tbody></table></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2890062"></a>Planning for Success</h3></div></div><p>
8823 There are three basic choices for sites that intend to migrate from MS Windwows NT4
8824 to Samba-3.
8825 </p><div class="itemizedlist"><ul type="disc"><li><p>
8826         Simple Conversion (total replacement)
8827         </p></li><li><p>
8828         Upgraded Conversion (could be one of integration)
8829         </p></li><li><p>
8830         Complete Redesign (completely new solution)
8831         </p></li></ul></div><p>
8832 No matter what choice you make, the following rules will minimise down-stream problems:
8833 </p><div class="itemizedlist"><ul type="disc"><li><p>
8834         Take sufficient time
8835         </p></li><li><p>
8836         Avoid Panic
8837         </p></li><li><p>
8838         Test ALL assumptions
8839         </p></li><li><p>
8840         Test full roll-out program, including workstation deployment
8841         </p></li></ul></div><div class="table"><a name="id2890135"></a><p class="title"><b>Table 31.2. Nature of the Conversion Choices</b></p><table summary="Nature of the Conversion Choices" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Simple</th><th>Upgraded</th><th>Redesign</th></tr></thead><tbody><tr><td><p>Make use of minimal OS specific features</p></td><td><p>Translate NT4 features to new host OS features</p></td><td><p>Decide:</p></td></tr><tr><td><p>Suck all accounts from NT4 into Samba-3</p></td><td><p>Copy and improve:</p></td><td><p>Authentication Regime (database location and access)</p></td></tr><tr><td><p>Make least number of operational changes</p></td><td><p>Make progressive improvements</p></td><td><p>Desktop Management Methods</p></td></tr><tr><td><p>Take least amount of time to migrate</p></td><td><p>Minimise user impact</p></td><td><p>Better Control of Desktops / Users</p></td></tr><tr><td><p>Live versus Isolated Conversion</p></td><td><p>Maximise functionality</p></td><td><p>Identify Needs for: Manageability, Scalability, Security, Availability</p></td></tr><tr><td><p>Integrate Samba-3 then migrate while users are active, then Change of control (ie: swap out)</p></td><td><p>Take advantage of lower maintenance opportunity</p></td><td><p></p></td></tr></tbody></table></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2890304"></a>Samba Implementation Choices</h3></div></div><pre class="programlisting">
8842 Authentication database back end
8843         Winbind (external Samba or NT4/200x server)
8844         Can use pam_mkhomedir.so to auto-create home dirs
8845         External server could use Active Directory or NT4 Domain
8846
8847 Database type
8848         smbpasswd, tdbsam, ldapsam, MySQLsam
8849
8850 Access Control Points
8851         On the Share itself (Use NT4 Server Manager)
8852         On the file system
8853         Unix permissions on files and directories
8854         Posix ACLs enablement in file system?
8855         Through Samba share parameters
8856                 Not recommended - except as only resort
8857
8858 Policies (migrate or create new ones)
8859         Group Policy Editor (NT4)
8860         Watch out for Tattoo effect
8861
8862 User and Group Profiles
8863         Platform specific so use platform tool to change from a Local
8864         to a Roaming profile Can use new profiles tool to change SIDs
8865         (NTUser.DAT)
8866
8867 Logon Scripts (Know how they work)
8868
8869 User and Group mapping to Unix/Linux
8870         username map facility may be needed
8871         Use 'net groupmap' to connect NT4 groups to Unix groups
8872         Use pdbedit to set/change user configuration
8873 NOTE:
8874 If migrating to LDAP back end it may be easier to dump initial LDAP database
8875 to LDIF, then edit, then reload into LDAP
8876
8877         OS specific scripts / programs may be needed
8878                 Add / delete Users
8879                         Note OS limits on size of name (Linux 8 chars)
8880                                 NT4 up to 254 chars
8881                 Add / delete machines
8882                         Applied only to domain members (note up to 16 chars)
8883                 Add / delete Groups
8884                         Note OS limits on size and nature
8885                                 Linux limit is 16 char,
8886                                 no spaces and no upper case chars (groupadd)
8887
8888 Migration Tools
8889         Domain Control (NT4 Style)
8890         Profiles, Policies, Access Controls, Security
8891
8892 Migration Tools
8893         Samba: net, rpcclient, smbpasswd, pdbedit, profiles
8894         Windows: NT4 Domain User Manager, Server Manager (NEXUS)
8895
8896 Authentication
8897         New SAM back end (smbpasswd, tdbsam, ldapsam, mysqlsam)
8898 </pre><p>
8899 </p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="Portability"></a>Chapter 32. Portability</h2></div><div><div class="author"><h3 class="author">Jelmer R. Vernooij</h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2889273">HPUX</a></dt><dt><a href="#id2889171">SCO Unix</a></dt><dt><a href="#id2889194">DNIX</a></dt><dt><a href="#id2890671">RedHat Linux Rembrandt-II</a></dt><dt><a href="#id2890709">AIX</a></dt><dd><dl><dt><a href="#id2890716">Sequential Read Ahead</a></dt></dl></dd><dt><a href="#id2890741">Solaris</a></dt><dd><dl><dt><a href="#id2890748">Locking improvements</a></dt><dt><a href="#winbind-solaris9">Winbind on Solaris 9</a></dt></dl></dd></dl></div><p>Samba works on a wide range of platforms but the interface all the 
8900 platforms provide is not always compatible. This chapter contains 
8901 platform-specific information about compiling and using samba.</p><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2889273"></a>HPUX</h2></div></div><p>
8902 HP's implementation of supplementary groups is, er, non-standard (for
8903 hysterical reasons).  There are two group files, /etc/group and
8904 /etc/logingroup; the system maps UIDs to numbers using the former, but
8905 initgroups() reads the latter.  Most system admins who know the ropes
8906 symlink /etc/group to /etc/logingroup (hard link doesn't work for reasons
8907 too stupid to go into here).  initgroups() will complain if one of the
8908 groups you're in in /etc/logingroup has what it considers to be an invalid
8909 ID, which means outside the range [0..UID_MAX], where UID_MAX is (I think)
8910 60000 currently on HP-UX.  This precludes -2 and 65534, the usual 'nobody'
8911 GIDs.
8912 </p><p>
8913 If you encounter this problem, make sure that the programs that are failing 
8914 to initgroups() be run as users not in any groups with GIDs outside the 
8915 allowed range.
8916 </p><p>This is documented in the HP manual pages under setgroups(2) and passwd(4).
8917 </p><p>
8918 On HPUX you must use gcc or the HP Ansi compiler. The free compiler
8919 that comes with HP-UX is not Ansi compliant and cannot compile
8920 Samba.
8921 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2889171"></a>SCO Unix</h2></div></div><p> 
8922 If you run an old version of  SCO Unix then you may need to get important 
8923 TCP/IP patches for Samba to work correctly. Without the patch, you may 
8924 encounter corrupt data transfers using samba.
8925 </p><p>
8926 The patch you need is UOD385 Connection Drivers SLS. It is available from
8927 SCO (ftp.sco.com, directory SLS, files uod385a.Z and uod385a.ltr.Z).
8928 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2889194"></a>DNIX</h2></div></div><p>
8929 DNIX has a problem with seteuid() and setegid(). These routines are
8930 needed for Samba to work correctly, but they were left out of the DNIX
8931 C library for some reason.
8932 </p><p>
8933 For this reason Samba by default defines the macro NO_EID in the DNIX
8934 section of includes.h. This works around the problem in a limited way,
8935 but it is far from ideal, some things still won't work right.
8936 </p><p> 
8937 To fix the problem properly you need to assemble the following two
8938 functions and then either add them to your C library or link them into
8939 Samba.
8940 </p><p> 
8941 put this in the file <tt>setegid.s</tt>:
8942 </p><pre class="programlisting">
8943         .globl  _setegid
8944 _setegid:
8945         moveq   #47,d0
8946         movl    #100,a0
8947         moveq   #1,d1
8948         movl    4(sp),a1
8949         trap    #9
8950         bccs    1$
8951         jmp     cerror
8952 1$:
8953         clrl    d0
8954         rts
8955 </pre><p>
8956 put this in the file <tt>seteuid.s</tt>:
8957 </p><pre class="programlisting">
8958         .globl  _seteuid
8959 _seteuid:
8960         moveq   #47,d0
8961         movl    #100,a0
8962         moveq   #0,d1
8963         movl    4(sp),a1
8964         trap    #9
8965         bccs    1$
8966         jmp     cerror
8967 1$:
8968         clrl    d0
8969         rts
8970 </pre><p>
8971 after creating the above files you then assemble them using
8972 </p><p><b>as seteuid.s</b></p><p><b>as setegid.s</b></p><p>
8973 that should produce the files <tt>seteuid.o</tt> and 
8974 <tt>setegid.o</tt>
8975 </p><p>
8976 then you need to add these to the LIBSM line in the DNIX section of
8977 the Samba Makefile. Your LIBSM line will then look something like this:
8978 </p><pre class="programlisting">
8979 LIBSM = setegid.o seteuid.o -ln
8980 </pre><p> 
8981 You should then remove the line:
8982 </p><pre class="programlisting">
8983 #define NO_EID
8984 </pre><p>from the DNIX section of <tt>includes.h</tt></p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2890671"></a>RedHat Linux Rembrandt-II</h2></div></div><p>
8985 By default RedHat Rembrandt-II during installation adds an
8986 entry to /etc/hosts as follows:
8987 </p><pre class="programlisting">
8988         127.0.0.1 loopback &quot;hostname&quot;.&quot;domainname&quot;
8989 </pre><p>
8990 </p><p>
8991 This causes Samba to loop back onto the loopback interface.
8992 The result is that Samba fails to communicate correctly with
8993 the world and therefor may fail to correctly negotiate who
8994 is the master browse list holder and who is the master browser.
8995 </p><p>
8996 Corrective Action:      Delete the entry after the word loopback
8997         in the line starting 127.0.0.1
8998 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2890709"></a>AIX</h2></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2890716"></a>Sequential Read Ahead</h3></div></div><p>
8999 Disabling Sequential Read Ahead using <b><tt>vmtune -r 0</tt></b> improves 
9000 samba performance significally.
9001 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2890741"></a>Solaris</h2></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2890748"></a>Locking improvements</h3></div></div><p>Some people have been experiencing problems with F_SETLKW64/fcntl 
9002 when running samba on solaris. The built in file locking mechanism was
9003 not scalable. Performance would degrade to the point where processes would
9004 get into loops of trying to lock a file. It woul try a lock, then fail,
9005 then try again. The lock attempt was failing before the grant was
9006 occurring. So the visible manifestation of this would be a handful of
9007 processes stealing all of the CPU, and when they were trussed they would
9008 be stuck if F_SETLKW64 loops.
9009 </p><p>
9010 Sun released patches for Solaris 2.6, 8, and 9. The patch for Solaris 7
9011 has not been released yet.
9012 </p><p>
9013 The patch revision for 2.6 is 105181-34
9014 for 8 is 108528-19
9015 and for 9 is 112233-04
9016 </p><p>
9017 After the install of these patches it is recommended to reconfigure
9018 and rebuild samba.
9019 </p><p>Thanks to Joe Meslovich for reporting</p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="winbind-solaris9"></a>Winbind on Solaris 9</h3></div></div><p>
9020 Nsswitch on Solaris 9 refuses to use the winbind nss module.  This behavior
9021 is fixed by Sun in patch 113476-05 which as of March 2003 is not in any
9022 roll-up packages.
9023 </p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="Other-Clients"></a>Chapter 33. Samba and other CIFS clients</h2></div><div><div class="author"><h3 class="author">Jim McDonough</h3><div class="affiliation"><span class="orgname">IBM<br></span><div class="address"><p><tt>&lt;<a href="mailto:jmcd@us.ibm.com">jmcd@us.ibm.com</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Jelmer R. Vernooij</h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">5 Mar 2001</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2890402">Macintosh clients?</a></dt><dt><a href="#id2890976">OS2 Client</a></dt><dd><dl><dt><a href="#id2890983">How can I configure OS/2 Warp Connect or 
9024                 OS/2 Warp 4 as a client for Samba?</a></dt><dt><a href="#id2891066">How can I configure OS/2 Warp 3 (not Connect), 
9025                 OS/2 1.2, 1.3 or 2.x for Samba?</a></dt><dt><a href="#id2891126">Are there any other issues when OS/2 (any version) 
9026                 is used as a client?</a></dt><dt><a href="#id2891155">How do I get printer driver download working 
9027                 for OS/2 clients?</a></dt></dl></dd><dt><a href="#id2891218">Windows for Workgroups</a></dt><dd><dl><dt><a href="#id2891226">Use latest TCP/IP stack from Microsoft</a></dt><dt><a href="#id2891257">Delete .pwl files after password change</a></dt><dt><a href="#id2891287">Configure WfW password handling</a></dt><dt><a href="#id2891313">Case handling of passwords</a></dt><dt><a href="#id2891344">Use TCP/IP as default protocol</a></dt><dt><a href="#id2891361">Speed improvement</a></dt></dl></dd><dt><a href="#id2891388">Windows '95/'98</a></dt><dd><dl><dt><a href="#id2891458">Speed improvement</a></dt></dl></dd><dt><a href="#id2891475">Windows 2000 Service Pack 2</a></dt><dt><a href="#id2891585">Windows NT 3.1</a></dt></dl></div><p>This chapter contains client-specific information.</p><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2890402"></a>Macintosh clients?</h2></div></div><p>
9028 Yes. <a href="http://www.thursby.com/" target="_top">Thursby</a> now have a CIFS Client / Server called <a href="http://www.thursby.com/products/dave.html" target="_top">DAVE</a>
9029 </p><p>
9030 They test it against Windows 95, Windows NT and samba for
9031 compatibility issues.  At the time of writing, DAVE was at version
9032 1.0.1. The 1.0.0 to 1.0.1 update is available as a free download from
9033 the Thursby web site (the speed of finder copies has been greatly
9034 enhanced, and there are bug-fixes included).
9035 </p><p> 
9036 Alternatives - There are two free implementations of AppleTalk for
9037 several kinds of UNIX machnes, and several more commercial ones.
9038 These products allow you to run file services and print services
9039 natively to Macintosh users, with no additional support required on
9040 the Macintosh.  The two free omplementations are 
9041 <a href="http://www.umich.edu/~rsug/netatalk/" target="_top">Netatalk</a>, and 
9042 <a href="http://www.cs.mu.oz.au/appletalk/atalk.html" target="_top">CAP</a>.  
9043 What Samba offers MS
9044 Windows users, these packages offer to Macs.  For more info on these
9045 packages, Samba, and Linux (and other UNIX-based systems) see
9046 <a href="http://www.eats.com/linux_mac_win.html" target="_top">http://www.eats.com/linux_mac_win.html</a>
9047 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2890976"></a>OS2 Client</h2></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2890983"></a>How can I configure OS/2 Warp Connect or 
9048                 OS/2 Warp 4 as a client for Samba?</h3></div></div><p>A more complete answer to this question can be 
9049                 found on <a href="http://carol.wins.uva.nl/~leeuw/samba/warp.html" target="_top">
9050                 http://carol.wins.uva.nl/~leeuw/samba/warp.html</a>.</p><p>Basically, you need three components:</p><div class="itemizedlist"><ul type="disc"><li><p>The File and Print Client ('IBM Peer')
9051                         </p></li><li><p>TCP/IP ('Internet support') 
9052                         </p></li><li><p>The &quot;NetBIOS over TCP/IP&quot; driver ('TCPBEUI')
9053                         </p></li></ul></div><p>Installing the first two together with the base operating 
9054                 system on a blank system is explained in the Warp manual. If Warp 
9055                 has already been installed, but you now want to install the 
9056                 networking support, use the &quot;Selective Install for Networking&quot; 
9057                 object in the &quot;System Setup&quot; folder.</p><p>Adding the &quot;NetBIOS over TCP/IP&quot; driver is not described 
9058                 in the manual and just barely in the online documentation. Start 
9059                 MPTS.EXE, click on OK, click on &quot;Configure LAPS&quot; and click 
9060                 on &quot;IBM OS/2 NETBIOS OVER TCP/IP&quot; in  'Protocols'.  This line 
9061                 is then moved to 'Current Configuration'. Select that line, 
9062                 click on &quot;Change number&quot; and increase it from 0 to 1. Save this
9063                 configuration.</p><p>If the Samba server(s) is not on your local subnet, you 
9064                 can optionally add IP names and addresses of these servers 
9065                 to the &quot;Names List&quot;, or specify a  WINS server ('NetBIOS 
9066                 Nameserver' in IBM and RFC terminology). For Warp Connect you 
9067                 may need to download an update for 'IBM Peer' to bring it on 
9068                 the same level as Warp 4. See the webpage mentioned above.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2891066"></a>How can I configure OS/2 Warp 3 (not Connect), 
9069                 OS/2 1.2, 1.3 or 2.x for Samba?</h3></div></div><p>You can use the free Microsoft LAN Manager 2.2c Client 
9070                 for OS/2 from 
9071                 <a href="ftp://ftp.microsoft.com/BusSys/Clients/LANMAN.OS2/" target="_top">
9072                 ftp://ftp.microsoft.com/BusSys/Clients/LANMAN.OS2/</a>.
9073         See <a href="http://carol.wins.uva.nl/~leeuw/lanman.html" target="_top">
9074                 http://carol.wins.uva.nl/~leeuw/lanman.html</a> for 
9075                 more information on how to install and use this client. In 
9076                 a nutshell, edit the file \OS2VER in the root directory of 
9077                 the OS/2 boot partition and add the lines:</p><pre class="programlisting">
9078                 20=setup.exe
9079                 20=netwksta.sys
9080                 20=netvdd.sys
9081                 </pre><p>before you install the client. Also, don't use the 
9082                 included NE2000 driver because it is buggy. Try the NE2000 
9083                 or NS2000 driver from 
9084                 <a href="ftp://ftp.cdrom.com/pub/os2/network/ndis/" target="_top">
9085                 ftp://ftp.cdrom.com/pub/os2/network/ndis/</a> instead.
9086                 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2891126"></a>Are there any other issues when OS/2 (any version) 
9087                 is used as a client?</h3></div></div><p>When you do a NET VIEW or use the &quot;File and Print 
9088                 Client Resource Browser&quot;, no Samba servers show up. This can 
9089                 be fixed by a patch from <a href="http://carol.wins.uva.nl/~leeuw/samba/fix.html" target="_top">
9090                 http://carol.wins.uva.nl/~leeuw/samba/fix.html</a>.
9091                 The patch will be included in a later version of Samba. It also 
9092                 fixes a couple of other problems, such as preserving long 
9093                 filenames when objects are dragged from the Workplace Shell 
9094                 to the Samba server. </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2891155"></a>How do I get printer driver download working 
9095                 for OS/2 clients?</h3></div></div><p>First, create a share called [PRINTDRV] that is 
9096                 world-readable.  Copy your OS/2 driver files there.  Note 
9097                 that the .EA_ files must still be separate, so you will need 
9098                 to use the original install files, and not copy an installed 
9099                 driver from an OS/2 system.</p><p>Install the NT driver first for that printer.  Then, 
9100                 add to your smb.conf a parameter, os2 driver map = 
9101                 <i><tt>filename</tt></i>&quot;.  Then, in the file 
9102                 specified by <i><tt>filename</tt></i>, map the 
9103                 name of the NT driver name to the OS/2 driver name as 
9104                 follows:</p><p><b>nt driver name = os2 &quot;driver 
9105                 name&quot;.&quot;device name&quot;</b>, e.g.:
9106                 HP LaserJet 5L = LASERJET.HP LaserJet 5L</p><p>You can have multiple drivers mapped in this file.</p><p>If you only specify the OS/2 driver name, and not the 
9107                 device name, the first attempt to download the driver will 
9108                 actually download the files, but the OS/2 client will tell 
9109                 you the driver is not available.  On the second attempt, it 
9110                 will work.  This is fixed simply by adding the device name
9111                  to the mapping, after which it will work on the first attempt.
9112                 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2891218"></a>Windows for Workgroups</h2></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2891226"></a>Use latest TCP/IP stack from Microsoft</h3></div></div><p>Use the latest TCP/IP stack from microsoft if you use Windows
9113 for workgroups. 
9114 </p><p>The early TCP/IP stacks had lots of bugs.</p><p> 
9115 Microsoft has released an incremental upgrade to their TCP/IP 32-Bit
9116 VxD drivers.  The latest release can be found on their ftp site at
9117 ftp.microsoft.com, located in /peropsys/windows/public/tcpip/wfwt32.exe.
9118 There is an update.txt file there that describes the problems that were
9119 fixed.  New files include WINSOCK.DLL, TELNET.EXE, WSOCK.386, VNBT.386,
9120 WSTCP.386, TRACERT.EXE, NETSTAT.EXE, and NBTSTAT.EXE.
9121 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2891257"></a>Delete .pwl files after password change</h3></div></div><p>
9122 WfWg does a lousy job with passwords. I find that if I change my
9123 password on either the unix box or the PC the safest thing to do is to
9124 delete the .pwl files in the windows directory. The PC will complain about not finding the files, but will soon get over it, allowing you to enter the new password.
9125 </p><p> 
9126 If you don't do this you may find that WfWg remembers and uses the old
9127 password, even if you told it a new one.
9128 </p><p> 
9129 Often WfWg will totally ignore a password you give it in a dialog box.
9130 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2891287"></a>Configure WfW password handling</h3></div></div><p>
9131 There is a program call admincfg.exe
9132 on the last disk (disk 8) of the WFW 3.11 disk set.  To install it
9133 type EXPAND A:\ADMINCFG.EX_ C:\WINDOWS\ADMINCFG.EXE Then add an icon
9134 for it via the &quot;Progam Manager&quot; &quot;New&quot; Menu.  This program allows you
9135 to control how WFW handles passwords.  ie disable Password Caching etc
9136 for use with <b>security = user</b>
9137 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2891313"></a>Case handling of passwords</h3></div></div><p>Windows for Workgroups uppercases the password before sending it to the server. Unix passwords can be case-sensitive though. Check the <a href="smb.conf.5.html" target="_top">smb.conf(5)</a> information on <b>password level</b> to specify what characters samba should try to uppercase when checking.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2891344"></a>Use TCP/IP as default protocol</h3></div></div><p>To support print queue reporting you may find
9138 that you have to use TCP/IP as the default protocol under
9139 WfWg. For some reason if you leave Netbeui as the default
9140 it may break the print queue reporting on some systems.
9141 It is presumably a WfWg bug.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2891361"></a>Speed improvement</h3></div></div><p>
9142 Note that some people have found that setting DefaultRcvWindow in
9143 the [MSTCP] section of the SYSTEM.INI file under WfWg to 3072 gives a
9144 big improvement. I don't know why.
9145 </p><p>
9146 My own experience wth DefaultRcvWindow is that I get much better
9147 performance with a large value (16384 or larger). Other people have
9148 reported that anything over 3072 slows things down enourmously. One
9149 person even reported a speed drop of a factor of 30 when he went from
9150 3072 to 8192. I don't know why.
9151 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2891388"></a>Windows '95/'98</h2></div></div><p>
9152 When using Windows 95 OEM SR2 the following updates are recommended where Samba
9153 is being used. Please NOTE that the above change will affect you once these
9154 updates  have been installed.
9155 </p><p> 
9156 There are more updates than the ones mentioned here. You are referred to the
9157 Microsoft Web site for all currently available updates to your specific version
9158 of Windows 95.
9159 </p><div class="orderedlist"><ol type="1"><li><p>Kernel Update: KRNLUPD.EXE</p></li><li><p>Ping Fix: PINGUPD.EXE</p></li><li><p>RPC Update: RPCRTUPD.EXE</p></li><li><p>TCP/IP Update: VIPUPD.EXE</p></li><li><p>Redirector Update: VRDRUPD.EXE</p></li></ol></div><p>
9160 Also, if using MS OutLook it is desirable to install the OLEUPD.EXE fix. This
9161 fix may stop your machine from hanging for an extended period when exiting
9162 OutLook and you may also notice a significant speedup when accessing network
9163 neighborhood services.
9164 </p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2891458"></a>Speed improvement</h3></div></div><p>
9165 Configure the win95 TCPIP registry settings to give better
9166 performance. I use a program called MTUSPEED.exe which I got off the
9167 net. There are various other utilities of this type freely available.
9168 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2891475"></a>Windows 2000 Service Pack 2</h2></div></div><p> 
9169 There are several annoyances with Windows 2000 SP2. One of which
9170 only appears when using a Samba server to host user profiles
9171 to Windows 2000 SP2 clients in a Windows domain.  This assumes
9172 that Samba is a member of the domain, but the problem will
9173 likely occur if it is not.
9174 </p><p> 
9175 In order to server profiles successfully to Windows 2000 SP2 
9176 clients (when not operating as a PDC), Samba must have 
9177 <b>nt acl support = no</b>
9178 added to the file share which houses the roaming profiles.
9179 If this is not done, then the Windows 2000 SP2 client will
9180 complain about not being able to access the profile (Access 
9181 Denied) and create multiple copies of it on disk (DOMAIN.user.001,
9182 DOMAIN.user.002, etc...).  See the 
9183 <a href="smb.conf.5.html" target="_top">smb.conf(5)</a> man page
9184 for more details on this option.  Also note that the 
9185 <b>nt acl support</b> parameter was formally a global parameter in
9186 releases prior to Samba 2.2.2.
9187 </p><p> 
9188 The following is a minimal profile share:
9189 </p><pre class="programlisting">
9190         [profile]
9191                 path = /export/profile
9192                 create mask = 0600
9193                 directory mask = 0700
9194                 nt acl support = no
9195                 read only = no
9196 </pre><p>
9197 The reason for this bug is that the Win2k SP2 client copies
9198 the security descriptor for the profile which contains
9199 the Samba server's SID, and not the domain SID.  The client
9200 compares the SID for SAMBA\user and realizes it is
9201 different that the one assigned to DOMAIN\user.  Hence the reason
9202 for the &quot;access denied&quot; message.
9203 </p><p>
9204 By disabling the <b>nt acl support</b> parameter, Samba will send
9205 the Win2k client a response to the QuerySecurityDescriptor
9206 trans2 call which causes the client to set a default ACL
9207 for the profile. This default ACL includes 
9208 </p><p><b>DOMAIN\user   &quot;Full Control&quot;</b></p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This bug does not occur when using winbind to
9209 create accounts on the Samba host for Domain users.</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2891585"></a>Windows NT 3.1</h2></div></div><p>If you have problems communicating across routers with Windows 
9210 NT 3.1 workstations, read <a href="http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;Q103765" target="_top">this Microsoft Knowledge Base article</a>.
9211
9212 </p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="SWAT"></a>Chapter 34. SWAT - The Samba Web Admininistration Tool</h2></div><div><div class="author"><h3 class="author">John H. Terpstra</h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">April 21, 2003</p></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2890961">SWAT Features and Benefits</a></dt><dd><dl><dt><a href="#id2890837">Enabling SWAT for use</a></dt><dt><a href="#id2891873">Securing SWAT through SSL</a></dt><dt><a href="#id2891946">The SWAT Home Page</a></dt><dt><a href="#id2892010">Global Settings</a></dt><dt><a href="#id2892118">Share Settings</a></dt><dt><a href="#id2892167">Printers Settings</a></dt><dt><a href="#id2892216">The SWAT Wizard</a></dt><dt><a href="#id2892261">The Status Page</a></dt><dt><a href="#id2892300">The View Page</a></dt><dt><a href="#id2892316">The Password Change Page</a></dt></dl></dd></dl></div><p>
9213 There are many and varied opinions regarding the usefulness or otherwise of SWAT.
9214 No matter how hard one tries to produce the perfect configuration tool it remains
9215 an object of personal taste. SWAT is a tool that will allow web based configuration
9216 of samba. It has a wizard that may help to get samba configured quickly, it has context
9217 sensitive help on each smb.conf parameter, it provides for monitoring of current state
9218 of connection information, and it allows network wide MS Windows network password
9219 management.
9220 </p><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2890961"></a>SWAT Features and Benefits</h2></div></div><p>
9221 There are network administrators who believe that it is a good idea to write systems
9222 documentation inside configuration files, for them SWAT will aways be a nasty tool. SWAT
9223 does not store the configuration file in any intermediate form, rather, it stores only the
9224 parameter settings, so when SWAT writes the smb.conf file to disk it will write only
9225 those parameters that are at other than the default settings. The result is that all comments
9226 will be lost from the smb.conf file. Additionally, the parameters will be written back in
9227 internal ordering.
9228 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
9229 So before using SWAT please be warned - SWAT will completely replace your smb.conf with
9230 a fully optimised file that has been stripped of all comments you might have placed there
9231 and only non-default settings will be written to the file.
9232 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2890837"></a>Enabling SWAT for use</h3></div></div><p>
9233 SWAT should be installed to run via the network super daemon. Depending on which system
9234 your Unix/Linux system has you will have either an <tt>inetd</tt> or
9235 <tt>xinetd</tt> based system.
9236 </p><p>
9237 The nature and location of the network super-daemon varies with the operating system
9238 implementation. The control file (or files) can be located in the file 
9239 <tt>/etc/inetd.conf</tt> or in the directory <tt>/etc/[x]inet.d</tt>
9240 or similar.
9241 </p><p>
9242 The control entry for the older style file might be:
9243 </p><pre class="programlisting">
9244         # swat is the Samba Web Administration Tool
9245         swat stream tcp nowait.400 root /usr/sbin/swat swat
9246 </pre><p>
9247 A control file for the newer style xinetd could be:
9248 </p><p>
9249 </p><pre class="programlisting">
9250         # default: off
9251         # description: SWAT is the Samba Web Admin Tool. Use swat \
9252         #              to configure your Samba server. To use SWAT, \
9253         #              connect to port 901 with your favorite web browser.
9254         service swat
9255         {
9256                 port    = 901
9257                 socket_type     = stream
9258                 wait    = no
9259                 only_from = localhost
9260                 user    = root
9261                 server  = /usr/sbin/swat
9262                 log_on_failure  += USERID
9263                 disable = yes
9264         }
9265 </pre><p>
9266
9267 </p><p>
9268 Both the above examples assume that the <tt>swat</tt> binary has been
9269 located in the <tt>/usr/sbin</tt> directory. In addition to the above
9270 SWAT will use a directory access point from which it will load it's help files
9271 as well as other control information. The default location for this on most Linux
9272 systems is in the directory <tt>/usr/share/samba/swat</tt>. The default
9273 location using samba defaults will be <tt>/usr/local/samba/swat</tt>.
9274 </p><p>
9275 Access to SWAT will prompt for a logon. If you log onto SWAT as any non-root user
9276 the only permission allowed is to view certain aspects of configuration as well as
9277 access to the password change facility. The buttons that will be exposed to the non-root
9278 user are: <span class="emphasis"><em>HOME, STATUS, VIEW, PASSWORD</em></span>. The only page that allows
9279 change capability in this case is <span class="emphasis"><em>PASSWORD</em></span>.
9280 </p><p>
9281 So long as you log onto SWAT as the user <b>root</b> you should obtain
9282 full change and commit ability. The buttons that will be exposed includes:
9283 <span class="emphasis"><em>HOME, GLOBALS, SHARES, PRINTERS, WIZARD, STATUS, VIEW, PASSWORD</em></span>.
9284 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2891873"></a>Securing SWAT through SSL</h3></div></div><p>
9285 Lots of people have asked about how to setup SWAT with SSL to allow for secure remote
9286 administration of Samba. Here is a method that works, courtesy of Markus Krieger
9287 </p><p>
9288 Modifications to the swat setup are as following: 
9289 </p><div class="itemizedlist"><ul type="disc"><li><p>
9290         install OpenSSL 
9291         </p></li><li><p>
9292         generate certificate and private key
9293
9294         </p><pre class="programlisting">
9295         root# /usr/bin/openssl req -new -x509 -days 365 -nodes -config \
9296                 /usr/share/doc/packages/stunnel/stunnel.cnf \
9297                 -out /etc/stunnel/stunnel.pem -keyout /etc/stunnel/stunnel.pem
9298         </pre></li><li><p>
9299         remove swat-entry from [x]inetd 
9300         </p></li><li><p>
9301         start stunnel
9302
9303         </p><pre class="programlisting">
9304         root# stunnel -p /etc/stunnel/stunnel.pem -d 901 \
9305                  -l /usr/local/samba/bin/swat swat 
9306         </pre></li></ul></div><p>
9307 afterwards simply contact to swat by using the URL &quot;https://myhost:901&quot;, accept the certificate
9308 and the SSL connection is up.
9309 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2891946"></a>The SWAT Home Page</h3></div></div><p>
9310 The SWAT title page provides access to the latest Samba documentation. The manual page for
9311 each samba component is accessible from this page as are the Samba-HOWTO-Collection (this 
9312 document) as well as the O'Reilly book &quot;Using Samba&quot;.
9313 </p><p>
9314 Administrators who wish to validate their samba configuration may obtain useful information
9315 from the man pages for the diganostic utilities. These are available from the SWAT home page
9316 also. One diagnostic tool that is NOT mentioned on this page, but that is particularly
9317 useful is <b>ethereal</b>, available from <a href="http://www.ethereal.com" target="_top">
9318 http://www.ethereal.com</a>.
9319 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
9320 SWAT can be configured to run in <span class="emphasis"><em>demo</em></span> mode. This is NOT recommended
9321 as it runs SWAT without authentication and with full administrative ability. ie: Allows
9322 changes to smb.conf as well as general operation with root privilidges. The option that
9323 creates this ability is the <b>-a</b> flag to swat. DO NOT USE THIS IN ANY
9324 PRODUCTION ENVIRONMENT - you have been warned!
9325 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2892010"></a>Global Settings</h3></div></div><p>
9326 The Globals button will expose a page that allows configuration of the global parameters
9327 in smb.conf. There are three levels of exposure of the parameters:
9328 </p><div class="itemizedlist"><ul type="disc"><li><p>
9329         <b>Basic</b> - exposes common configuration options.
9330         </p></li><li><p>
9331         <b>Advanced</b> - exposes  configuration options needed in more 
9332         complex environments.
9333         </p></li><li><p>
9334         <b>Developer</b> - exposes configuration options that only the brave
9335         will want to tamper with.
9336         </p></li></ul></div><p>
9337 To switch to other than <span class="emphasis"><em>Basic</em></span> editing ability click on either the
9338 <span class="emphasis"><em>Advanced</em></span> or the <span class="emphasis"><em>Developer</em></span> dial, then click the
9339 <span class="emphasis"><em>Commit Changes</em></span> button.
9340 </p><p>
9341 After making any changes to configuration parameters make sure that you click on the 
9342 <span class="emphasis"><em>Commit Changes</em></span> button before moving to another area otherwise
9343 your changes will be immediately lost.
9344 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
9345 SWAT has context sensitive help. To find out what each parameter is for simply click the
9346 <b>Help</b> link to the left of the configurartion parameter.
9347 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2892118"></a>Share Settings</h3></div></div><p>
9348 To affect a currenly configured share, simply click on the pull down button between the
9349 <span class="emphasis"><em>Choose Share</em></span> and the <span class="emphasis"><em>Delete Share</em></span> buttons,
9350 select the share you wish to operate on, then to edit the settings click on the
9351 <span class="emphasis"><em>Choose Share</em></span> button, to delete the share simply press the
9352 <span class="emphasis"><em>Delete Share</em></span> button.
9353 </p><p>
9354 To create a new share, next to the button labelled <span class="emphasis"><em>Create Share</em></span> enter
9355 into the text field the name of the share to be created, then click on the 
9356 <span class="emphasis"><em>Create Share</em></span> button.
9357 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2892167"></a>Printers Settings</h3></div></div><p>
9358 To affect a currenly configured printer, simply click on the pull down button between the
9359 <span class="emphasis"><em>Choose Printer</em></span> and the <span class="emphasis"><em>Delete Printer</em></span> buttons,
9360 select the printer you wish to operate on, then to edit the settings click on the
9361 <span class="emphasis"><em>Choose Printer</em></span> button, to delete the share simply press the
9362 <span class="emphasis"><em>Delete Printer</em></span> button.
9363 </p><p>
9364 To create a new printer, next to the button labelled <span class="emphasis"><em>Create Printer</em></span> enter
9365 into the text field the name of the share to be created, then click on the 
9366 <span class="emphasis"><em>Create Printer</em></span> button.
9367 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2892216"></a>The SWAT Wizard</h3></div></div><p>
9368 The purpose if the SWAT Wizard is to help the Microsoft knowledgable network administrator
9369 to configure Samba with a minimum of effort.
9370 </p><p>
9371 The Wizard page provides a tool for rewiting the smb.conf file in fully optimised format.
9372 This will also happen if you press the commit button. The two differ in the the rewrite button
9373 ignores any changes that may have been made, while the Commit button causes all changes to be
9374 affected.
9375 </p><p>
9376 The <span class="emphasis"><em>Edit</em></span> button permits the editing (setting) of the minimal set of
9377 options that may be necessary to create a working samba server.
9378 </p><p>
9379 Finally, there are a limited set of options that will determine what type of server samba
9380 will be configured for, whether it will be a WINS server, participate as a WINS client, or
9381 operate with no WINS support. By clicking on one button you can elect to epose (or not) user
9382 home directories.
9383 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2892261"></a>The Status Page</h3></div></div><p>
9384 The status page serves a limited purpose. Firstly, it allows control of the samba daemons.
9385 The key daemons that create the samba server environment are: <b> smbd, nmbd, winbindd</b>.
9386 </p><p>
9387 The daemons may be controlled individually or as a total group. Additionally, you may set
9388 an automatic screen refresh timing. As MS Windows clients interact with Samba new smbd processes
9389 will be continually spawned. The auto-refresh facility will allow you to track the changing
9390 conditions with minimal effort.
9391 </p><p>
9392 Lastly, the Status page may be used to terminate specific smbd client connections in order to
9393 free files that may be locked.
9394 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2892300"></a>The View Page</h3></div></div><p>
9395 This page allows the administrator to view the optimised smb.conf file and if you are
9396 particularly massochistic will permit you also to see all possible global configuration
9397 parameters and their settings.
9398 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2892316"></a>The Password Change Page</h3></div></div><p>
9399 The Password Change page is a popular tool. This tool allows the creation, deletion, deactivation
9400 and reactivation of MS Windows networking users on the local machine. Alternatively, you can use
9401 this tool to change a local password for a user account.
9402 </p><p>
9403 When logged in as a non-root account the user will have to provide the old password as well as
9404 the new password (twice). When logged in as <b>root</b> only the new password is
9405 required.
9406 </p><p>
9407 One popular use for this tool is to change user passwords across a range of remote MS Windows
9408 servers.
9409 </p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="speed"></a>Chapter 35. Samba performance issues</h2></div><div><div class="author"><h3 class="author">Paul Cochrane</h3><div class="affiliation"><span class="orgname">Dundee Limb Fitting Centre<br></span><div class="address"><p><tt>&lt;<a href="mailto:paulc@dth.scot.nhs.uk">paulc@dth.scot.nhs.uk</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author">Jelmer R. Vernooij</h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2891608">Comparisons</a></dt><dt><a href="#id2891653">Socket options</a></dt><dt><a href="#id2892541">Read size</a></dt><dt><a href="#id2892584">Max xmit</a></dt><dt><a href="#id2892637">Log level</a></dt><dt><a href="#id2892660">Read raw</a></dt><dt><a href="#id2892717">Write raw</a></dt><dt><a href="#id2892759">Slow Logins</a></dt><dt><a href="#id2892781">Client tuning</a></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2891608"></a>Comparisons</h2></div></div><p>
9410 The Samba server uses TCP to talk to the client. Thus if you are
9411 trying to see if it performs well you should really compare it to
9412 programs that use the same protocol. The most readily available
9413 programs for file transfer that use TCP are ftp or another TCP based
9414 SMB server.
9415 </p><p>
9416 If you want to test against something like a NT or WfWg server then
9417 you will have to disable all but TCP on either the client or
9418 server. Otherwise you may well be using a totally different protocol
9419 (such as Netbeui) and comparisons may not be valid.
9420 </p><p>
9421 Generally you should find that Samba performs similarly to ftp at raw
9422 transfer speed. It should perform quite a bit faster than NFS,
9423 although this very much depends on your system.
9424 </p><p>
9425 Several people have done comparisons between Samba and Novell, NFS or
9426 WinNT. In some cases Samba performed the best, in others the worst. I
9427 suspect the biggest factor is not Samba vs some other system but the
9428 hardware and drivers used on the various systems. Given similar
9429 hardware Samba should certainly be competitive in speed with other
9430 systems.
9431 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2891653"></a>Socket options</h2></div></div><p>
9432 There are a number of socket options that can greatly affect the
9433 performance of a TCP based server like Samba.
9434 </p><p>
9435 The socket options that Samba uses are settable both on the command
9436 line with the -O option, or in the smb.conf file.
9437 </p><p>
9438 The <b>socket options</b> section of the <tt>smb.conf</tt> manual page describes how
9439 to set these and gives recommendations.
9440 </p><p>
9441 Getting the socket options right can make a big difference to your
9442 performance, but getting them wrong can degrade it by just as
9443 much. The correct settings are very dependent on your local network.
9444 </p><p>
9445 The socket option TCP_NODELAY is the one that seems to make the
9446 biggest single difference for most networks. Many people report that
9447 adding <b>socket options = TCP_NODELAY</b> doubles the read 
9448 performance of a Samba drive. The best explanation I have seen for this is
9449 that the Microsoft TCP/IP stack is slow in sending tcp ACKs.
9450 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2892541"></a>Read size</h2></div></div><p>
9451 The option <b>read size</b> affects the overlap of disk
9452 reads/writes with network reads/writes. If the amount of data being
9453 transferred in several of the SMB commands (currently SMBwrite, SMBwriteX and
9454 SMBreadbraw) is larger than this value then the server begins writing
9455 the data before it has received the whole packet from the network, or
9456 in the case of SMBreadbraw, it begins writing to the network before
9457 all the data has been read from disk.
9458 </p><p>
9459 This overlapping works best when the speeds of disk and network access
9460 are similar, having very little effect when the speed of one is much
9461 greater than the other.
9462 </p><p>
9463 The default value is 16384, but very little experimentation has been
9464 done yet to determine the optimal value, and it is likely that the best
9465 value will vary greatly between systems anyway. A value over 65536 is
9466 pointless and will cause you to allocate memory unnecessarily.
9467 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2892584"></a>Max xmit</h2></div></div><p>
9468 At startup the client and server negotiate a <b>maximum transmit</b> size,
9469 which limits the size of nearly all SMB commands. You can set the
9470 maximum size that Samba will negotiate using the <b>max xmit = </b> option
9471 in <tt>smb.conf</tt>. Note that this is the maximum size of SMB requests that 
9472 Samba will accept, but not the maximum size that the *client* will accept.
9473 The client maximum receive size is sent to Samba by the client and Samba
9474 honours this limit.
9475 </p><p>
9476 It defaults to 65536 bytes (the maximum), but it is possible that some
9477 clients may perform better with a smaller transmit unit. Trying values
9478 of less than 2048 is likely to cause severe problems.
9479 </p><p>
9480 In most cases the default is the best option.
9481 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2892637"></a>Log level</h2></div></div><p>
9482 If you set the log level (also known as <b>debug level</b>) higher than 2
9483 then you may suffer a large drop in performance. This is because the
9484 server flushes the log file after each operation, which can be very
9485 expensive. 
9486 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2892660"></a>Read raw</h2></div></div><p>
9487 The <b>read raw</b> operation is designed to be an optimised, low-latency
9488 file read operation. A server may choose to not support it,
9489 however. and Samba makes support for <b>read raw</b> optional, with it
9490 being enabled by default.
9491 </p><p>
9492 In some cases clients don't handle <b>read raw</b> very well and actually
9493 get lower performance using it than they get using the conventional
9494 read operations. 
9495 </p><p>
9496 So you might like to try <b>read raw = no</b> and see what happens on your
9497 network. It might lower, raise or not affect your performance. Only
9498 testing can really tell.
9499 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2892717"></a>Write raw</h2></div></div><p>
9500 The <b>write raw</b> operation is designed to be an optimised, low-latency
9501 file write operation. A server may choose to not support it,
9502 however. and Samba makes support for <b>write raw</b> optional, with it
9503 being enabled by default.
9504 </p><p>
9505 Some machines may find <b>write raw</b> slower than normal write, in which
9506 case you may wish to change this option.
9507 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2892759"></a>Slow Logins</h2></div></div><p>
9508 Slow logins are almost always due to the password checking time. Using
9509 the lowest practical <b>password level</b> will improve things. 
9510 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2892781"></a>Client tuning</h2></div></div><p>
9511 Often a speed problem can be traced to the client. The client (for
9512 example Windows for Workgroups) can often be tuned for better TCP
9513 performance. Check the sections on the various clients in 
9514 <a href="#Other-Clients" title="Chapter 33. Samba and other CIFS clients">Samba and Other Clients</a>.
9515 </p></div></div></div></div></body></html>