1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
5 >Samba as an NT4 or Win2k Primary Domain Controller</TITLE
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
10 TITLE="SAMBA Project Documentation"
11 HREF="samba-howto-collection.html"><LINK
13 TITLE="Type of installation"
14 HREF="type.html"><LINK
16 TITLE="Samba as Stand-Alone Server"
17 HREF="securitylevels.html"><LINK
19 TITLE="Samba Backup Domain Controller to Samba Domain Control"
20 HREF="samba-bdc.html"></HEAD
31 SUMMARY="Header navigation table"
40 >SAMBA Project Documentation</TH
48 HREF="securitylevels.html"
77 >Chapter 7. Samba as an NT4 or Win2k Primary Domain Controller</H1
87 HREF="samba-pdc.html#AEN1010"
88 >Prerequisite Reading</A
92 HREF="samba-pdc.html#AEN1014"
97 HREF="samba-pdc.html#AEN1054"
98 >Configuring the Samba Domain Controller</A
102 HREF="samba-pdc.html#AEN1096"
103 >Creating Machine Trust Accounts and Joining Clients to the Domain</A
109 HREF="samba-pdc.html#AEN1142"
110 >Manual Creation of Machine Trust Accounts</A
114 HREF="samba-pdc.html#AEN1183"
115 >"On-the-Fly" Creation of Machine Trust Accounts</A
119 HREF="samba-pdc.html#AEN1192"
120 >Joining the Client to the Domain</A
126 HREF="samba-pdc.html#AEN1212"
127 >Common Problems and Errors</A
133 HREF="samba-pdc.html#AEN1214"
134 >I cannot include a '$' in a machine name</A
138 HREF="samba-pdc.html#AEN1220"
139 >I get told "You already have a connection to the Domain...."
140 or "Cannot join domain, the credentials supplied conflict with an
141 existing set.." when creating a machine trust account.</A
145 HREF="samba-pdc.html#AEN1227"
146 >The system can not log you on (C000019B)....</A
150 HREF="samba-pdc.html#AEN1231"
151 >The machine trust account for this computer either does not
152 exist or is not accessible.</A
156 HREF="samba-pdc.html#AEN1237"
157 >When I attempt to login to a Samba Domain from a NT4/W2K workstation,
158 I get a message about my account being disabled.</A
164 HREF="samba-pdc.html#AEN1241"
165 >Domain Control for Windows 9x/ME</A
175 >7.1. Prerequisite Reading</A
178 >Before you continue reading in this chapter, please make sure
179 that you are comfortable with configuring basic files services
180 in smb.conf and how to enable and administer password
181 encryption in Samba. Theses two topics are covered in the
196 >This article outlines the steps necessary for configuring Samba as a PDC.
197 It is necessary to have a working Samba server prior to implementing the
198 PDC functionality.</P
204 > Domain logons for Windows NT 4.0 / 200x / XP Professional clients.
209 > Placing Windows 9x / Me clients in user level security
214 > Retrieving a list of users and groups from a Samba PDC to
215 Windows 9x / Me / NT / 200x / XP Professional clients
225 > Network/System Policies
243 SRC="/usr/share/sgml/docbook/stylesheet/dsssl/modular/images/note.gif"
250 >Roaming Profiles and System/Network policies are advanced network administration topics
251 that are covered separately in this document.</P
257 >The following functionalities are new to the Samba 3.0 release:</P
263 > Windows NT 4 domain trusts
268 > Adding users via the User Manager for Domains
273 >The following functionalities are NOT provided by Samba 3.0:</P
279 > SAM replication with Windows NT 4.0 Domain Controllers
280 (i.e. a Samba PDC and a Windows NT BDC or vice versa)
285 > Acting as a Windows 2000 Domain Controller (i.e. Kerberos and
291 >Please note that Windows 9x / Me / XP Home clients are not true members of a domain
292 for reasons outlined in this article. Therefore the protocol for
293 support Windows 9x-style domain logons is completely different
294 from NT4 / Win2k type domain logons and has been officially supported for some
301 >MS Windows XP Home edition is NOT able to join a domain and does not permit
302 the use of domain logons.</I
306 >Implementing a Samba PDC can basically be divided into 3 broad
314 > Configuring the Samba PDC
319 > Creating machine trust accounts and joining clients to the domain
324 > Adding and managing domain user accounts
329 >There are other minor details such as user profiles, system
330 policies, etc... However, these are not necessarily specific
331 to a Samba PDC as much as they are related to Windows NT networking
340 >7.3. Configuring the Samba Domain Controller</A
343 >The first step in creating a working Samba PDC is to
344 understand the parameters necessary in smb.conf. Here we
345 attempt to explain the parameters that are covered in
351 >Here is an example <TT
354 > for acting as a PDC:</P
357 CLASS="PROGRAMLISTING"
359 ; Basic server settings
361 HREF="smb.conf.5.html#NETBIOSNAME"
369 HREF="smb.conf.5.html#WORKGROUP"
377 ; we should act as the domain and local master browser
379 HREF="smb.conf.5.html#OSLEVEL"
384 HREF="smb.conf.5.html#PERFERREDMASTER"
389 HREF="smb.conf.5.html#DOMAINMASTER"
394 HREF="smb.conf.5.html#LOCALMASTER"
399 ; security settings (must user security = user)
401 HREF="smb.conf.5.html#SECURITYEQUALSUSER"
406 ; encrypted passwords are a requirement for a PDC
408 HREF="smb.conf.5.html#ENCRYPTPASSWORDS"
410 >encrypt passwords</A
413 ; support domain logons
415 HREF="smb.conf.5.html#DOMAINLOGONS"
420 ; where to store user profiles?
422 HREF="smb.conf.5.html#LOGONPATH"
427 ; where is a user's home directory and where should it be mounted at?
429 HREF="smb.conf.5.html#LOGONDRIVE"
434 HREF="smb.conf.5.html#LOGONHOME"
439 ; specify a generic logon script for all users
440 ; this is a relative **DOS** path to the [netlogon] share
442 HREF="smb.conf.5.html#LOGONSCRIPT"
447 ; necessary share for domain controller
450 HREF="smb.conf.5.html#PATH"
453 > = /usr/local/samba/lib/netlogon
455 HREF="smb.conf.5.html#READONLY"
460 HREF="smb.conf.5.html#WRITELIST"
468 ; share for storing user profiles
471 HREF="smb.conf.5.html#PATH"
474 > = /export/smb/ntprofile
476 HREF="smb.conf.5.html#READONLY"
481 HREF="smb.conf.5.html#CREATEMASK"
486 HREF="smb.conf.5.html#DIRECTORYMASK"
492 >There are a couple of points to emphasize in the above configuration.</P
498 > Encrypted passwords must be enabled. For more details on how
499 to do this, refer to <A
501 >the User Database chapter</A
507 > The server must support domain logons and a
516 > The server must be the domain master browser in order for Windows
517 client to locate the server as a DC. Please refer to the various
518 Network Browsing documentation included with this distribution for
524 >Samba 3.0 offers a complete implementation of group mapping
525 between Windows NT groups and Unix groups (this is really quite
526 complicated to explain in a short space).</P
534 >7.4. Creating Machine Trust Accounts and Joining Clients to the Domain</A
537 >A machine trust account is a Samba account that is used to
538 authenticate a client machine (rather than a user) to the Samba
539 server. In Windows terminology, this is known as a "Computer
542 >The password of a machine trust account acts as the shared secret for
543 secure communication with the Domain Controller. This is a security
544 feature to prevent an unauthorized machine with the same NetBIOS name
545 from joining the domain and gaining access to domain user/group
546 accounts. Windows NT, 200x, XP Professional clients use machine trust
547 accounts, but Windows 9x / Me / XP Home clients do not. Hence, a
548 Windows 9x / Me / XP Home client is never a true member of a domain
549 because it does not possess a machine trust account, and thus has no
550 shared secret with the domain controller.</P
552 >A Windows PDC stores each machine trust account in the Windows
553 Registry. A Samba-3 PDC also has to stoe machine trust account information
554 in a suitable back-end data store. With Samba-3 there can be multiple back-ends
555 for this including:</P
567 > - the plain ascii file stored used by
568 earlier versions of Samba. This file configuration option requires
569 a Unix/Linux system account for EVERY entry (ie: both for user and for
570 machine accounts). This file will be located in the <SPAN
577 directory (default is /usr/local/samba/lib/private or on linux /etc/samba).
588 > - This file is independant of the
589 system wide user accounts. The use of this back-end option requires
590 specification of the "non unix account range" option also. It is called
591 smbpasswd and will be located in the <TT
605 > - a binary database backend that will be
612 > directory in a file called
619 >. The key benefit of this binary format
620 file is that it can store binary objects that can not be accomodated
621 in the traditional plain text smbpasswd file.
632 > like the smbpasswd_nua option above, this
633 file allows the creation of arbitrary user and machine accounts without
634 requiring that account to be added to the system (/etc/passwd) file. It
635 too requires the specification of the "non unix account range" option
636 in the [globals] section of the <TT
650 > - An LDAP based back-end. Permits the
651 LDAP server to be specified. eg: ldap://localhost or ldap://frodo.murphy.com
662 > - LDAP based back-end with no unix
663 account requirement, like smbpasswd_nua and tdbsam_nua above.
668 >Read the chapter about the <A
674 >A Samba PDC, however, stores each machine trust account in two parts,
682 >A Samba account, stored in the same location as user
683 LanMan and NT password hashes (currently
687 >). The Samba account
688 possesses and uses only the NT password hash.</P
692 >A corresponding Unix account, typically stored in
696 >. (Future releases will alleviate the need to
705 >There are two ways to create machine trust accounts:</P
711 > Manual creation. Both the Samba and corresponding
712 Unix account are created by hand.</P
716 > "On-the-fly" creation. The Samba machine trust
717 account is automatically created by Samba at the time the client
718 is joined to the domain. (For security, this is the
719 recommended method.) The corresponding Unix account may be
720 created automatically or manually. </P
729 >7.4.1. Manual Creation of Machine Trust Accounts</A
732 >The first step in manually creating a machine trust account is to
733 manually create the corresponding Unix account in
737 >. This can be done using
741 > or other 'add user' command that is normally
742 used to create new Unix accounts. The following is an example for a
743 Linux based Samba server:</P
750 >/usr/sbin/useradd -g 100 -d /dev/null -c <VAR
771 >On *BSD systems, this can be done using the 'chpass' utility:</P
781 >$:*:101:100::0:0:Workstation <VAR
784 >:/dev/null:/sbin/nologin"</B
790 > entry will list the machine name
791 with a "$" appended, won't have a password, will have a null shell and no
792 home directory. For example a machine named 'doppy' would have an
796 > entry like this:</P
799 CLASS="PROGRAMLISTING"
800 >doppy$:x:505:501:<VAR
802 >machine_nickname</VAR
803 >:/dev/null:/bin/false</PRE
808 >machine_nickname</VAR
810 descriptive name for the client, i.e., BasementComputer.
814 > absolutely must be the NetBIOS
815 name of the client to be joined to the domain. The "$" must be
816 appended to the NetBIOS name of the client or Samba will not recognize
817 this as a machine trust account.</P
819 >Now that the corresponding Unix account has been created, the next step is to create
820 the Samba account for the client containing the well-known initial
821 machine trust account password. This can be done using the <A
822 HREF="smbpasswd.8.html"
836 >smbpasswd -a -m <VAR
845 > is the machine's NetBIOS
846 name. The RID of the new machine account is generated from the UID of
847 the corresponding Unix account.</P
862 SRC="/usr/share/sgml/docbook/stylesheet/dsssl/modular/images/warning.gif"
869 >Join the client to the domain immediately</B
879 > Manually creating a machine trust account using this method is the
880 equivalent of creating a machine trust account on a Windows NT PDC using
881 the "Server Manager". From the time at which the account is created
882 to the time which the client joins the domain and changes the password,
883 your domain is vulnerable to an intruder joining your domain using a
884 a machine with the same NetBIOS name. A PDC inherently trusts
885 members of the domain and will serve out a large degree of user
886 information to such clients. You have been warned!
899 >7.4.2. "On-the-Fly" Creation of Machine Trust Accounts</A
902 >The second (and recommended) way of creating machine trust accounts is
903 simply to allow the Samba server to create them as needed when the client
904 is joined to the domain. </P
906 >Since each Samba machine trust account requires a corresponding
907 Unix account, a method for automatically creating the
908 Unix account is usually supplied; this requires configuration of the
910 HREF="smb.conf.5.html#ADDUSERSCRIPT"
918 method is not required, however; corresponding Unix accounts may also
919 be created manually.</P
921 >Below is an example for a RedHat 6.2 Linux system.</P
924 CLASS="PROGRAMLISTING"
926 # <...remainder of parameters...>
927 add user script = /usr/sbin/useradd -d /dev/null -g 100 -s /bin/false -M %u </PRE
936 >7.4.3. Joining the Client to the Domain</A
939 >The procedure for joining a client to the domain varies with the
940 version of Windows.</P
954 > When the user elects to join the client to a domain, Windows prompts for
955 an account and password that is privileged to join the domain. A
956 Samba administrative account (i.e., a Samba account that has root
957 privileges on the Samba server) must be entered here; the
958 operation will fail if an ordinary user account is given.
959 The password for this account should be
960 set to a different password than the associated
964 > entry, for security
967 >The session key of the Samba administrative account acts as an
968 encryption key for setting the password of the machine trust
969 account. The machine trust account will be created on-the-fly, or
970 updated if it already exists.</P
982 > If the machine trust account was created manually, on the
983 Identification Changes menu enter the domain name, but do not
984 check the box "Create a Computer Account in the Domain." In this case,
985 the existing machine trust account is used to join the machine to
988 > If the machine trust account is to be created
989 on-the-fly, on the Identification Changes menu enter the domain
990 name, and check the box "Create a Computer Account in the Domain." In
991 this case, joining the domain proceeds as above for Windows 2000
992 (i.e., you must supply a Samba administrative account when
1005 >Joining a samba client to a domain is documented in
1007 HREF="domain-member.html"
1020 >7.5. Common Problems and Errors</A
1028 >7.5.1. I cannot include a '$' in a machine name</A
1031 >A 'machine name' in (typically) <TT
1035 of the machine name with a '$' appended. FreeBSD (and other BSD
1036 systems?) won't create a user with a '$' in their name.</P
1038 >The problem is only in the program used to make the entry, once
1039 made, it works perfectly. So create a user without the '$' and
1043 > to edit the entry, adding the '$'. Or create
1044 the whole entry with vipw if you like, make sure you use a
1053 >7.5.2. I get told "You already have a connection to the Domain...."
1054 or "Cannot join domain, the credentials supplied conflict with an
1055 existing set.." when creating a machine trust account.</A
1058 >This happens if you try to create a machine trust account from the
1059 machine itself and already have a connection (e.g. mapped drive)
1060 to a share (or IPC$) on the Samba PDC. The following command
1061 will remove all network drive connections:</P
1065 >C:\WINNT\></SAMP
1071 >Further, if the machine is a already a 'member of a workgroup' that
1072 is the same name as the domain you are joining (bad idea) you will
1073 get this message. Change the workgroup name to something else, it
1074 does not matter what, reboot, and try again.</P
1082 >7.5.3. The system can not log you on (C000019B)....</A
1085 >I joined the domain successfully but after upgrading
1086 to a newer version of the Samba code I get the message, "The system
1087 can not log you on (C000019B), Please try again or consult your
1088 system administrator" when attempting to logon.</P
1090 >This occurs when the domain SID stored in the secrets.tdb database
1091 is changed. The most common cause of a change in domain SID is when
1092 the domain name and/or the server name (netbios name) is changed.
1093 The only way to correct the problem is to restore the original domain
1094 SID or remove the domain client from the domain and rejoin. The domain
1095 SID may be reset using either the smbpasswd or rpcclient utilities.</P
1103 >7.5.4. The machine trust account for this computer either does not
1104 exist or is not accessible.</A
1107 >When I try to join the domain I get the message "The machine account
1108 for this computer either does not exist or is not accessible". What's
1111 >This problem is caused by the PDC not having a suitable machine trust account.
1112 If you are using the <VAR
1114 >add user script</VAR
1116 accounts then this would indicate that it has not worked. Ensure the domain
1117 admin user system is working.</P
1119 >Alternatively if you are creating account entries manually then they
1120 have not been created correctly. Make sure that you have the entry
1121 correct for the machine trust account in smbpasswd file on the Samba PDC.
1122 If you added the account using an editor rather than using the smbpasswd
1123 utility, make sure that the account name is the machine NetBIOS name
1124 with a '$' appended to it ( i.e. computer_name$ ). There must be an entry
1125 in both /etc/passwd and the smbpasswd file. Some people have reported
1126 that inconsistent subnet masks between the Samba server and the NT
1127 client have caused this problem. Make sure that these are consistent
1128 for both client and server.</P
1136 >7.5.5. When I attempt to login to a Samba Domain from a NT4/W2K workstation,
1137 I get a message about my account being disabled.</A
1140 >At first be ensure to enable the useraccounts with <B
1144 >, this is normally done, when you create an account.</P
1153 >7.6. Domain Control for Windows 9x/ME</A
1156 >A domain and a workgroup are exactly the same thing in terms of network
1157 browsing. The difference is that a distributable authentication
1158 database is associated with a domain, for secure login access to a
1159 network. Also, different access rights can be granted to users if they
1160 successfully authenticate against a domain logon server. Samba-3 does this
1161 now in the same way that MS Windows NT/2K.</P
1163 >The SMB client logging on to a domain has an expectation that every other
1164 server in the domain should accept the same authentication information.
1165 Network browsing functionality of domains and workgroups is identical and
1166 is explained in this documentation under the browsing discussions.
1167 It should be noted, that browsing is totally orthogonal to logon support.</P
1169 >Issues related to the single-logon network model are discussed in this
1170 section. Samba supports domain logons, network logon scripts, and user
1171 profiles for MS Windows for workgroups and MS Windows 9X/ME clients
1172 which are the focus of this section.</P
1174 >When an SMB client in a domain wishes to logon it broadcast requests for a
1175 logon server. The first one to reply gets the job, and validates its
1176 password using whatever mechanism the Samba administrator has installed.
1177 It is possible (but very stupid) to create a domain where the user
1178 database is not shared between servers, i.e. they are effectively workgroup
1179 servers advertising themselves as participating in a domain. This
1180 demonstrates how authentication is quite different from but closely
1181 involved with domains.</P
1183 >Using these features you can make your clients verify their logon via
1184 the Samba server; make clients run a batch file when they logon to
1185 the network and download their preferences, desktop and start menu.</P
1187 >Before launching into the configuration instructions, it is
1188 worthwhile lookingat how a Windows 9x/ME client performs a logon:</P
1195 > The client broadcasts (to the IP broadcast address of the subnet it is in)
1196 a NetLogon request. This is sent to the NetBIOS name DOMAIN<1c> at the
1197 NetBIOS layer. The client chooses the first response it receives, which
1198 contains the NetBIOS name of the logon server to use in the format of
1204 > The client then connects to that server, logs on (does an SMBsessetupX) and
1205 then connects to the IPC$ share (using an SMBtconX).
1210 > The client then does a NetWkstaUserLogon request, which retrieves the name
1211 of the user's logon script.
1216 > The client then connects to the NetLogon share and searches for this
1217 and if it is found and can be read, is retrieved and executed by the client.
1218 After this, the client disconnects from the NetLogon share.
1223 > The client then sends a NetUserGetInfo request to the server, to retrieve
1224 the user's home share, which is used to search for profiles. Since the
1225 response to the NetUserGetInfo request does not contain much more
1226 the user's home share, profiles for Win9X clients MUST reside in the user
1232 > The client then connects to the user's home share and searches for the
1233 user's profile. As it turns out, you can specify the user's home share as
1234 a sharename and path. For example, \\server\fred\.profile.
1235 If the profiles are found, they are implemented.
1240 > The client then disconnects from the user's home share, and reconnects to
1241 the NetLogon share and looks for CONFIG.POL, the policies file. If this is
1242 found, it is read and implemented.
1252 >7.6.1. Configuration Instructions: Network Logons</A
1255 >The main difference between a PDC and a Windows 9x logon
1256 server configuration is that</P
1262 >Password encryption is not required for a Windows 9x logon server.</P
1266 >Windows 9x/ME clients do not possess machine trust accounts.</P
1270 >Therefore, a Samba PDC will also act as a Windows 9x logon
1286 SRC="/usr/share/sgml/docbook/stylesheet/dsssl/modular/images/warning.gif"
1293 >security mode and master browsers</B
1303 >There are a few comments to make in order to tie up some
1304 loose ends. There has been much debate over the issue of whether
1305 or not it is ok to configure Samba as a Domain Controller in security
1306 modes other than <CODE
1309 >. The only security mode
1310 which will not work due to technical reasons is <CODE
1314 mode security. <CODE
1321 mode security is really just a variation on SMB user level security.</P
1323 >Actually, this issue is also closely tied to the debate on whether
1324 or not Samba must be the domain master browser for its workgroup
1325 when operating as a DC. While it may technically be possible
1326 to configure a server as such (after all, browsing and domain logons
1327 are two distinctly different functions), it is not a good idea to
1328 so. You should remember that the DC must register the DOMAIN#1b NetBIOS
1329 name. This is the name used by Windows clients to locate the DC.
1330 Windows clients do not distinguish between the DC and the DMB.
1331 For this reason, it is very wise to configure the Samba DC as the DMB.</P
1333 >Now back to the issue of configuring a Samba DC to use a mode other
1334 than "security = user". If a Samba host is configured to use
1335 another SMB server or DC in order to validate user connection
1336 requests, then it is a fact that some other machine on the network
1337 (the "password server") knows more about user than the Samba host.
1338 99% of the time, this other host is a domain controller. Now
1339 in order to operate in domain mode security, the "workgroup" parameter
1340 must be set to the name of the Windows NT domain (which already
1341 has a domain controller, right?)</P
1343 >Therefore configuring a Samba box as a DC for a domain that
1344 already by definition has a PDC is asking for trouble.
1345 Therefore, you should always configure the Samba DC to be the DMB
1359 SUMMARY="Footer navigation table"
1370 HREF="securitylevels.html"
1379 HREF="samba-howto-collection.html"
1388 HREF="samba-bdc.html"
1398 >Samba as Stand-Alone Server</TD
1412 >Samba Backup Domain Controller to Samba Domain Control</TD