1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter�3.�Server Types and Security Modes</title><link rel="stylesheet" href="samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.71.0"><link rel="start" href="index.html" title="The Official Samba-3 HOWTO and Reference Guide"><link rel="up" href="type.html" title="Part�II.�Server Configuration Basics"><link rel="prev" href="type.html" title="Part�II.�Server Configuration Basics"><link rel="next" href="samba-pdc.html" title="Chapter�4.�Domain Control"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter�3.�Server Types and Security Modes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="type.html">Prev</a>�</td><th width="60%" align="center">Part�II.�Server Configuration Basics</th><td width="20%" align="right">�<a accesskey="n" href="samba-pdc.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="ServerType"></a>Chapter�3.�Server Types and Security Modes</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Andrew</span> <span class="surname">Tridgell</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email"><<a href="mailto:tridge@samba.org">tridge@samba.org</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Jelmer</span> <span class="othername">R.</span> <span class="surname">Vernooij</span></h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><code class="email"><<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">John</span> <span class="othername">H.</span> <span class="surname">Terpstra</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email"><<a href="mailto:jht@samba.org">jht@samba.org</a>></code></p></div></div></div></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ServerType.html#id325373">Features and Benefits</a></span></dt><dt><span class="sect1"><a href="ServerType.html#id325524">Server Types</a></span></dt><dt><span class="sect1"><a href="ServerType.html#id325675">Samba Security Modes</a></span></dt><dd><dl><dt><span class="sect2"><a href="ServerType.html#id325823">User Level Security</a></span></dt><dt><span class="sect2"><a href="ServerType.html#id325983">Share-Level Security</a></span></dt><dt><span class="sect2"><a href="ServerType.html#id326155">Domain Security Mode (User-Level Security)</a></span></dt><dt><span class="sect2"><a href="ServerType.html#id326646">ADS Security Mode (User-Level Security)</a></span></dt><dt><span class="sect2"><a href="ServerType.html#id326797">Server Security (User Level Security)</a></span></dt></dl></dd><dt><span class="sect1"><a href="ServerType.html#id327051">Password Checking</a></span></dt><dt><span class="sect1"><a href="ServerType.html#id327223">Common Errors</a></span></dt><dd><dl><dt><span class="sect2"><a href="ServerType.html#id327240">What Makes Samba a Server?</a></span></dt><dt><span class="sect2"><a href="ServerType.html#id327269">What Makes Samba a Domain Controller?</a></span></dt><dt><span class="sect2"><a href="ServerType.html#id327307">What Makes Samba a Domain Member?</a></span></dt><dt><span class="sect2"><a href="ServerType.html#id327332">Constantly Losing Connections to Password Server</a></span></dt><dt><span class="sect2"><a href="ServerType.html#id327373">Stand-alone Server is converted to Domain Controller Now User accounts don't work</a></span></dt></dl></dd></dl></div><p> 2<a class="indexterm" name="id325340"></a> 3<a class="indexterm" name="id325347"></a> 4This chapter provides information regarding the types of server that Samba may be configured to be. A 5Microsoft network administrator who wishes to migrate to or use Samba will want to know the meaning, within a 6Samba context, of terms familiar to the MS Windows administrator. This means that it is essential also to 7define how critical security modes function before we get into the details of how to configure the server 8itself. 9</p><p> 10This chapter provides an overview of the security modes of which Samba is capable and how they relate to MS 11Windows servers and clients. 12</p><p> 13A question often asked is, “<span class="quote">Why would I want to use Samba?</span>” Most chapters contain a section that 14highlights features and benefits. We hope that the information provided will help to answer this question. Be 15warned though, we want to be fair and reasonable, so not all features are positive toward Samba. The benefit 16may be on the side of our competition. 17</p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id325373"></a>Features and Benefits</h2></div></div></div><p> 18Two men were walking down a dusty road, when one suddenly kicked up a small red stone. It 19hurt his toe and lodged in his sandal. He took the stone out and cursed it with a passion 20and fury befitting his anguish. The other looked at the stone and said, “<span class="quote">This is a garnet. 21I can turn that into a precious gem and some day it will make a princess very happy!</span>” 22</p><p> 23The moral of this tale: Two men, two very different perspectives regarding the same stone. 24Like it or not, Samba is like that stone. Treat it the right way and it can bring great 25pleasure, but if you are forced to use it and have no time for its secrets, then it can be 26a source of discomfort. 27</p><p> 28<a class="indexterm" name="id325396"></a> 29<a class="indexterm" name="id325405"></a> 30Samba started out as a project that sought to provide interoperability for MS Windows 3.x 31clients with a UNIX server. It has grown up a lot since its humble beginnings and now provides 32features and functionality fit for large-scale deployment. It also has some warts. In sections 33like this one, we tell of both. 34</p><p> 35So, what are the benefits of the features mentioned in this chapter? 36</p><div class="itemizedlist"><ul type="disc"><li><p> 37 <a class="indexterm" name="id325425"></a> 38 Samba-3 can replace an MS Windows NT4 domain controller. 39 </p></li><li><p> 40 <a class="indexterm" name="id325439"></a> 41 Samba-3 offers excellent interoperability with MS Windows NT4-style 42 domains as well as natively with Microsoft Active Directory domains. 43 </p></li><li><p> 44 <a class="indexterm" name="id325452"></a> 45 Samba-3 permits full NT4-style interdomain trusts. 46 </p></li><li><p> 47 <a class="indexterm" name="id325466"></a> 48 <a class="indexterm" name="id325473"></a> 49 Samba has security modes that permit more flexible authentication 50 than is possible with MS Windows NT4 domain controllers. 51 </p></li><li><p> 52 <a class="indexterm" name="id325487"></a> 53 <a class="indexterm" name="id325499"></a> 54 Samba-3 permits use of multiple concurrent account database backends. 55 (Encrypted passwords that are stored in the account database are in 56 formats that are unique to Windows networking). 57 </p></li><li><p> 58 <a class="indexterm" name="id325512"></a> 59 The account database backends can be distributed 60 and replicated using multiple methods. This gives Samba-3 61 greater flexibility than MS Windows NT4 and in many cases a 62 significantly higher utility than Active Directory domains 63 with MS Windows 200x. 64 </p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id325524"></a>Server Types</h2></div></div></div><p> 65<a class="indexterm" name="id325532"></a> 66Administrators of Microsoft networks often refer to three different types of servers: 67</p><div class="itemizedlist"><ul type="disc"><li><p>Domain Controller</p><div class="itemizedlist"><ul type="circle"><li><p>Primary Domain Controller (PDC)</p></li><li><p>Backup Domain Controller (BDC)</p></li><li><p>ADS Domain Controller</p></li></ul></div></li><li><p>Domain Member Server</p><div class="itemizedlist"><ul type="circle"><li><p>Active Directory Domain Server</p></li><li><p>NT4 Style Domain Domain Server</p></li></ul></div></li><li><p>Standalone Server</p></li></ul></div><p> 68<a class="indexterm" name="id325591"></a> 69<a class="indexterm" name="id325600"></a> 70<a class="indexterm" name="id325609"></a> 71<a class="indexterm" name="id325619"></a> 72The chapters covering domain control (<a href="samba-pdc.html" title="Chapter�4.�Domain Control">Domain Control</a>), 73backup domain control (<a href="samba-bdc.html" title="Chapter�5.�Backup Domain Control">Backup Domain Control</a>), and 74domain membership (<a href="domain-member.html" title="Chapter�6.�Domain Membership">Domain Membership</a>) provide 75pertinent information regarding Samba configuration for each of these server roles. 76You are strongly encouraged to become intimately familiar with these chapters because 77they lay the foundation for deployment of Samba domain security. 78</p><p> 79<a class="indexterm" name="id325654"></a> 80A Standalone server is autonomous in respect of the source of its account backend. 81Refer to <a href="StandAloneServer.html" title="Chapter�7.�Standalone Servers">Standalone Servers</a> to gain a wider appreciation 82of what is meant by a server being configured as a <span class="emphasis"><em>standalone</em></span> server. 83</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id325675"></a>Samba Security Modes</h2></div></div></div><p> 84<a class="indexterm" name="id325683"></a> 85<a class="indexterm" name="id325690"></a> 86In this section, the function and purpose of Samba's security modes are described. An accurate understanding of 87how Samba implements each security mode as well as how to configure MS Windows clients for each mode will 88significantly reduce user complaints and administrator heartache. 89</p><p> 90<a class="indexterm" name="id325702"></a> 91<a class="indexterm" name="id325711"></a> 92Microsoft Windows networking uses a protocol that was originally called the Server Message Block (SMB) 93protocol. Since some time around 1996 the protocol has been better known as the Common Internet Filesystem 94(CIFS) protocol. 95</p><p> 96<a class="indexterm" name="id325726"></a> 97<a class="indexterm" name="id325733"></a> 98<a class="indexterm" name="id325740"></a> 99<a class="indexterm" name="id325746"></a> 100In the SMB/CIFS networking world, there are only two types of security: <span class="emphasis"><em>user-level</em></span> and 101<span class="emphasis"><em>share level</em></span>. We refer to these collectively as <span class="emphasis"><em>security levels</em></span>. In 102implementing these two security levels, Samba provides flexibilities that are not available with MS Windows 103NT4/200x servers. In fact, Samba implements <span class="emphasis"><em>share-level</em></span> security only one way, but has 104four ways of implementing <span class="emphasis"><em>user-level</em></span> security. Collectively, we call the Samba 105implementations of the security levels <span class="emphasis"><em>security modes</em></span>. They are known as 106<span class="emphasis"><em>share</em></span>, <span class="emphasis"><em>user</em></span>, <span class="emphasis"><em>domain</em></span>, <span class="emphasis"><em>ADS</em></span>, 107and <span class="emphasis"><em>server</em></span> modes. They are documented in this chapter. 108</p><p> 109An SMB server informs the client, at the time of a session setup, the security level the server is running. 110There are two options: share-level and user-level. Which of these two the client receives affects the way the 111client then tries to authenticate itself. It does not directly affect (to any great extent) the way the Samba 112server does security. This may sound strange, but it fits in with the client/server approach of SMB. In SMB 113everything is initiated and controlled by the client, and the server can only tell the client what is 114available and whether an action is allowed. 115</p><p> 116The term <code class="literal">client</code> refers to all agents whether it is a Windows workstation, a Windows server, 117another Samba server, or any vanilla SMB or CIFS client application (e.g., <code class="literal">smbclient</code>) that 118make use of services provided by an SMB/CIFS server. 119</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id325823"></a>User Level Security</h3></div></div></div><p> 120<a class="indexterm" name="id325831"></a> 121We describe user-level security first because its simpler. In user-level security, the client sends a session 122setup request directly following protocol negotiation. This request provides a username and password. The 123server can either accept or reject that username/password combination. At this stage the server has no idea 124what share the client will eventually try to connect to, so it can't base the 125<span class="emphasis"><em>accept/reject</em></span> on anything other than: 126</p><div class="orderedlist"><ol type="1"><li><p>the username/password.</p></li><li><p>the name of the client machine.</p></li></ol></div><p> 127<a class="indexterm" name="id325865"></a> 128If the server accepts the username/password credentials, the client expects to be able to mount shares (using 129a <span class="emphasis"><em>tree connection</em></span>) without further specifying a password. It expects that all access 130rights will be as the username/password credentials set that was specified in the initial <span class="emphasis"><em>session 131setup</em></span>. 132</p><p> 133<a class="indexterm" name="id325884"></a> 134It is also possible for a client to send multiple <span class="emphasis"><em>session setup</em></span> 135requests. When the server responds, it gives the client a <span class="emphasis"><em>uid</em></span> to use 136as an authentication tag for that username/password. The client can maintain multiple 137authentication contexts in this way (WinDD is an example of an application that does this). 138</p><p> 139<a class="indexterm" name="id325904"></a> 140<a class="indexterm" name="id325911"></a> 141<a class="indexterm" name="id325918"></a> 142<a class="indexterm" name="id325925"></a> 143<a class="indexterm" name="id325931"></a> 144Windows networking user account names are case-insensitive, meaning that upper-case and lower-case characters 145in the account name are considered equivalent. They are said to be case-preserving, but not case significant. 146Windows and LanManager systems previous to Windows NT version 3.10 have case-insensitive passwords that were 147not necessarilty case-preserving. All Windows NT family systems treat passwords as case-preserving and 148case-sensitive. 149</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id325943"></a>Example Configuration</h4></div></div></div><p> 150The <code class="filename">smb.conf</code> parameter that sets user-level security is: 151</p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id325965"></a><em class="parameter"><code>security = user</code></em></td></tr></table><p> 152This is the default setting since Samba-2.2.x. 153</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id325983"></a>Share-Level Security</h3></div></div></div><p> 154<a class="indexterm" name="id325991"></a> 155<a class="indexterm" name="id325998"></a> 156In share-level security, the client authenticates itself separately for each share. It sends a password along 157with each tree connection request (share mount), but it does not explicitly send a username with this 158operation. The client expects a password to be associated with each share, independent of the user. This means 159that Samba has to work out what username the client probably wants to use, the SMB server is not explicitly 160sent the username. Some commercial SMB servers such as NT actually associate passwords directly with shares 161in share-level security, but Samba always uses the UNIX authentication scheme where it is a username/password 162pair that is authenticated, not a share/password pair. 163</p><p> 164To understand the MS Windows networking parallels, think in terms of MS Windows 9x/Me where you can create a 165shared folder that provides read-only or full access, with or without a password. 166</p><p> 167Many clients send a session setup request even if the server is in share-level security. They normally send a valid 168username but no password. Samba records this username in a list of possible usernames. When the client then 169issues a tree connection request, it also adds to this list the name of the share they try to connect to (useful for 170home directories) and any users listed in the <a class="indexterm" name="id326022"></a>user parameter in the <code class="filename">smb.conf</code> file. 171The password is then checked in turn against these possible usernames. If a match is found, then the client is 172authenticated as that user. 173</p><p> 174<a class="indexterm" name="id326040"></a> 175<a class="indexterm" name="id326048"></a> 176<a class="indexterm" name="id326055"></a> 177Where the list of possible user names is not provided, Samba makes a UNIX system call to find the user 178account that has a password that matches the one provided from the standard account database. On a system that 179has no name service switch (NSS) facility, such lookups will be from the <code class="filename">/etc/passwd</code> 180database. On NSS enabled systems, the lookup will go to the libraries that have been specified in the 181<code class="filename">nsswitch.conf</code> file. The entries in that file in which the libraries are specified are: 182</p><pre class="screen"> 183passwd: files nis ldap 184shadow: files nis ldap 185group: files nis ldap 186</pre><p> 187<a class="indexterm" name="id326084"></a> 188<a class="indexterm" name="id326091"></a> 189<a class="indexterm" name="id326098"></a> 190In the example shown here (not likely to be used in practice) the lookup will check 191<code class="filename">/etc/passwd</code> and <code class="filename">/etc/group</code>, if not found it will check NIS, then 192LDAP. 193</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id326118"></a>Example Configuration</h4></div></div></div><p> 194The <code class="filename">smb.conf</code> parameter that sets share-level security is: 195</p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id326140"></a><em class="parameter"><code>security = share</code></em></td></tr></table></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id326155"></a>Domain Security Mode (User-Level Security)</h3></div></div></div><p> 196<a class="indexterm" name="id326163"></a> 197<a class="indexterm" name="id326172"></a> 198<a class="indexterm" name="id326181"></a> 199<a class="indexterm" name="id326188"></a> 200<a class="indexterm" name="id326194"></a> 201<a class="indexterm" name="id326201"></a> 202Domain security provides a mechanism for storing all user and group accounts in a central, shared, account 203repository. The centralized account repository is shared between domain (security) controllers. Servers that 204act as domain controllers provide authentication and validation services to all machines that participate in 205the security context for the domain. A primary domain controller (PDC) is a server that is responsible for 206maintaining the integrity of the security account database. Backup domain controllers (BDCs) provide only domain 207logon and authentication services. Usually, BDCs will answer network logon requests more responsively than 208will a PDC. 209</p><p> 210<a class="indexterm" name="id326217"></a> 211<a class="indexterm" name="id326224"></a> 212<a class="indexterm" name="id326231"></a> 213<a class="indexterm" name="id326240"></a> 214<a class="indexterm" name="id326249"></a> 215When Samba is operating in <a class="indexterm" name="id326259"></a>security = domain mode, the Samba server has a 216domain security trust account (a machine account) and causes all authentication requests to be passed through 217to the domain controllers. In other words, this configuration makes the Samba server a domain member server, 218even when it is in fact acting as a domain controller. All machines that participate in domain security must 219have a machine account in the security database. 220</p><p> 221<a class="indexterm" name="id326276"></a> 222<a class="indexterm" name="id326285"></a> 223<a class="indexterm" name="id326294"></a> 224<a class="indexterm" name="id326303"></a> 225Within the domain security environment, the underlying security architecture uses user-level security. Even 226machines that are domain members must authenticate on startup. The machine account consists of an account 227entry in the accounts database, the name of which is the NetBIOS name of the machine and of which the password 228is randomly generated and known to both the domain controllers and the member machine. If the machine account 229cannot be validated during startup, users will not be able to log on to the domain using this machine because 230it cannot be trusted. The machine account is referred to as a machine trust account. 231</p><p> 232There are three possible domain member configurations: 233</p><div class="orderedlist"><ol type="1"><li><p>Primary domain controller (PDC) - of which there is one per domain.</p></li><li><p>Backup domain controller (BDC) - of which there can be any number per domain.</p></li><li><p>Domain member server (DMS) - of which there can be any number per domain.</p></li></ol></div><p> 234<a class="indexterm" name="id326345"></a> 235We will discuss each of these in separate chapters. For now, we are most interested in basic DMS 236configuration. 237</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id326354"></a>Example Configuration</h4></div></div></div><p><span class="emphasis"><em> 238Samba as a Domain Member Server 239</em></span></p><p> 240<a class="indexterm" name="id326366"></a> 241This method involves addition of the following parameters in the <code class="filename">smb.conf</code> file: 242</p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id326388"></a><em class="parameter"><code>security = domain</code></em></td></tr><tr><td><a class="indexterm" name="id326400"></a><em class="parameter"><code>workgroup = MIDEARTH</code></em></td></tr></table><p> 243</p><p> 244In order for this method to work, the Samba server needs to join the MS Windows NT 245security domain. This is done as follows: 246<a class="indexterm" name="id326417"></a> 247<a class="indexterm" name="id326426"></a> 248</p><div class="procedure"><ol type="1"><li><p>On the MS Windows NT domain controller, using 249 the Server Manager, add a machine account for the Samba server. 250 </p></li><li><p>On the UNIX/Linux system execute:</p><pre class="screen"><code class="prompt">root# </code><strong class="userinput"><code>net rpc join -U administrator%password</code></strong></pre></li></ol></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 251<a class="indexterm" name="id326474"></a> 252Samba-2.2.4 and later Samba 2.2.x series releases can autojoin a Windows NT4-style domain just by executing: 253</p><pre class="screen"> 254<code class="prompt">root# </code><strong class="userinput"><code>smbpasswd -j <em class="replaceable"><code>DOMAIN_NAME</code></em> -r <em class="replaceable"><code>PDC_NAME</code></em> \ 255 -U Administrator%<em class="replaceable"><code>password</code></em></code></strong> 256</pre><p> 257<a class="indexterm" name="id326507"></a> 258Samba-3 can do the same by executing: 259</p><pre class="screen"> 260<code class="prompt">root# </code><strong class="userinput"><code>net rpc join -U Administrator%<em class="replaceable"><code>password</code></em></code></strong> 261</pre><p> 262It is not necessary with Samba-3 to specify the <em class="replaceable"><code>DOMAIN_NAME</code></em> or the 263<em class="replaceable"><code>PDC_NAME</code></em>, as it figures this out from the <code class="filename">smb.conf</code> file settings. 264</p></div><p> 265<a class="indexterm" name="id326554"></a> 266<a class="indexterm" name="id326561"></a> 267<a class="indexterm" name="id326568"></a> 268Use of this mode of authentication requires there to be a standard UNIX account for each user in order to 269assign a UID once the account has been authenticated by the Windows domain controller. This account can be 270blocked to prevent logons by clients other than MS Windows through means such as setting an invalid shell in 271the <code class="filename">/etc/passwd</code> entry. The best way to allocate an invalid shell to a user account is to 272set the shell to the file <code class="filename">/bin/false</code>. 273</p><p> 274<a class="indexterm" name="id326593"></a> 275<a class="indexterm" name="id326600"></a> 276Domain controllers can be located anywhere that is convenient. The best advice is to have a BDC on every 277physical network segment, and if the PDC is on a remote network segment the use of WINS (see <a href="NetworkBrowsing.html" title="Chapter�10.�Network Browsing">Network Browsing</a> for more information) is almost essential. 278</p><p> 279An alternative to assigning UIDs to Windows users on a Samba member server is presented in <a href="winbind.html" title="Chapter�24.�Winbind: Use of Domain Accounts">Winbind</a>, <a href="winbind.html" title="Chapter�24.�Winbind: Use of Domain Accounts">Winbind: Use of Domain Accounts</a>. 280</p><p> 281For more information regarding domain membership, <a href="domain-member.html" title="Chapter�6.�Domain Membership">Domain Membership</a>. 282</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id326646"></a>ADS Security Mode (User-Level Security)</h3></div></div></div><p> 283<a class="indexterm" name="id326654"></a> 284<a class="indexterm" name="id326661"></a> 285Both Samba-2.2, and Samba-3 can join an Active Directory domain using NT4 style RPC based security. This is 286possible if the domain is run in native mode. Active Directory in native mode perfectly allows NT4-style 287domain members. This is contrary to popular belief. 288</p><p> 289If you are using Active Directory, starting with Samba-3 you can join as a native AD member. Why would you 290want to do that? Your security policy might prohibit the use of NT-compatible authentication protocols. All 291your machines are running Windows 2000 and above and all use Kerberos. In this case, Samba, as an NT4-style 292domain, would still require NT-compatible authentication data. Samba in AD-member mode can accept Kerberos 293tickets. 294</p><p> 295<a class="indexterm" name="id326680"></a> 296<a class="indexterm" name="id326687"></a> 297Sites that use Microsoft Windows active directory services (ADS) should be aware of the significance of the 298terms: <code class="literal">native mode</code> and <code class="literal">mixed mode</code> ADS operation. The term 299<code class="literal">realm</code> is used to describe a Kerberos-based security architecture (such as is used by 300Microsoft ADS). 301</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id326715"></a>Example Configuration</h4></div></div></div><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id326727"></a><em class="parameter"><code>realm = your.kerberos.REALM</code></em></td></tr><tr><td><a class="indexterm" name="id326740"></a><em class="parameter"><code>security = ADS</code></em></td></tr></table><p> 302The following parameter may be required: 303</p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id326762"></a><em class="parameter"><code>password server = your.kerberos.server</code></em></td></tr></table><p> 304Please refer to <a href="domain-member.html" title="Chapter�6.�Domain Membership">Domain Membership</a>, and <a href="domain-member.html#ads-member" title="Samba ADS Domain Membership">Samba 305ADS Domain Membership</a> for more information regarding this configuration option. 306</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id326797"></a>Server Security (User Level Security)</h3></div></div></div><p> 307Server security mode is left over from the time when Samba was not capable of acting 308as a domain member server. It is highly recommended not to use this feature. Server 309security mode has many drawbacks that include: 310</p><div class="itemizedlist"><ul type="disc"><li><p>Potential account lockout on MS Windows NT4/200x password servers.</p></li><li><p>Lack of assurance that the password server is the one specified.</p></li><li><p>Does not work with Winbind, which is particularly needed when storing profiles remotely.</p></li><li><p>This mode may open connections to the password server and keep them open for extended periods.</p></li><li><p>Security on the Samba server breaks badly when the remote password server suddenly shuts down.</p></li><li><p>With this mode there is NO security account in the domain that the password server belongs to for the Samba server.</p></li></ul></div><p> 311<a class="indexterm" name="id326844"></a> 312<a class="indexterm" name="id326850"></a> 313In server security mode the Samba server reports to the client that it is in user-level security. The client 314then does a session setup as described earlier. The Samba server takes the username/password that the client 315sends and attempts to log into the <a class="indexterm" name="id326859"></a>password server by sending exactly the same 316username/password that it got from the client. If that server is in user-level security and accepts the 317password, then Samba accepts the client's connection. This parameter allows the Samba server to use another 318SMB server as the <a class="indexterm" name="id326868"></a>password server. 319</p><p> 320<a class="indexterm" name="id326878"></a> 321<a class="indexterm" name="id326885"></a> 322You should also note that at the start of all this, when the server tells the client 323what security level it is in, it also tells the client if it supports encryption. If it 324does, it supplies the client with a random cryptkey. The client will then send all 325passwords in encrypted form. Samba supports this type of encryption by default. 326</p><p> 327The parameter <a class="indexterm" name="id326898"></a>security = server means that Samba reports to clients that 328it is running in <span class="emphasis"><em>user mode</em></span> but actually passes off all authentication requests to another 329user mode server. This requires an additional parameter <a class="indexterm" name="id326911"></a>password server that points to 330the real authentication server. The real authentication server can be another Samba server, or it can be a 331Windows NT server, the latter being natively capable of encrypted password support. 332</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 333<a class="indexterm" name="id326924"></a> 334<a class="indexterm" name="id326931"></a> 335When Samba is running in <span class="emphasis"><em>server security mode</em></span>, it is essential that the parameter 336<span class="emphasis"><em>password server</em></span> is set to the precise NetBIOS machine name of the target authentication 337server. Samba cannot determine this from NetBIOS name lookups because the choice of the target authentication 338server is arbitrary and cannot be determined from a domain name. In essence, a Samba server that is in 339<span class="emphasis"><em>server security mode</em></span> is operating in what used to be known as workgroup mode. 340</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id326953"></a>Example Configuration</h4></div></div></div><p><span class="emphasis"><em> 341Using MS Windows NT as an Authentication Server 342</em></span></p><p> 343This method involves the additions of the following parameters in the <code class="filename">smb.conf</code> file: 344</p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id326980"></a><em class="parameter"><code>encrypt passwords = Yes</code></em></td></tr><tr><td><a class="indexterm" name="id326992"></a><em class="parameter"><code>security = server</code></em></td></tr><tr><td><a class="indexterm" name="id327005"></a><em class="parameter"><code>password server = "NetBIOS_name_of_a_DC"</code></em></td></tr></table><p> 345There are two ways of identifying whether or not a username and password pair is valid. 346One uses the reply information provided as part of the authentication messaging 347process, the other uses just an error code. 348</p><p> 349<a class="indexterm" name="id327025"></a> 350<a class="indexterm" name="id327032"></a> 351The downside of this mode of configuration is that for security reasons Samba 352will send the password server a bogus username and a bogus password, and if the remote 353server fails to reject the bogus username and password pair, then an alternative mode of 354identification or validation is used. Where a site uses password lockout, after a 355certain number of failed authentication attempts, this will result in user lockouts. 356</p><p> 357Use of this mode of authentication requires a standard UNIX account for the user. 358This account can be blocked to prevent logons by non-SMB/CIFS clients. 359</p></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id327051"></a>Password Checking</h2></div></div></div><p> 360MS Windows clients may use encrypted passwords as part of a challenge/response 361authentication model (a.k.a. NTLMv1 and NTLMv2) or alone, or clear-text strings for simple 362password-based authentication. It should be realized that with the SMB protocol, 363the password is passed over the network either in plaintext or encrypted, but 364not both in the same authentication request. 365</p><p> 366<a class="indexterm" name="id327065"></a> 367<a class="indexterm" name="id327072"></a> 368When encrypted passwords are used, a password that has been entered by the user 369is encrypted in two ways: 370</p><div class="itemizedlist"><ul type="disc"><li><p>An MD4 hash of the unicode of the password 371 string. This is known as the NT hash. 372 </p></li><li><p>The password is converted to uppercase, 373 and then padded or truncated to 14 bytes. This string is 374 then appended with 5 bytes of NULL characters and split to 375 form two 56-bit DES keys to encrypt a "magic" 8-byte value. 376 The resulting 16 bytes form the LanMan hash. 377 </p></li></ul></div><p> 378<a class="indexterm" name="id327098"></a> 379MS Windows 95 pre-service pack 1 and MS Windows NT versions 3.x and version 4.0 pre-service pack 3 will use 380either mode of password authentication. All versions of MS Windows that follow these versions no longer 381support plain-text passwords by default. 382</p><p> 383<a class="indexterm" name="id327113"></a> 384MS Windows clients have a habit of dropping network mappings that have been idle 385for 10 minutes or longer. When the user attempts to use the mapped drive 386connection that has been dropped, the client re-establishes the connection using 387a cached copy of the password. 388</p><p> 389When Microsoft changed the default password mode, support was dropped for caching 390of the plaintext password. This means that when the registry parameter is changed 391to re-enable use of plaintext passwords, it appears to work, but when a dropped 392service connection mapping attempts to revalidate, this will fail if the remote 393authentication server does not support encrypted passwords. It is definitely not 394a good idea to re-enable plaintext password support in such clients. 395</p><p> 396The following parameters can be used to work around the issue of Windows 9x/Me clients 397uppercasing usernames and passwords before transmitting them to the SMB server 398when using clear-text authentication: 399</p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id327146"></a><em class="parameter"><code>password level</code></em></td></tr><tr><td><a class="indexterm" name="id327158"></a><em class="parameter"><code>username level</code></em></td></tr></table><p> 400By default Samba will convert to lowercase the username before attempting to lookup the user 401in the database of local system accounts. Because UNIX usernames conventionally 402only contain lowercase characters, the <a class="indexterm" name="id327175"></a>username-level parameter 403is rarely needed. 404</p><p> 405<a class="indexterm" name="id327185"></a> 406However, passwords on UNIX systems often make use of mixed-case characters. This means that in order for a 407user on a Windows 9x/Me client to connect to a Samba server using clear-text authentication, the 408<a class="indexterm" name="id327194"></a>password level must be set to the maximum number of uppercase letters that 409<span class="emphasis"><em>could</em></span> appear in a password. Note that if the Server OS uses the traditional DES version 410of crypt(), a <a class="indexterm" name="id327206"></a>password level of 8 will result in case-insensitive passwords as seen 411from Windows users. This will also result in longer login times because Samba has to compute the permutations 412of the password string and try them one by one until a match is located (or all combinations fail). 413</p><p> 414The best option to adopt is to enable support for encrypted passwords wherever 415Samba is used. Most attempts to apply the registry change to re-enable plaintext 416passwords will eventually lead to user complaints and unhappiness. 417</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id327223"></a>Common Errors</h2></div></div></div><p> 418We all make mistakes. It is okay to make mistakes, as long as they are made in the right places 419and at the right time. A mistake that causes lost productivity is seldom tolerated; however, a mistake 420made in a developmental test lab is expected. 421</p><p> 422Here we look at common mistakes and misapprehensions that have been the subject of discussions 423on the Samba mailing lists. Many of these are avoidable by doing your homework before attempting 424a Samba implementation. Some are the result of a misunderstanding of the English language, 425which has many phrases that are potentially vague and may be highly confusing 426to those for whom English is not their native tongue. 427</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id327240"></a>What Makes Samba a Server?</h3></div></div></div><p> 428To some, the nature of the Samba security mode is obvious, but entirely 429wrong all the same. It is assumed that <a class="indexterm" name="id327249"></a>security = server means that Samba 430will act as a server. Not so! This setting means that Samba will <span class="emphasis"><em>try</em></span> 431to use another SMB server as its source for user authentication alone. 432</p><p> 433Samba is a server regardless of which security mode is chosen. When Samba is used outside of a domain security 434context, it is best to leave the security mode at the default setting. By default Samba-3 uses user-mode 435security. 436</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id327269"></a>What Makes Samba a Domain Controller?</h3></div></div></div><p> 437<a class="indexterm" name="id327277"></a> 438The <code class="filename">smb.conf</code> parameter <a class="indexterm" name="id327290"></a>security = domain does not really make Samba behave 439as a domain controller. This setting means we want Samba to be a domain member. See <a href="samba-pdc.html" title="Chapter�4.�Domain Control">Samba as a PDC</a> for more information. 440</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id327307"></a>What Makes Samba a Domain Member?</h3></div></div></div><p> 441Guess! So many others do. But whatever you do, do not think that <a class="indexterm" name="id327315"></a>security = user 442makes Samba act as a domain member. Read the manufacturer's manual before the warranty expires. See 443<a href="domain-member.html" title="Chapter�6.�Domain Membership">Domain Membership</a>, for more information. 444</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id327332"></a>Constantly Losing Connections to Password Server</h3></div></div></div><p>“<span class="quote"> 445Why does server_validate() simply give up rather than re-establish its connection to the 446password server? Though I am not fluent in the SMB protocol, perhaps the cluster server 447process passes along to its client workstation the session key it receives from the password 448server, which means the password hashes submitted by the client would not work on a subsequent 449connection whose session key would be different. So server_validate() must give up. 450</span>”</p><p> 451Indeed. That's why <a class="indexterm" name="id327349"></a>security = server 452is at best a nasty hack. Please use <a class="indexterm" name="id327356"></a>security = domain; 453<a class="indexterm" name="id327363"></a>security = server mode is also known as pass-through authentication. 454</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id327373"></a>Stand-alone Server is converted to Domain Controller Now User accounts don't work</h3></div></div></div><p>“<span class="quote"> 455When I try to log in to the DOMAIN, the eventlog shows <span class="emphasis"><em>tried credentials DOMAIN/username; effective 456credentials SERVER/username</em></span> 457</span>”</p><p> 458Usually this is due to a user or machine account being created before the Samba server is configured to be a 459domain controller. Accounts created before the server becomes a domain controller will be 460<span class="emphasis"><em>local</em></span> accounts and authenticated as what looks like a member in the SERVER domain, much 461like local user accounts in Windows 2000 and later. Accounts created after the Samba server becomes a domain 462controller will be <span class="emphasis"><em>domain</em></span> accounts and will be authenticated as a member of the DOMAIN 463domain. 464</p><p> 465This can be verified by issuing the command <code class="literal">pdbedit -L -v username</code>. If this reports DOMAIN 466then the account is a domain account, if it reports SERVER then the account is a local account. 467</p><p> 468The easiest way to resolve this is to remove and recreate the account; however this may cause problems with 469established user profiles. You can also use <code class="literal">pdbedit -u username -I DOMAIN</code>. You may also 470need to change the User SID and Primary Group SID to match the domain. 471</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="type.html">Prev</a>�</td><td width="20%" align="center"><a accesskey="u" href="type.html">Up</a></td><td width="40%" align="right">�<a accesskey="n" href="samba-pdc.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part�II.�Server Configuration Basics�</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">�Chapter�4.�Domain Control</td></tr></table></div></body></html> 472