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></para>
50 <para>Next change the <ulink url="smb.conf.5.html#WORKGROUP"><parameter>
51 workgroup =</parameter></ulink> line in the [global] section to read: </para>
53 <para><command>workgroup = DOM</command></para>
55 <para>as this is the name of the domain we are joining. </para>
57 <para>You must also have the parameter <ulink url="smb.conf.5.html#ENCRYPTPASSWORDS">
58 <parameter>encrypt passwords</parameter></ulink> set to <constant>yes
59 </constant> in order for your users to authenticate to the NT PDC.</para>
61 <para>Finally, add (or modify) a <ulink url="smb.conf.5.html#PASSWORDSERVER">
62 <parameter>password server =</parameter></ulink> line in the [global]
63 section to read: </para>
65 <para><command>password server = DOMPDC DOMBDC1 DOMBDC2</command></para>
67 <para>These are the primary and backup domain controllers Samba
68 will attempt to contact in order to authenticate users. Samba will
69 try to contact each of these servers in order, so you may want to
70 rearrange this list in order to spread out the authentication load
71 among domain controllers.</para>
73 <para>Alternatively, if you want smbd to automatically determine
74 the list of Domain controllers to use for authentication, you may
75 set this line to be :</para>
77 <para><command>password server = *</command></para>
79 <para>This method, allows Samba to use exactly the same
80 mechanism that NT does. This
81 method either broadcasts or uses a WINS database in order to
82 find domain controllers to authenticate against.</para>
84 <para>In order to actually join the domain, you must run this
87 <para><prompt>root# </prompt><userinput>net rpc join -S DOMPDC
88 -U<replaceable>Administrator%password</replaceable></userinput></para>
90 <para>as we are joining the domain DOM and the PDC for that domain
91 (the only machine that has write access to the domain SAM database)
92 is DOMPDC. The <replaceable>Administrator%password</replaceable> is
93 the login name and password for an account which has the necessary
94 privilege to add machines to the domain. If this is successful
95 you will see the message:</para>
97 <para><computeroutput>Joined domain DOM.</computeroutput>
98 or <computeroutput>Joined 'SERV1' to realm 'MYREALM'</computeroutput>
101 <para>in your terminal window. See the <ulink url="net.8.html">
102 net(8)</ulink> man page for more details.</para>
104 <para>This process joins the server to thedomain
105 without having to create the machine trust account on the PDC
108 <para>This command goes through the machine account password
109 change protocol, then writes the new (random) machine account
110 password for this Samba server into a file in the same directory
111 in which an smbpasswd file would be stored - normally :</para>
113 <para><filename>/usr/local/samba/private/secrets.tdb</filename></para>
115 <para>This file is created and owned by root and is not
116 readable by any other user. It is the key to the domain-level
117 security for your system, and should be treated as carefully
118 as a shadow password file.</para>
120 <para>Finally, restart your Samba daemons and get ready for
121 clients to begin using domain security!</para>
125 <title>Why is this better than security = server?</title>
127 <para>Currently, domain security in Samba doesn't free you from
128 having to create local Unix users to represent the users attaching
129 to your server. This means that if domain user <constant>DOM\fred
130 </constant> attaches to your domain security Samba server, there needs
131 to be a local Unix user fred to represent that user in the Unix
132 filesystem. This is very similar to the older Samba security mode
133 <ulink url="smb.conf.5.html#SECURITYEQUALSSERVER">security = server</ulink>,
134 where Samba would pass through the authentication request to a Windows
135 NT server in the same way as a Windows 95 or Windows 98 server would.
138 <para>Please refer to the <ulink url="winbind.html">Winbind
139 paper</ulink> for information on a system to automatically
140 assign UNIX uids and gids to Windows NT Domain users and groups.
141 This code is available in development branches only at the moment,
142 but will be moved to release branches soon.</para>
144 <para>The advantage to domain-level security is that the
145 authentication in domain-level security is passed down the authenticated
146 RPC channel in exactly the same way that an NT server would do it. This
147 means Samba servers now participate in domain trust relationships in
148 exactly the same way NT servers do (i.e., you can add Samba servers into
149 a resource domain and have the authentication passed on from a resource
150 domain PDC to an account domain PDC.</para>
152 <para>In addition, with <command>security = server</command> every Samba
153 daemon on a server has to keep a connection open to the
154 authenticating server for as long as that daemon lasts. This can drain
155 the connection resources on a Microsoft NT server and cause it to run
156 out of available connections. With <command>security = domain</command>,
157 however, the Samba daemons connect to the PDC/BDC only for as long
158 as is necessary to authenticate the user, and then drop the connection,
159 thus conserving PDC connection resources.</para>
161 <para>And finally, acting in the same manner as an NT server
162 authenticating to a PDC means that as part of the authentication
163 reply, the Samba server gets the user identification information such
164 as the user SID, the list of NT groups the user belongs to, etc. </para>
166 <note><para> Much of the text of this document
167 was first published in the Web magazine <ulink url="http://www.linuxworld.com">
168 LinuxWorld</ulink> as the article <ulink
169 url="http://www.linuxworld.com/linuxworld/lw-1998-10/lw-10-samba.html">Doing
170 the NIS/NT Samba</ulink>.</para></note>