This mode of server operation involves the Samba machine being made a member of a domain security context. This means by definition that all user authentication will be done from a centrally defined authentication regime. The authentication regime may come from an NT3/4-style (old domain technology) server, or it may be provided from an Active Directory server (ADS) running on MS Windows 2000 or later.
Of course it should be clear that the authentication backend itself could be from any distributed directory architecture server that is supported by Samba. This can be LDAP (from OpenLDAP), or Sun's iPlanet, or NetWare Directory Server, and so on .
Please refer to Chapter 4, Domain Control , for more information regarding how to create a domain machine account for a Domain Member server as well as for information on how to enable the Samba Domain Member machine to join the domain and be fully trusted by it.
6.3.1 Joining an NT4-type Domain with Samba-3
Table 6.1 lists names that have been used in the remainder of this chapter.
Table 6.1. Assumptions
First, you must edit your smb.conf file to tell Samba it should now use domain security.
Change (or add) your security line in the [global] section of your smb.conf to read:
security = domain
Next change the workgroup line in the [global] section to read:
workgroup = MIDEARTH
This is the name of the domain we are joining.
You must also have the parameter encrypt passwords set to yes in order for your users to authenticate to the NT PDC. This is the defaulty setting if this parameter is not specified. There is no need to specify this parameter, but if it is specified in the smb.conf file, it must be set to Yes .
Finally, add (or modify) a password server line in the [global] section to read:
password server = DOMPDC DOMBDC1 DOMBDC2
These are the primary and backup Domain Controllers Samba will attempt to contact in order to authenticate users. Samba will try to contact each of these servers in order, so you may want to rearrange this list in order to spread out the authentication load among Domain Controllers.
Alternately, if you want smbd to automatically determine the list of Domain Controllers to use for authentication, you may set this line to be:
password server = *
This method allows Samba to use exactly the same mechanism that NT does. The method either uses broadcast-based name resolution, performs a WINS database lookup in order to find a Domain Controller against which to authenticate, or locates the Domain Controller using DNS name resolution.
To join the domain, run this command:
root# net join -S DOMPDC -UAdministrator%password
If the -S DOMPDC argument is not given, the domain name will be obtained from smb.conf .
The machine is joining the domain DOM, and the PDC for that domain (the only machine that has write access to the domain SAM database) is DOMPDC, therefore use the -S option. The Administrator%password is the login name and password for an account that has the necessary privilege to add machines to the domain. If this is successful, you will see the message in your terminal window the text shown below. Where the older NT4 style domain architecture is used:
Joined domain DOM.
Where Active Directory is used:
Joined SERV1 to realm MYREALM.
Refer to the net man page for further information.
This process joins the server to the domain without having to create the machine trust account on the PDC beforehand.
This command goes through the machine account password change protocol, then writes the new (random) machine account password for this Samba server into a file in the same directory in which a smbpasswd file would be normally stored:
/usr/local/samba/private/secrets.tdb or /etc/samba/secrets.tdb.
This file is created and owned by root and is not readable by any other user. It is the key to the Domain-level security for your system, and should be treated as carefully as a shadow password file.
Finally, restart your Samba daemons and get ready for clients to begin using domain security. The way you can restart your Samba daemons depends on your distribution, but in most cases the following will suffice:
root# /etc/init.d/samba restart
6.3.2 Why Is This Better Than security = server?
Currently, domain security in Samba does not free you from having to create local UNIX users to represent the users attaching to your server. This means that if Domain user DOM/fred attaches to your Domain Security Samba server, there needs to be a local UNIX user fred to represent that user in the UNIX file system. This is similar to the older Samba security mode security = server, where Samba would pass through the authentication request to a Windows NT server in the same way as a Windows 95 or Windows 98 server would.
Please refer to Chapter 20, Winbind: Use of Domain Accounts , for information on a system to automatically assign UNIX UIDs and GIDs to Windows NT Domain users and groups.
The advantage to Domain-level security is that the authentication in Domain-level security is passed down the authenticated RPC channel in exactly the same way that an NT server would do it. This means Samba servers now participate in domain trust relationships in exactly the same way NT servers do (i.e., you can add Samba servers into a resource domain and have the authentication passed on from a resource domain PDC to an account domain PDC).
In addition, with security = server, every Samba daemon on a server has to keep a connection open to the authenticating server for as long as that daemon lasts. This can drain the connection resources on a Microsoft NT server and cause it to run out of available connections. With security = domain, however, the Samba daemons connect to the PDC/BDC only for as long as is necessary to authenticate the user and then drop the connection, thus conserving PDC connection resources.
And finally, acting in the same manner as an NT server authenticating to a PDC means that as part of the authentication reply, the Samba server gets the user identification information such as the user SID, the list of NT groups the user belongs to, and so on.