1 <chapter id="domain-security">
5 <firstname>Jeremy</firstname><surname>Allison</surname>
7 <orgname>Samba Team</orgname>
9 <email>samba@samba.org</email>
14 <firstname>Jerry</firstname><surname>Carter</surname>
16 <orgname>Samba Team</orgname>
18 <email>jerry@samba.org</email>
24 <pubdate>16 Apr 2001</pubdate>
28 <title>Samba as a NT4 or Win2k domain member</title>
32 <title>Joining an NT Domain with Samba 3.0</title>
34 <para>Assume you have a Samba 3.0 server with a NetBIOS name of
35 <constant>SERV1</constant> and are joining an or Win2k NT domain called
36 <constant>DOM</constant>, which has a PDC with a NetBIOS name
37 of <constant>DOMPDC</constant> and two backup domain controllers
38 with NetBIOS names <constant>DOMBDC1</constant> and <constant>DOMBDC2
41 <para>Firstly, you must edit your <ulink url="smb.conf.5.html"><filename>smb.conf(5)</filename>
42 </ulink> file to tell Samba it should now use domain security.</para>
44 <para>Change (or add) your <ulink url="smb.conf.5.html#SECURITY">
45 <parameter>security =</parameter></ulink> line in the [global] section
46 of your smb.conf to read:</para>
48 <para><command>security = domain</command> or
49 <command>security = ads</command> depending on if the PDC is
50 NT4 or running Active Directory respectivly.</para>
52 <para>Next change the <ulink url="smb.conf.5.html#WORKGROUP"><parameter>
53 workgroup =</parameter></ulink> line in the [global] section to read: </para>
55 <para><command>workgroup = DOM</command></para>
57 <para>as this is the name of the domain we are joining. </para>
59 <para>You must also have the parameter <ulink url="smb.conf.5.html#ENCRYPTPASSWORDS">
60 <parameter>encrypt passwords</parameter></ulink> set to <constant>yes
61 </constant> in order for your users to authenticate to the NT PDC.</para>
63 <para>Finally, add (or modify) a <ulink url="smb.conf.5.html#PASSWORDSERVER">
64 <parameter>password server =</parameter></ulink> line in the [global]
65 section to read: </para>
67 <para><command>password server = DOMPDC DOMBDC1 DOMBDC2</command></para>
69 <para>These are the primary and backup domain controllers Samba
70 will attempt to contact in order to authenticate users. Samba will
71 try to contact each of these servers in order, so you may want to
72 rearrange this list in order to spread out the authentication load
73 among domain controllers.</para>
75 <para>Alternatively, if you want smbd to automatically determine
76 the list of Domain controllers to use for authentication, you may
77 set this line to be :</para>
79 <para><command>password server = *</command></para>
81 <para>This method, allows Samba to use exactly the same
82 mechanism that NT does. This
83 method either broadcasts or uses a WINS database in order to
84 find domain controllers to authenticate against.</para>
86 <para>In order to actually join the domain, you must run this
89 <para><prompt>root# </prompt><userinput>net join -S DOMPDC
90 -U<replaceable>Administrator%password</replaceable></userinput></para>
92 <para>as we are joining the domain DOM and the PDC for that domain
93 (the only machine that has write access to the domain SAM database)
94 is DOMPDC. The <replaceable>Administrator%password</replaceable> is
95 the login name and password for an account which has the necessary
96 privilege to add machines to the domain. If this is successful
97 you will see the message:</para>
99 <para><computeroutput>Joined domain DOM.</computeroutput>
100 or <computeroutput>Joined 'SERV1' to realm 'MYREALM'</computeroutput>
103 <para>in your terminal window. See the <ulink url="net.8.html">
104 net(8)</ulink> man page for more details.</para>
106 <para>This process joins the server to thedomain
107 without having to create the machine trust account on the PDC
110 <para>This command goes through the machine account password
111 change protocol, then writes the new (random) machine account
112 password for this Samba server into a file in the same directory
113 in which an smbpasswd file would be stored - normally :</para>
115 <para><filename>/usr/local/samba/private/secrets.tdb</filename></para>
117 <para>This file is created and owned by root and is not
118 readable by any other user. It is the key to the domain-level
119 security for your system, and should be treated as carefully
120 as a shadow password file.</para>
122 <para>Finally, restart your Samba daemons and get ready for
123 clients to begin using domain security!</para>
127 <title>Samba and Windows 2000 Domains</title>
128 <!-- FIXME: this section is partly obsoleted - jelmer@samba.org -->
131 Many people have asked regarding the state of Samba's ability to participate in
132 a Windows 2000 Domain. Samba 3.0 is able to act as a member server of a Windows
133 2000 domain operating in mixed or native mode. The steps above apply
134 to both NT4 and Windows 2000.
140 <title>Why is this better than security = server?</title>
142 <para>Currently, domain security in Samba doesn't free you from
143 having to create local Unix users to represent the users attaching
144 to your server. This means that if domain user <constant>DOM\fred
145 </constant> attaches to your domain security Samba server, there needs
146 to be a local Unix user fred to represent that user in the Unix
147 filesystem. This is very similar to the older Samba security mode
148 <ulink url="smb.conf.5.html#SECURITYEQUALSSERVER">security = server</ulink>,
149 where Samba would pass through the authentication request to a Windows
150 NT server in the same way as a Windows 95 or Windows 98 server would.
153 <para>Please refer to the <ulink url="winbind.html">Winbind
154 paper</ulink> for information on a system to automatically
155 assign UNIX uids and gids to Windows NT Domain users and groups.
156 This code is available in development branches only at the moment,
157 but will be moved to release branches soon.</para>
159 <para>The advantage to domain-level security is that the
160 authentication in domain-level security is passed down the authenticated
161 RPC channel in exactly the same way that an NT server would do it. This
162 means Samba servers now participate in domain trust relationships in
163 exactly the same way NT servers do (i.e., you can add Samba servers into
164 a resource domain and have the authentication passed on from a resource
165 domain PDC to an account domain PDC.</para>
167 <para>In addition, with <command>security = server</command> every Samba
168 daemon on a server has to keep a connection open to the
169 authenticating server for as long as that daemon lasts. This can drain
170 the connection resources on a Microsoft NT server and cause it to run
171 out of available connections. With <command>security = domain</command>,
172 however, the Samba daemons connect to the PDC/BDC only for as long
173 as is necessary to authenticate the user, and then drop the connection,
174 thus conserving PDC connection resources.</para>
176 <para>And finally, acting in the same manner as an NT server
177 authenticating to a PDC means that as part of the authentication
178 reply, the Samba server gets the user identification information such
179 as the user SID, the list of NT groups the user belongs to, etc. </para>
181 <para><emphasis>NOTE:</emphasis> Much of the text of this document
182 was first published in the Web magazine <ulink url="http://www.linuxworld.com">
183 LinuxWorld</ulink> as the article <ulink
184 url="http://www.linuxworld.com/linuxworld/lw-1998-10/lw-10-samba.html">Doing
185 the NIS/NT Samba</ulink>.</para>