1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
9 <author>&person.gd;<contrib>LDAP updates</contrib></author>
11 <firstname>Olivier (lem)</firstname><surname>Lemaire</surname>
13 <orgname>IDEALX</orgname>
14 <address><email>olem@IDEALX.org</email></address>
18 <pubdate>May 24, 2003</pubdate>
20 <title>Account Information Databases</title>
23 <indexterm><primary>account backends</primary></indexterm>
24 <indexterm><primary>password backends</primary></indexterm>
25 <indexterm><primary>scalability</primary></indexterm>
26 <indexterm><primary>ADS</primary></indexterm>
27 Early releases of Samba-3 implemented new capability to work concurrently with multiple account backends. This
28 capability was removed beginning with release of Samba 3.0.23. Commencing with Samba 3.0.23 it is possible to
29 work with only one specified passwd backend.
33 <indexterm><primary>passdb backend</primary></indexterm>
34 <indexterm><primary>smbpasswd</primary></indexterm>
35 <indexterm><primary>tdbsam</primary></indexterm>
36 <indexterm><primary>ldapsam</primary></indexterm>
37 <indexterm><primary>LDAP</primary></indexterm>
38 <indexterm><primary>single repository</primary></indexterm>
39 The three passdb backends that are fully maintained (actively supported) by the Samba Team are:
40 <literal>smbpasswd</literal> (being obsoleted), <literal>tdbsam</literal> (a tdb-based binary file format),
41 and <literal>ldapsam</literal> (LDAP directory). Of these, only the <literal>ldapsam</literal> backend
42 stores both POSIX (UNIX) and Samba user and group account information in a single repository. The
43 <literal>smbpasswd</literal> and <literal>tdbsam</literal> backends store only Samba user accounts.
47 In a strict sense, there are three supported account storage and access systems. One of these is considered
48 obsolete (smbpasswd). It is recommended to use the <literal>tdbsam</literal> method for all simple systems. Use
49 <literal>ldapsam</literal> for larger and more complex networks.
53 <indexterm><primary>passdb backend</primary></indexterm>
54 <indexterm><primary>account storage mechanisms</primary></indexterm>
55 <indexterm><primary>account storage system</primary></indexterm>
56 <indexterm><primary>user and trust accounts</primary></indexterm>
57 <indexterm><primary>machine trust accounts</primary></indexterm>
58 <indexterm><primary>computer accounts</primary></indexterm>
59 <indexterm><primary>interdomain trust accounts</primary></indexterm>
60 In a strict and literal sense, the passdb backends are account storage mechanisms (or methods) alone. The choice
61 of terminology can be misleading, however we are stuck with this choice of wording. This chapter documents the
62 nature of the account storage system with a focus on user and trust accounts. Trust accounts have two forms,
63 machine trust accounts (computer accounts) and interdomain trust accounts. These are all treated as user-like
68 <title>Features and Benefits</title>
71 <title>Backward Compatibility Account Storage Systems</title>
74 <varlistentry><term>Plaintext</term>
77 <indexterm><primary>plaintext</primary></indexterm>
78 <indexterm><primary>plaintext authentication</primary></indexterm>
79 <indexterm><primary>/etc/passwd</primary></indexterm>
80 <indexterm><primary>/etc/shadow</primary></indexterm>
81 <indexterm><primary>PAM</primary></indexterm>
82 This isn't really a backend at all, but is listed here for simplicity. Samba can be configured to pass
83 plaintext authentication requests to the traditional UNIX/Linux <filename>/etc/passwd</filename> and
84 <filename>/etc/shadow</filename>-style subsystems. On systems that have Pluggable Authentication Modules
85 (PAM) support, all PAM modules are supported. The behavior is just as it was with Samba-2.2.x, and the
86 protocol limitations imposed by MS Windows clients apply likewise. Please refer to <link
87 linkend="passdbtech">Technical Information</link>, for more information regarding the limitations of plaintext
93 <varlistentry><term>smbpasswd</term>
96 <indexterm><primary>smbpasswd</primary></indexterm>
97 <indexterm><primary>LanMan passwords</primary></indexterm>
98 <indexterm><primary>NT-encrypted passwords</primary></indexterm>
99 <indexterm><primary>SAM</primary></indexterm>
100 This option allows continued use of the <filename>smbpasswd</filename>
101 file that maintains a plain ASCII (text) layout that includes the MS Windows
102 LanMan and NT-encrypted passwords as well as a field that stores some
103 account information. This form of password backend does not store any of
104 the MS Windows NT/200x SAM (Security Account Manager) information required to
105 provide the extended controls that are needed for more comprehensive
106 interoperation with MS Windows NT4/200x servers.
110 This backend should be used only for backward compatibility with older
111 versions of Samba. It may be deprecated in future releases.
120 <title>New Account Storage Systems</title>
123 Samba-3 introduces a number of new password backend capabilities.
124 <indexterm><primary>SAM backend</primary><secondary>tdbsam</secondary></indexterm>
125 <indexterm><primary>SAM backend</primary><secondary>ldapsam</secondary></indexterm>
129 <varlistentry><term>tdbsam</term>
132 <indexterm><primary>rich database backend</primary></indexterm>
133 <indexterm><primary>PDC</primary></indexterm>
134 <indexterm><primary>BDC</primary></indexterm>
135 This backend provides a rich database backend for local servers. This
136 backend is not suitable for multiple domain controllers (i.e., PDC + one
137 or more BDC) installations.
141 <indexterm><primary>extended SAM</primary></indexterm>
142 <indexterm><primary>TDB</primary></indexterm>
143 <indexterm><primary>binary format TDB</primary></indexterm>
144 <indexterm><primary>trivial database</primary></indexterm>
145 <indexterm><primary>system access controls</primary></indexterm>
146 <indexterm><primary>MS Windows NT4/200x</primary></indexterm>
147 The <emphasis>tdbsam</emphasis> password backend stores the old <emphasis>
148 smbpasswd</emphasis> information plus the extended MS Windows NT/200x
149 SAM information into a binary format TDB (trivial database) file.
150 The inclusion of the extended information makes it possible for Samba-3
151 to implement the same account and system access controls that are possible
152 with MS Windows NT4/200x-based systems.
156 <indexterm><primary>simple operation</primary></indexterm>
157 <indexterm><primary>OpenLDAP</primary></indexterm>
158 <indexterm><primary>ADS</primary></indexterm>
159 The inclusion of the <emphasis>tdbsam</emphasis> capability is a direct
160 response to user requests to allow simple site operation without the overhead
161 of the complexities of running OpenLDAP. It is recommended to use this only
162 for sites that have fewer than 250 users. For larger sites or implementations,
163 the use of OpenLDAP or of Active Directory integration is strongly recommended.
168 <varlistentry><term>ldapsam</term>
171 <indexterm><primary>rich directory backend</primary></indexterm>
172 <indexterm><primary>distributed account</primary></indexterm>
173 This provides a rich directory backend for distributed account installation.
177 <indexterm><primary>LDAP</primary></indexterm>
178 <indexterm><primary>OpenLDAP</primary></indexterm>
179 <indexterm><primary>Samba schema</primary></indexterm>
180 <indexterm><primary>schema file</primary></indexterm>
181 <indexterm><primary>examples/LDAP</primary></indexterm>
182 Samba-3 has a new and extended LDAP implementation that requires configuration
183 of OpenLDAP with a new format Samba schema. The new format schema file is
184 included in the <filename class="directory">examples/LDAP</filename> directory of the Samba distribution.
188 <indexterm><primary>expands control abilities</primary></indexterm>
189 <indexterm><primary>profile</primary></indexterm>
190 <indexterm><primary>home directories</primary></indexterm>
191 <indexterm><primary>account access controls</primary></indexterm>
192 <indexterm><primary>greater scalability</primary></indexterm>
193 The new LDAP implementation significantly expands the control abilities that
194 were possible with prior versions of Samba. It is now possible to specify
195 <quote>per-user</quote> profile settings, home directories, account access controls, and
196 much more. Corporate sites will see that the Samba Team has listened to their
197 requests both for capability and greater scalability.
208 <sect1 id="passdbtech">
209 <title>Technical Information</title>
212 <indexterm><primary>plaintext passwords</primary></indexterm>
213 <indexterm><primary>encrypted passwords</primary></indexterm>
214 Old Windows clients send plaintext passwords over the wire. Samba can check these
215 passwords by encrypting them and comparing them to the hash stored in the UNIX user database.
219 <indexterm><primary>encrypted passwords</primary></indexterm>
220 <indexterm><primary>LanMan</primary></indexterm>
221 <indexterm><primary>plaintext passwords</primary></indexterm>
222 <indexterm><primary>registry</primary></indexterm>
223 Newer Windows clients send encrypted passwords (LanMan and NT hashes) instead of plaintext passwords over
224 the wire. The newest clients will send only encrypted passwords and refuse to send plaintext passwords unless
225 their registry is tweaked.
229 <indexterm><primary>UNIX-style encrypted passwords</primary></indexterm>
230 <indexterm><primary>converted</primary></indexterm>
231 Many people ask why Samba cannot simply use the UNIX password database. Windows requires
232 passwords that are encrypted in its own format. The UNIX passwords can't be converted to
233 Windows-style encrypted passwords. Because of that, you can't use the standard UNIX user
234 database, and you have to store the LanMan and NT hashes somewhere else.
238 <indexterm><primary>differently encrypted passwords</primary></indexterm>
239 <indexterm><primary>profile</primary></indexterm>
240 <indexterm><primary>workstations</primary></indexterm>
241 <indexterm><primary>tdbsam</primary></indexterm>
242 In addition to differently encrypted passwords, Windows also stores certain data for each
243 user that is not stored in a UNIX user database: for example, workstations the user may logon from,
244 the location where the user's profile is stored, and so on. Samba retrieves and stores this
245 information using a <smbconfoption name="passdb backend"/>. Commonly available backends are LDAP,
246 tdbsam, and plain text file. For more information, see the man page for &smb.conf; regarding the
247 <smbconfoption name="passdb backend"/> parameter.
251 <figure id="idmap-sid2uid">
252 <title>IDMAP: Resolution of SIDs to UIDs.</title>
253 <imagefile scale="40">idmap-sid2uid</imagefile>
257 <indexterm><primary>SID</primary></indexterm>
258 <indexterm><primary>UID</primary></indexterm>
259 <indexterm><primary>SID</primary></indexterm>
260 The resolution of SIDs to UIDs is fundamental to correct operation of Samba. In both cases shown, if winbindd
261 is not running or cannot be contacted, then only local SID/UID resolution is possible. See <link
262 linkend="idmap-sid2uid">resolution of SIDs to UIDs</link> and <link linkend="idmap-uid2sid">resolution of UIDs
263 to SIDs</link> diagrams.
266 <figure id="idmap-uid2sid">
267 <title>IDMAP: Resolution of UIDs to SIDs.</title>
268 <imagefile scale="50">idmap-uid2sid</imagefile>
272 <title>Important Notes About Security</title>
275 <indexterm><primary>SMB password encryption</primary></indexterm>
276 <indexterm><primary>clear-text passwords</primary></indexterm>
277 <indexterm><primary>hashed password equivalent</primary></indexterm>
278 <indexterm><primary>LDAP</primary></indexterm>
279 <indexterm><primary>secret</primary></indexterm>
280 The UNIX and SMB password encryption techniques seem similar on the surface. This
281 similarity is, however, only skin deep. The UNIX scheme typically sends clear-text
282 passwords over the network when logging in. This is bad. The SMB encryption scheme
283 never sends the clear-text password over the network, but it does store the 16-byte
284 hashed values on disk. This is also bad. Why? Because the 16 byte hashed values
285 are a <quote>password equivalent.</quote> You cannot derive the user's password from them, but
286 they could potentially be used in a modified client to gain access to a server.
287 This would require considerable technical knowledge on behalf of the attacker but
288 is perfectly possible. You should therefore treat the data stored in whatever passdb
289 backend you use (smbpasswd file, LDAP) as though it contained the clear-text
290 passwords of all your users. Its contents must be kept secret, and the file should
291 be protected accordingly.
295 <indexterm><primary>password scheme</primary></indexterm>
296 <indexterm><primary>plaintext passwords</primary></indexterm>
297 <indexterm><primary>compatible</primary></indexterm>
298 Ideally, we would like a password scheme that involves neither plaintext passwords
299 on the network nor plaintext passwords on disk. Unfortunately, this is not available because Samba is stuck with
300 having to be compatible with other SMB systems (Windows NT, Windows for Workgroups, Windows 9x/Me).
304 <indexterm><primary>encrypted passwords</primary></indexterm>
305 <indexterm><primary>plaintext passwords</primary></indexterm>
306 Windows NT 4.0 Service Pack 3 changed the default setting so plaintext passwords
307 are disabled from being sent over the wire. This mandates either the use of encrypted
308 password support or editing the Windows NT registry to re-enable plaintext passwords.
312 <indexterm><primary>domain security</primary></indexterm>
313 <indexterm><primary>domain environment</primary></indexterm>
314 The following versions of Microsoft Windows do not support full domain security protocols,
315 although they may log onto a domain environment:
319 <listitem><para>MS DOS Network client 3.0 with the basic network redirector installed.</para></listitem>
320 <listitem><para>Windows 95 with the network redirector update installed.</para></listitem>
321 <listitem><para>Windows 98 [Second Edition].</para></listitem>
322 <listitem><para>Windows Me.</para></listitem>
327 <indexterm><primary>Windows XP Home</primary></indexterm>
328 <indexterm><primary>domain member</primary></indexterm>
329 <indexterm><primary>domain logons</primary></indexterm>
330 MS Windows XP Home does not have facilities to become a domain member, and it cannot participate in domain logons.
335 The following versions of MS Windows fully support domain security protocols.
339 <listitem><para>Windows NT 3.5x.</para></listitem>
340 <listitem><para>Windows NT 4.0.</para></listitem>
341 <listitem><para>Windows 2000 Professional.</para></listitem>
342 <listitem><para>Windows 200x Server/Advanced Server.</para></listitem>
343 <listitem><para>Windows XP Professional.</para></listitem>
347 <indexterm><primary>SMB/CIFS</primary></indexterm>
348 <indexterm><primary>authentication</primary></indexterm>
349 <indexterm><primary>challenge/response mechanism</primary></indexterm>
350 <indexterm><primary>clear-text</primary></indexterm>
351 <indexterm><primary>encrypted</primary></indexterm>
352 <indexterm><primary>negotiate</primary></indexterm>
353 All current releases of Microsoft SMB/CIFS clients support authentication via the
354 SMB challenge/response mechanism described here. Enabling clear-text authentication
355 does not disable the ability of the client to participate in encrypted authentication.
356 Instead, it allows the client to negotiate either plaintext or encrypted password
361 <indexterm><primary>cached encrypted password</primary></indexterm>
362 <indexterm><primary>plaintext passwords</primary></indexterm>
363 <indexterm><primary>registry change</primary></indexterm>
364 <indexterm><primary>auto-reconnect</primary></indexterm>
365 <indexterm><primary>encrypted passwords</primary></indexterm>
366 MS Windows clients will cache the encrypted password alone. Where plaintext passwords
367 are re-enabled through the appropriate registry change, the plaintext password is never
368 cached. This means that in the event that a network connections should become disconnected
369 (broken), only the cached (encrypted) password will be sent to the resource server to
370 effect an auto-reconnect. If the resource server does not support encrypted passwords, the
371 auto-reconnect will fail. Use of encrypted passwords is strongly advised.
375 <title>Advantages of Encrypted Passwords</title>
379 <indexterm><primary>passed across the network</primary></indexterm>
380 <indexterm><primary>network sniffer</primary></indexterm>
381 <indexterm><primary>SMB server</primary></indexterm>
382 Plaintext passwords are not passed across the network. Someone using a network sniffer
383 cannot just record passwords going to the SMB server.
387 <indexterm><primary>not stored anywhere</primary></indexterm>
388 <indexterm><primary>memory</primary></indexterm>
389 <indexterm><primary>disk</primary></indexterm>
390 Plaintext passwords are not stored anywhere in memory or on disk.
394 <indexterm><primary>encrypted passwords</primary></indexterm>
395 <indexterm><primary>user-level security</primary></indexterm>
396 <indexterm><primary>password prompt</primary></indexterm>
397 <indexterm><primary>SMB encryption</primary></indexterm>
398 Windows NT does not like talking to a server that does not support encrypted passwords. It will refuse to
399 browse the server if the server is also in user-level security mode. It will insist on prompting the user for
400 the password on each connection, which is very annoying. The only thing you can do to stop this is to use SMB
405 <indexterm><primary>encrypted password</primary></indexterm>
406 <indexterm><primary>automatic reconnects</primary></indexterm>
407 Encrypted password support allows automatic share (resource) reconnects.
411 <indexterm><primary>PDC</primary></indexterm>
412 <indexterm><primary>BDC</primary></indexterm>
413 Encrypted passwords are essential for PDC/BDC operation.
420 <title>Advantages of Non-Encrypted Passwords</title>
424 <indexterm><primary>cached in memory</primary></indexterm>
425 Plaintext passwords are not kept on disk and are not cached in memory.
429 <indexterm><primary>Login</primary></indexterm>
430 <indexterm><primary>FTP</primary></indexterm>
431 Plaintext passwords use the same password file as other UNIX services, such as Login and FTP.
435 <indexterm><primary>Telnet</primary></indexterm>
436 <indexterm><primary>FTP</primary></indexterm>
437 Use of other services (such as Telnet and FTP) that send plaintext passwords over
438 the network makes sending them for SMB not such a big deal.
445 <title>Mapping User Identifiers between MS Windows and UNIX</title>
448 <indexterm><primary>UID</primary></indexterm>
449 <indexterm><primary>SID</primary></indexterm>
450 <indexterm><primary>mapping</primary></indexterm>
451 Every operation in UNIX/Linux requires a user identifier (UID), just as in
452 MS Windows NT4/200x this requires a security identifier (SID). Samba provides
453 two means for mapping an MS Windows user to a UNIX/Linux UID.
457 <indexterm><primary>Samba SAM</primary></indexterm>
458 <indexterm><primary>SAM</primary></indexterm>
459 <indexterm><primary>UID</primary></indexterm>
460 <indexterm><primary>account information database</primary></indexterm>
461 <indexterm><primary>local user account</primary></indexterm>
462 First, all Samba SAM database accounts require a UNIX/Linux UID that the account will map to. As users are
463 added to the account information database, Samba will call the <smbconfoption name="add user script"/>
464 interface to add the account to the Samba host OS. In essence all accounts in the local SAM require a local
469 <indexterm><primary>idmap uid</primary></indexterm>
470 <indexterm><primary>idmap gid</primary></indexterm>
471 <indexterm><primary>UID</primary></indexterm>
472 <indexterm><primary>SAM</primary></indexterm>
473 <indexterm><primary>foreign domain</primary></indexterm>
474 <indexterm><primary>non-member Windows client</primary></indexterm>
475 <indexterm><primary>SID</primary></indexterm>
476 The second way to map Windows SID to UNIX UID is via the <emphasis>idmap uid</emphasis> and
477 <emphasis>idmap gid</emphasis> parameters in &smb.conf;. Please refer to the man page for information about
478 these parameters. These parameters are essential when mapping users from a remote (non-member Windows client
479 or a member of a foreign domain) SAM server.
484 <sect2 id="idmapbackend">
485 <title>Mapping Common UIDs/GIDs on Distributed Machines</title>
488 <indexterm><primary>UID</primary></indexterm>
489 <indexterm><primary>GID</primary></indexterm>
490 <indexterm><primary>BDC</primary></indexterm>
491 <indexterm><primary>domain member servers</primary></indexterm>
492 <indexterm><primary>NFS</primary></indexterm>
493 <indexterm><primary>rsync</primary></indexterm>
494 Samba-3 has a special facility that makes it possible to maintain identical UIDs and GIDs
495 on all servers in a distributed network. A distributed network is one where there exists
496 a PDC, one or more BDCs, and/or one or more domain member servers. Why is this important?
497 This is important if files are being shared over more than one protocol (e.g., NFS) and where
498 users are copying files across UNIX/Linux systems using tools such as <command>rsync</command>.
502 <indexterm><primary>LDAP-based</primary></indexterm>
503 <indexterm><primary>idmap backend</primary></indexterm>
504 <indexterm><primary>UID</primary></indexterm>
505 <indexterm><primary>GID</primary></indexterm>
506 <indexterm><primary>LDAP</primary></indexterm>
507 <indexterm><primary>SAM backend</primary></indexterm>
508 <indexterm><primary>LDAP idmap Backend</primary></indexterm>
509 <indexterm><primary>idmap backend</primary></indexterm>
510 The special facility is enabled using a parameter called <parameter>idmap backend</parameter>.
511 The default setting for this parameter is an empty string. Technically it is possible to use
512 an LDAP-based idmap backend for UIDs and GIDs, but it makes most sense when this is done for
513 network configurations that also use LDAP for the SAM backend.
514 <link linkend="idmapbackendexample">Example Configuration with the LDAP idmap Backend</link>
515 shows that configuration.
518 <indexterm><primary>SAM backend</primary><secondary>ldapsam</secondary></indexterm>
519 <example id="idmapbackendexample">
520 <title>Example Configuration with the LDAP idmap Backend</title>
522 <smbconfsection name="[global]"/>
523 <smbconfoption name="idmap backend">ldap:ldap://ldap-server.quenya.org:636</smbconfoption>
524 <smbconfcomment>Alternatively, this could be specified as:</smbconfcomment>
525 <smbconfoption name="idmap backend">ldap:ldaps://ldap-server.quenya.org</smbconfoption>
530 <indexterm><primary>LDAP backends</primary></indexterm>
531 <indexterm><primary>PADL Software</primary></indexterm>
532 A network administrator who wants to make significant use of LDAP backends will sooner or later be
533 exposed to the excellent work done by PADL Software. PADL <ulink url="http://www.padl.com"/> have
534 produced and released to open source an array of tools that might be of interest. These tools include:
540 <indexterm><primary>nss_ldap</primary></indexterm>
541 <indexterm><primary>NSS</primary></indexterm>
542 <indexterm><primary>AIX</primary></indexterm>
543 <indexterm><primary>Linux</primary></indexterm>
544 <indexterm><primary>LDAP</primary></indexterm>
545 <indexterm><primary>Solaris</primary></indexterm>
546 <indexterm><primary>UID</primary></indexterm>
547 <indexterm><primary>GID</primary></indexterm>
548 <emphasis>nss_ldap:</emphasis> An LDAP name service switch (NSS) module to provide native
549 name service support for AIX, Linux, Solaris, and other operating systems. This tool
550 can be used for centralized storage and retrieval of UIDs and GIDs.
556 <indexterm><primary>pam_ldap</primary></indexterm>
557 <indexterm><primary>PAM</primary></indexterm>
558 <indexterm><primary>LDAP</primary></indexterm>
559 <indexterm><primary>access authentication</primary></indexterm>
560 <emphasis>pam_ldap:</emphasis> A PAM module that provides LDAP integration for UNIX/Linux
561 system access authentication.
567 <indexterm><primary>idmap_ad</primary></indexterm>
568 <indexterm><primary>IDMAP backend</primary></indexterm>
569 <indexterm><primary>RFC 2307</primary></indexterm>
570 <indexterm><primary>PADL</primary></indexterm>
571 <emphasis>idmap_ad:</emphasis> An IDMAP backend that supports the Microsoft Services for
572 UNIX RFC 2307 schema available from the PADL Web
573 <ulink url="http://www.padl.com/download/xad_oss_plugins.tar.gz">site</ulink>.
581 <title>Comments Regarding LDAP</title>
584 <indexterm><primary>LDAP</primary><secondary>directories</secondary></indexterm>
585 <indexterm><primary>architecture</primary></indexterm>
586 <indexterm><primary>FIM</primary></indexterm>
587 <indexterm><primary>SSO</primary></indexterm>
588 There is much excitement and interest in LDAP directories in the information technology world
589 today. The LDAP architecture was designed to be highly scalable. It was also designed for
590 use across a huge number of potential areas of application encompassing a wide range of operating
591 systems and platforms. LDAP technologies are at the heart of the current generations of Federated
592 Identity Management (FIM) solutions that can underlie a corporate Single Sign-On (SSO) environment.
596 <indexterm><primary>LDAP</primary></indexterm>
597 <indexterm><primary>eDirectory</primary></indexterm>
598 <indexterm><primary>ADS</primary></indexterm>
599 <indexterm><primary>authentication</primary></indexterm>
600 LDAP implementations have been built across a wide variety of platforms. It lies at the core of Microsoft
601 Windows Active Directory services (ADS), Novell's eDirectory, as well as many others. Implementation of the
602 directory services LDAP involves interaction with legacy as well as new generation applications, all of which
603 depend on some form of authentication services.
607 <indexterm><primary>LDAP directory</primary></indexterm>
608 <indexterm><primary>authentication</primary></indexterm>
609 <indexterm><primary>access controls</primary></indexterm>
610 <indexterm><primary>intermediate tools</primary></indexterm>
611 <indexterm><primary>middle-ware</primary></indexterm>
612 <indexterm><primary>central environment</primary></indexterm>
613 <indexterm><primary>infrastructure</primary></indexterm>
614 <indexterm><primary>login shells</primary></indexterm>
615 <indexterm><primary>mail</primary></indexterm>
616 <indexterm><primary>messaging systems</primary></indexterm>
617 <indexterm><primary>quota controls</primary></indexterm>
618 <indexterm><primary>printing systems</primary></indexterm>
619 <indexterm><primary>DNS servers</primary></indexterm>
620 <indexterm><primary>DHCP servers</primary></indexterm>
621 UNIX services can utilize LDAP directory information for authentication and access controls
622 through intermediate tools and utilities. The total environment that consists of the LDAP directory
623 and the middle-ware tools and utilities makes it possible for all user access to the UNIX platform
624 to be managed from a central environment and yet distributed to wherever the point of need may
625 be physically located. Applications that benefit from this infrastructure include: UNIX login
626 shells, mail and messaging systems, quota controls, printing systems, DNS servers, DHCP servers,
631 <indexterm><primary>LDAP</primary></indexterm>
632 <indexterm><primary>passdb backend</primary></indexterm>
633 <indexterm><primary>scalable</primary></indexterm>
634 <indexterm><primary>SAM backend</primary></indexterm>
635 <indexterm><primary>LDAP directory</primary></indexterm>
636 <indexterm><primary>management costs</primary></indexterm>
637 Many sites are installing LDAP for the first time in order to provide a scalable passdb backend
638 for Samba. Others are faced with the need to adapt an existing LDAP directory to new uses such
639 as for the Samba SAM backend. Whatever your particular need and attraction to Samba may be,
640 decisions made in respect of the design of the LDAP directory structure and its implementation
641 are of a durable nature for the site. These have far-reaching implications that affect long-term
642 information systems management costs.
646 <indexterm><primary>LDAP deployment</primary></indexterm>
647 <indexterm><primary>Directory Information Tree</primary><see>DIT</see></indexterm>
648 Do not rush into an LDAP deployment. Take the time to understand how the design of the Directory
649 Information Tree (DIT) may impact current and future site needs, as well as the ability to meet
650 them. The way that Samba SAM information should be stored within the DIT varies from site to site
651 and with each implementation new experience is gained. It is well understood by LDAP veterans that
652 first implementations create awakening, second implementations of LDAP create fear, and
653 third-generation deployments bring peace and tranquility.
657 <title>Caution Regarding LDAP and Samba</title>
660 <indexterm><primary>POSIX identity</primary></indexterm>
661 <indexterm><primary>networking environment</primary></indexterm>
662 <indexterm><primary>user accounts</primary></indexterm>
663 <indexterm><primary>group accounts</primary></indexterm>
664 <indexterm><primary>machine trust accounts</primary></indexterm>
665 <indexterm><primary>interdomain trust accounts</primary></indexterm>
666 <indexterm><primary>intermediate information</primary></indexterm>
667 Samba requires UNIX POSIX identity information as well as a place to store information that is
668 specific to Samba and the Windows networking environment. The most used information that must
669 be dealt with includes: user accounts, group accounts, machine trust accounts, interdomain
670 trust accounts, and intermediate information specific to Samba internals.
674 <indexterm><primary>deployment guidelines</primary></indexterm>
675 <indexterm><primary>HOWTO documents</primary></indexterm>
676 <indexterm><primary>LDAP</primary></indexterm>
677 The example deployment guidelines in this book, as well as other books and HOWTO documents
678 available from the internet may not fit with established directory designs and implementations.
679 The existing DIT may not be able to accommodate the simple information layout proposed in common
680 sources. Additionally, you may find that the common scripts and tools that are used to provision
681 the LDAP directory for use with Samba may not suit your needs.
685 <indexterm><primary>existing LDAP DIT</primary></indexterm>
686 It is not uncommon, for sites that have existing LDAP DITs to find necessity to generate a
687 set of site-specific scripts and utilities to make it possible to deploy Samba within the
688 scope of site operations. The way that user and group accounts are distributed throughout
689 the DIT may make this a challenging matter. The solution will, of course, be rewarding, but
690 the journey to it may be challenging. Take time to understand site needs and do not rush
695 <indexterm><primary>scripts</primary></indexterm>
696 <indexterm><primary>tools</primary></indexterm>
697 Above all, do not blindly use scripts and tools that are not suitable for your site. Check
698 and validate all scripts before you execute them to make sure that the existing infrastructure
699 will not be damaged by inadvertent use of an inappropriate tool.
707 <title>LDAP Directories and Windows Computer Accounts</title>
710 <indexterm><primary>turnkey solution</primary></indexterm>
711 <indexterm><primary>LDAP.</primary></indexterm>
712 <indexterm><primary>frustrating experience</primary></indexterm>
713 Samba doesn't provide a turnkey solution to LDAP. It is best to deal with the design and
714 configuration of an LDAP directory prior to integration with Samba. A working knowledge
715 of LDAP makes Samba integration easy, and the lack of a working knowledge of LDAP can make
716 it a frustrating experience.
720 <indexterm><primary>computer accounts</primary></indexterm>
721 <indexterm><primary>machine accounts</primary></indexterm>
722 <indexterm><primary>LDAP</primary></indexterm>
723 Computer (machine) accounts can be placed wherever you like in an LDAP directory subject
724 to some constraints that are described in this chapter.
728 <indexterm><primary>POSIX</primary></indexterm>
729 <indexterm><primary>sambaSamAccount</primary></indexterm>
730 <indexterm><primary>computer accounts</primary></indexterm>
731 <indexterm><primary>machine accounts</primary></indexterm>
732 <indexterm><primary>Windows NT4/200X</primary></indexterm>
733 <indexterm><primary>user account</primary></indexterm>
734 <indexterm><primary>trust accounts</primary></indexterm>
735 The POSIX and sambaSamAccount components of computer (machine) accounts are both used by Samba.
736 Thus, machine accounts are treated inside Samba in the same way that Windows NT4/200X treats
737 them. A user account and a machine account are indistinguishable from each other, except that
738 the machine account ends in a $ character, as do trust accounts.
742 <indexterm><primary>user</primary></indexterm>
743 <indexterm><primary>group</primary></indexterm>
744 <indexterm><primary>machine</primary></indexterm>
745 <indexterm><primary>trust</primary></indexterm>
746 <indexterm><primary>UID</primary></indexterm>
747 The need for Windows user, group, machine, trust, and other accounts to be tied to a valid UNIX
748 UID is a design decision that was made a long way back in the history of Samba development. It
749 is unlikely that this decision will be reversed or changed during the remaining life of the
754 <indexterm><primary>UID</primary></indexterm>
755 <indexterm><primary>SID</primary></indexterm>
756 <indexterm><primary>NSS</primary></indexterm>
757 The resolution of a UID from the Windows SID is achieved within Samba through a mechanism that
758 must refer back to the host operating system on which Samba is running. The NSS is the preferred
759 mechanism that shields applications (like Samba) from the need to know everything about every
764 <indexterm><primary>UID</primary></indexterm>
765 <indexterm><primary>passwd</primary></indexterm>
766 <indexterm><primary>shadow</primary></indexterm>
767 <indexterm><primary>group</primary></indexterm>
768 <indexterm><primary>NSS</primary></indexterm>
769 <indexterm><primary>winbindd</primary></indexterm>
770 <indexterm><primary>LDAP</primary></indexterm>
771 Samba asks the host OS to provide a UID via the <quote>passwd</quote>, <quote>shadow</quote>,
772 and <quote>group</quote> facilities in the NSS control (configuration) file. The best tool
773 for achieving this is left up to the UNIX administrator to determine. It is not imposed by
774 Samba. Samba provides winbindd with its support libraries as one method. It is
775 possible to do this via LDAP, and for that Samba provides the appropriate hooks so that
776 all account entities can be located in an LDAP directory.
780 <indexterm><primary>PADL</primary></indexterm>
781 <indexterm><primary>nss_ldap</primary></indexterm>
782 <indexterm><primary>UID</primary></indexterm>
783 <indexterm><primary>LDAP</primary></indexterm>
784 <indexterm><primary>documentation</primary></indexterm>
785 For many the weapon of choice is to use the PADL nss_ldap utility. This utility must
786 be configured so that computer accounts can be resolved to a POSIX/UNIX account UID. That
787 is fundamentally an LDAP design question. The information provided on the Samba list and
788 in the documentation is directed at providing working examples only. The design
789 of an LDAP directory is a complex subject that is beyond the scope of this documentation.
796 <sect1 id="acctmgmttools">
797 <title>Account Management Tools</title>
800 <indexterm><primary>pdbedit</primary></indexterm>
801 <indexterm><primary>machine accounts</primary></indexterm>
802 <indexterm><primary>management tools</primary></indexterm>
803 Samba provides two tools for management of user and machine accounts:
804 <command>smbpasswd</command> and <command>pdbedit</command>.
808 <indexterm><primary>pdbedit</primary></indexterm>
809 <indexterm><primary>password aging</primary></indexterm>
810 <indexterm><primary>failed logins</primary></indexterm>
811 The <command>pdbedit</command> can be used to manage account policies in addition to
812 Samba user account information. The policy management capability is used to administer
813 domain default settings for password aging and management controls to handle failed login
818 <indexterm><primary>smbpasswd</primary></indexterm>
819 <indexterm><primary>storage mechanism</primary></indexterm>
820 <indexterm><primary>SambaSAMAccount</primary></indexterm>
821 <indexterm><primary>net</primary></indexterm>
822 Some people are confused when reference is made to <literal>smbpasswd</literal> because the
823 name refers to a storage mechanism for SambaSAMAccount information, but it is also the name
824 of a utility tool. That tool is destined to eventually be replaced by new functionality that
825 is being added to the <command>net</command> toolset (see <link linkend="NetCommand">the Net Command</link>).
829 <title>The <command>smbpasswd</command> Tool</title>
832 <indexterm><primary>smbpasswd</primary></indexterm>
833 <indexterm><primary>passwd</primary></indexterm>
834 <indexterm><primary>yppasswd</primary></indexterm>
835 <indexterm><primary>passdb backend</primary></indexterm>
836 <indexterm><primary>storage methods</primary></indexterm>
837 The <command>smbpasswd</command> utility is similar to the <command>passwd</command>
838 and <command>yppasswd</command> programs. It maintains the two 32 byte password
839 fields in the passdb backend. This utility operates independently of the actual
840 account and password storage methods used (as specified by the <parameter>passdb
841 backend</parameter> in the &smb.conf; file).
845 <indexterm><primary>smbpasswd</primary></indexterm>
846 <indexterm><primary>client-server mode</primary></indexterm>
847 <command>smbpasswd</command> works in a client-server mode where it contacts the
848 local smbd to change the user's password on its behalf. This has enormous benefits.
852 <indexterm><primary>smbpasswd</primary></indexterm>
853 <indexterm><primary>change passwords</primary></indexterm>
854 <command>smbpasswd</command> has the capability to change passwords on Windows NT
855 servers (this only works when the request is sent to the NT PDC if changing an NT
856 domain user's password).
860 <indexterm><primary>user management</primary></indexterm>
861 <indexterm><primary>user account</primary><secondary>Adding/Deleting</secondary></indexterm>
862 <command>smbpasswd</command> can be used to:
866 <listitem><para><emphasis>add</emphasis> user or machine accounts.</para></listitem>
867 <listitem><para><emphasis>delete</emphasis> user or machine accounts.</para></listitem>
868 <listitem><para><emphasis>enable</emphasis> user or machine accounts.</para></listitem>
869 <listitem><para><emphasis>disable</emphasis> user or machine accounts.</para></listitem>
870 <listitem><para><emphasis>set to NULL</emphasis> user passwords.</para></listitem>
871 <listitem><para><emphasis>manage</emphasis> interdomain trust accounts.</para></listitem>
875 To run smbpasswd as a normal user, just type:
880 &prompt;<userinput>smbpasswd</userinput>
881 <prompt>Old SMB password: </prompt><userinput><replaceable>secret</replaceable></userinput>
883 For <replaceable>secret</replaceable>, type the old value here or press return if
884 there is no old password.
886 <prompt>New SMB Password: </prompt><userinput><replaceable>new secret</replaceable></userinput>
887 <prompt>Repeat New SMB Password: </prompt><userinput><replaceable>new secret</replaceable></userinput>
892 If the old value does not match the current value stored for that user, or the two
893 new values do not match each other, then the password will not be changed.
897 <indexterm><primary>SMB password</primary></indexterm>
898 When invoked by an ordinary user, the command will allow only the user to change his or her own
903 <indexterm><primary>smbpasswd</primary></indexterm>
904 <indexterm><primary>SMB password</primary></indexterm>
905 When run by root, <command>smbpasswd</command> may take an optional argument specifying
906 the username whose SMB password you wish to change. When run as root, <command>smbpasswd</command>
907 does not prompt for or check the old password value, thus allowing root to set passwords
908 for users who have forgotten their passwords.
912 <indexterm><primary>smbpasswd</primary></indexterm>
913 <indexterm><primary>passwd</primary></indexterm>
914 <indexterm><primary>yppasswd</primary></indexterm>
915 <indexterm><primary>change capabilities</primary></indexterm>
916 <command>smbpasswd</command> is designed to work in the way familiar to UNIX
917 users who use the <command>passwd</command> or <command>yppasswd</command> commands.
918 While designed for administrative use, this tool provides essential user-level
919 password change capabilities.
923 <indexterm><primary>smbpasswd</primary></indexterm>
924 For more details on using <command>smbpasswd</command>, refer to the man page (the
925 definitive reference).
929 <sect2 id="pdbeditthing">
930 <title>The <command>pdbedit</command> Tool</title>
933 <indexterm><primary>pdbedit</primary></indexterm>
934 <indexterm><primary>User Management</primary></indexterm>
935 <indexterm><primary>account policy</primary></indexterm>
936 <indexterm><primary>User Accounts</primary><secondary>Adding/Deleting</secondary></indexterm>
937 <command>pdbedit</command> is a tool that can be used only by root. It is used to
938 manage the passdb backend, as well as domain-wide account policy settings. <command>pdbedit</command>
943 <listitem><para>add, remove, or modify user accounts.</para></listitem>
944 <listitem><para>list user accounts.</para></listitem>
945 <listitem><para>migrate user accounts.</para></listitem>
946 <listitem><para>migrate group accounts.</para></listitem>
947 <listitem><para>manage account policies.</para></listitem>
948 <listitem><para>manage domain access policy settings.</para></listitem>
952 <indexterm><primary>Sarbanes-Oxley</primary></indexterm>
953 Under the terms of the Sarbanes-Oxley Act of 2002, American businesses and organizations are mandated to
954 implement a series of <literal>internal controls</literal> and procedures to communicate, store,
955 and protect financial data. The Sarbanes-Oxley Act has far reaching implications in respect of:
959 <listitem><para>Who has access to information systems that store financial data.</para></listitem>
960 <listitem><para>How personal and financial information is treated among employees and business
961 partners.</para></listitem>
962 <listitem><para>How security vulnerabilities are managed.</para></listitem>
963 <listitem><para>Security and patch level maintenance for all information systems.</para></listitem>
964 <listitem><para>How information systems changes are documented and tracked.</para></listitem>
965 <listitem><para>How information access controls are implemented and managed.</para></listitem>
966 <listitem><para>Auditability of all information systems in respect of change and security.</para></listitem>
967 <listitem><para>Disciplinary procedures and controls to ensure privacy.</para></listitem>
971 <indexterm><primary>accountability</primary></indexterm>
972 <indexterm><primary>compliance</primary></indexterm>
973 In short, the Sarbanes-Oxley Act of 2002 is an instrument that enforces accountability in respect of
974 business related information systems so as to ensure the compliance of all information systems that
975 are used to store personal information and particularly for financial records processing. Similar
976 accountabilities are being demanded around the world.
980 <indexterm><primary>laws</primary></indexterm>
981 <indexterm><primary>regulations</primary></indexterm>
982 <indexterm><primary>pdbedit</primary></indexterm>
983 <indexterm><primary>access controls</primary></indexterm>
984 <indexterm><primary>manage accounts</primary></indexterm>
985 The need to be familiar with the Samba tools and facilities that permit information systems operation
986 in compliance with government laws and regulations is clear to all. The <command>pdbedit</command> is
987 currently the only Samba tool that provides the capacity to manage account and systems access controls
988 and policies. During the remaining life-cycle of the Samba-3 series it is possible the new tools may
989 be implemented to aid in this important area.
993 Domain global policy controls available in Windows NT4 compared with Samba
994 is shown in <link linkend="policycontrols">NT4 Domain v's Samba Policy Controls</link>.
997 <table id="policycontrols">
998 <title>NT4 Domain v's Samba Policy Controls</title>
1000 <colspec align="left" colwidth="2*"/>
1001 <colspec align="left" colwidth="2*"/>
1002 <colspec align="center" colwidth="1*"/>
1003 <colspec align="center" colwidth="1*"/>
1004 <colspec align="center" colwidth="1*"/>
1007 <entry><para>NT4 policy Name</para></entry>
1008 <entry><para>Samba Policy Name</para></entry>
1009 <entry><para>NT4 Range</para></entry>
1010 <entry><para>Samba Range</para></entry>
1011 <entry><para>Samba Default</para></entry>
1016 <entry><para>Maximum Password Age</para></entry>
1017 <entry><para>maximum password age</para></entry>
1018 <entry><para>0 - 999 (days)</para></entry>
1019 <entry><para>0 - 4294967295 (sec)</para></entry>
1020 <entry><para>4294967295</para></entry>
1023 <entry><para>Minimum Password Age</para></entry>
1024 <entry><para>minimum password age</para></entry>
1025 <entry><para>0 - 999 (days)</para></entry>
1026 <entry><para>0 - 4294967295 (sec)</para></entry>
1027 <entry><para>0</para></entry>
1030 <entry><para>Minimum Password Length</para></entry>
1031 <entry><para>min password length</para></entry>
1032 <entry><para>1 - 14 (Chars)</para></entry>
1033 <entry><para>0 - 4294967295 (Chars)</para></entry>
1034 <entry><para>5</para></entry>
1037 <entry><para>Password Uniqueness</para></entry>
1038 <entry><para>password history</para></entry>
1039 <entry><para>0 - 23 (#)</para></entry>
1040 <entry><para>0 - 4294967295 (#)</para></entry>
1041 <entry><para>0</para></entry>
1044 <entry><para>Account Lockout - Reset count after</para></entry>
1045 <entry><para>reset count minutes</para></entry>
1046 <entry><para>1 - 99998 (min)</para></entry>
1047 <entry><para>0 - 4294967295 (min)</para></entry>
1048 <entry><para>30</para></entry>
1051 <entry><para>Lockout after bad logon attempts</para></entry>
1052 <entry><para>bad lockout attempt</para></entry>
1053 <entry><para>0 - 998 (#)</para></entry>
1054 <entry><para>0 - 4294967295 (#)</para></entry>
1055 <entry><para>0</para></entry>
1058 <entry><para>*** Not Known ***</para></entry>
1059 <entry><para>disconnect time</para></entry>
1060 <entry><para>TBA</para></entry>
1061 <entry><para>0 - 4294967295</para></entry>
1062 <entry><para>0</para></entry>
1065 <entry><para>Lockout Duration</para></entry>
1066 <entry><para>lockout duration</para></entry>
1067 <entry><para>1 - 99998 (min)</para></entry>
1068 <entry><para>0 - 4294967295 (min)</para></entry>
1069 <entry><para>30</para></entry>
1072 <entry><para>Users must log on in order to change password</para></entry>
1073 <entry><para>user must logon to change password</para></entry>
1074 <entry><para>0/1</para></entry>
1075 <entry><para>0 - 4294967295</para></entry>
1076 <entry><para>0</para></entry>
1079 <entry><para>*** Registry Setting ***</para></entry>
1080 <entry><para>refuse machine password change</para></entry>
1081 <entry><para>0/1</para></entry>
1082 <entry><para>0 - 4294967295</para></entry>
1083 <entry><para>0</para></entry>
1090 <indexterm><primary>pdbedit</primary></indexterm>
1091 <indexterm><primary>policy settings</primary></indexterm>
1092 <indexterm><primary>account security</primary></indexterm>
1093 <indexterm><primary>smbpasswd</primary></indexterm>
1094 The <command>pdbedit</command> tool is the only one that can manage the account
1095 security and policy settings. It is capable of all operations that smbpasswd can
1096 do as well as a superset of them.
1100 <indexterm><primary>pdbedit</primary></indexterm>
1101 <indexterm><primary>account import/export</primary></indexterm>
1102 <indexterm><primary>passdb backend</primary></indexterm>
1103 One particularly important purpose of the <command>pdbedit</command> is to allow
1104 the import/export of account information from one passdb backend to another.
1108 <title>User Account Management</title>
1111 <indexterm><primary>pdbedit</primary></indexterm>
1112 <indexterm><primary>smbpasswd</primary></indexterm>
1113 <indexterm><primary>system accounts</primary></indexterm>
1114 <indexterm><primary>user account</primary></indexterm>
1115 <indexterm><primary>domain user manager</primary></indexterm>
1116 <indexterm><primary>add user script</primary></indexterm>
1117 <indexterm><primary>interface scripts</primary></indexterm>
1118 The <command>pdbedit</command> tool, like the <command>smbpasswd</command> tool, requires
1119 that a POSIX user account already exists in the UNIX/Linux system accounts database (backend).
1120 Neither tool will call out to the operating system to create a user account because this is
1121 considered to be the responsibility of the system administrator. When the Windows NT4 domain
1122 user manager is used to add an account, Samba will implement the <literal>add user script</literal>
1123 (as well as the other interface scripts) to ensure that user, group and machine accounts are
1124 correctly created and changed. The use of the <command>pdbedit</command> tool does not
1125 make use of these interface scripts.
1129 <indexterm><primary>pdbedit</primary></indexterm>
1130 <indexterm><primary>POSIX account</primary></indexterm>
1131 Before attempting to use the <command>pdbedit</command> tool to manage user and machine
1132 accounts, make certain that a system (POSIX) account has already been created.
1136 <title>Listing User and Machine Accounts</title>
1139 <indexterm><primary>tdbsam</primary></indexterm>
1140 <indexterm><primary>password backend</primary></indexterm>
1141 The following is an example of the user account information that is stored in
1142 a tdbsam password backend. This listing was produced by running:
1144 &prompt;<userinput>pdbedit -Lv met</userinput>
1148 User SID: S-1-5-21-1449123459-1407424037-3116680435-2004
1149 Primary Group SID: S-1-5-21-1449123459-1407424037-3116680435-1201
1150 Full Name: Melissa E Terpstra
1151 Home Directory: \\frodo\met\Win9Profile
1153 Logon Script: scripts\logon.bat
1154 Profile Path: \\frodo\Profiles\met
1155 Domain: &example.workgroup;
1157 Workstations: melbelle
1160 Logoff time: Mon, 18 Jan 2038 20:14:07 GMT
1161 Kickoff time: Mon, 18 Jan 2038 20:14:07 GMT
1162 Password last set: Sat, 14 Dec 2002 14:37:03 GMT
1163 Password can change: Sat, 14 Dec 2002 14:37:03 GMT
1164 Password must change: Mon, 18 Jan 2038 20:14:07 GMT
1169 <indexterm><primary>smbpasswd format</primary></indexterm>
1170 Accounts can also be listed in the older <literal>smbpasswd</literal> format:
1172 &rootprompt;<userinput>pdbedit -Lw</userinput>
1173 root:0:84B0D8E14D158FF8417EAF50CFAC29C3:
1174 AF6DD3FD4E2EA8BDE1695A3F05EFBF52:[U ]:LCT-42681AB8:
1175 jht:1000:6BBC4159020A52741486235A2333E4D2:
1176 CC099521AD554A3C3CF2556274DBCFBC:[U ]:LCT-40D75B5B:
1177 rcg:1002:E95D4331A6F23AF8AAD3B435B51404EE:
1178 BB0F2C39B04CA6100F0E535DF8314B43:[U ]:LCT-40D7C5A3:
1179 afw:1003:1AAFA7F9F6DC1DEAAAD3B435B51404EE:
1180 CE92C2F9471594CDC4E7860CA6BC62DB:[T ]:LCT-40DA501F:
1181 met:1004:A2848CB7E076B435AAD3B435B51404EE:
1182 F25F5D3405085C555236B80B7B22C0D2:[U ]:LCT-4244FAB8:
1183 aurora$:1005:060DE593EA638B8ACC4A19F14D2FF2BB:
1184 060DE593EA638B8ACC4A19F14D2FF2BB:[W ]:LCT-4173E5CC:
1185 temptation$:1006:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:
1186 A96703C014E404E33D4049F706C45EE9:[W ]:LCT-42BF0C57:
1187 vaioboss$:1001:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:
1188 88A30A095160072784C88F811E89F98A:[W ]:LCT-41C3878D:
1189 frodo$:1008:15891DC6B843ECA41249940C814E316B:
1190 B68EADCCD18E17503D3DAD3E6B0B9A75:[W ]:LCT-42B7979F:
1191 marvel$:1011:BF709959C3C94E0B3958B7B84A3BB6F3:
1192 C610EFE9A385A3E8AA46ADFD576E6881:[W ]:LCT-40F07A4
1194 <indexterm><primary>login id</primary></indexterm>
1195 <indexterm><primary>UID</primary></indexterm>
1196 <indexterm><primary>LanManger password</primary></indexterm>
1197 <indexterm><primary>NT password</primary></indexterm>
1198 <indexterm><primary>Account Flags</primary></indexterm>
1199 <indexterm><primary>LCT</primary><see>last change time</see></indexterm>
1200 The account information that was returned by this command in order from left to right
1201 consists of the following colon separated data:
1205 <listitem><para>Login ID.</para></listitem>
1206 <listitem><para>UNIX UID.</para></listitem>
1208 <para>Microsoft LanManager password hash (password converted to upper-case then hashed).</para>
1210 <listitem><para>Microsoft NT password hash (hash of the case-preserved password).</para></listitem>
1211 <listitem><para>Samba SAM Account Flags.</para></listitem>
1212 <listitem><para>The LCT data (password last change time).</para></listitem>
1216 <indexterm><primary>Account Flags</primary></indexterm>
1217 <indexterm><primary>pdbedit</primary></indexterm>
1218 The Account Flags parameters are documented in the <command>pdbedit</command> man page, and are
1219 briefly documented in <link linkend="TOSHARG-acctflags">the Account Flags Management section</link>.
1223 <indexterm><primary>last change time</primary></indexterm>
1224 The LCT data consists of 8 hexadecimal characters representing the time since January 1, 1970, of
1225 the time when the password was last changed.
1231 <title>Adding User Accounts</title>
1234 <indexterm><primary>pdbedit</primary></indexterm>
1235 <indexterm><primary>add a user account</primary></indexterm>
1236 <indexterm><primary>standalone server</primary></indexterm>
1237 <indexterm><primary>domain</primary></indexterm>
1238 <indexterm><primary>SambaSAMAccount</primary></indexterm>
1239 The <command>pdbedit</command> can be used to add a user account to a standalone server
1240 or to a domain. In the example shown here the account for the user <literal>vlaan</literal>
1241 has been created before attempting to add the SambaSAMAccount.
1243 &rootprompt; pdbedit -a vlaan
1244 new password: secretpw
1245 retype new password: secretpw
1246 Unix username: vlaan
1249 User SID: S-1-5-21-726309263-4128913605-1168186429-3014
1250 Primary Group SID: S-1-5-21-726309263-4128913605-1168186429-513
1251 Full Name: Victor Laan
1252 Home Directory: \\frodo\vlaan
1254 Logon Script: scripts\logon.bat
1255 Profile Path: \\frodo\profiles\vlaan
1256 Domain: &example.workgroup;
1257 Account desc: Guest User
1261 Logoff time: Mon, 18 Jan 2038 20:14:07 GMT
1262 Kickoff time: Mon, 18 Jan 2038 20:14:07 GMT
1263 Password last set: Wed, 29 Jun 2005 19:35:12 GMT
1264 Password can change: Wed, 29 Jun 2005 19:35:12 GMT
1265 Password must change: Mon, 18 Jan 2038 20:14:07 GMT
1266 Last bad password : 0
1267 Bad password count : 0
1268 Logon hours : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
1275 <title>Deleting Accounts</title>
1278 <indexterm><primary>account deleted</primary></indexterm>
1279 <indexterm><primary>SambaSAMAccount</primary></indexterm>
1280 <indexterm><primary>pdbedit</primary></indexterm>
1281 <indexterm><primary>passdb backend</primary></indexterm>
1282 An account can be deleted from the SambaSAMAccount database
1284 &rootprompt; pdbedit -x vlaan
1286 The account is removed without further screen output. The account is removed only from the
1287 SambaSAMAccount (passdb backend) database, it is not removed from the UNIX account backend.
1291 <indexterm><primary>delete user script</primary></indexterm>
1292 <indexterm><primary>pdbedit</primary></indexterm>
1293 The use of the NT4 domain user manager to delete an account will trigger the <parameter>delete user
1294 script</parameter>, but not the <command>pdbedit</command> tool.
1300 <title>Changing User Accounts</title>
1303 <indexterm><primary>pdbedit</primary></indexterm>
1304 Refer to the <command>pdbedit</command> man page for a full synopsis of all operations
1305 that are available with this tool.
1309 <indexterm><primary>pdbedit</primary></indexterm>
1310 An example of a simple change in the user account information is the change of the full name
1311 information shown here:
1313 &rootprompt; pdbedit -r --fullname="Victor Aluicious Laan" vlaan
1315 Primary Group SID: S-1-5-21-726309263-4128913605-1168186429-513
1316 Full Name: Victor Aluicious Laan
1317 Home Directory: \\frodo\vlaan
1323 <indexterm><primary>grace time</primary></indexterm>
1324 <indexterm><primary>password expired</primary></indexterm>
1325 <indexterm><primary>expired password</primary></indexterm>
1326 Let us assume for a moment that a user's password has expired and the user is unable to
1327 change the password at this time. It may be necessary to give the user additional grace time
1328 so that it is possible to continue to work with the account and the original password. This
1329 demonstrates how the password expiration settings may be updated
1331 &rootprompt; pdbedit -Lv vlaan
1333 Password last set: Sun, 09 Sep 2001 22:21:40 GMT
1334 Password can change: Thu, 03 Jan 2002 15:08:35 GMT
1335 Password must change: Thu, 03 Jan 2002 15:08:35 GMT
1336 Last bad password : Thu, 03 Jan 2002 15:08:35 GMT
1337 Bad password count : 2
1340 <indexterm><primary>bad logon attempts</primary></indexterm>
1341 <indexterm><primary>lock the account</primary></indexterm>
1342 The user has recorded 2 bad logon attempts and the next will lock the account, but the
1343 password is also expired. Here is how this account can be reset:
1345 &rootprompt; pdbedit -z vlaan
1347 Password last set: Sun, 09 Sep 2001 22:21:40 GMT
1348 Password can change: Thu, 03 Jan 2002 15:08:35 GMT
1349 Password must change: Thu, 03 Jan 2002 15:08:35 GMT
1350 Last bad password : 0
1351 Bad password count : 0
1354 The <literal>Password must change:</literal> parameter can be reset like this:
1356 &rootprompt; pdbedit --pwd-must-change-time=1200000000 vlaan
1358 Password last set: Sun, 09 Sep 2001 22:21:40 GMT
1359 Password can change: Thu, 03 Jan 2002 15:08:35 GMT
1360 Password must change: Thu, 10 Jan 2008 14:20:00 GMT
1363 Another way to use this tools is to set the date like this:
1365 &rootprompt; pdbedit --pwd-must-change-time="2010-01-01" \
1366 --time-format="%Y-%m-%d" vlaan
1368 Password last set: Sun, 09 Sep 2001 22:21:40 GMT
1369 Password can change: Thu, 03 Jan 2002 15:08:35 GMT
1370 Password must change: Fri, 01 Jan 2010 00:00:00 GMT
1373 <indexterm><primary>strptime</primary></indexterm>
1374 <indexterm><primary>time format</primary></indexterm>
1375 Refer to the strptime man page for specific time format information.
1379 <indexterm><primary>pdbedit</primary></indexterm>
1380 <indexterm><primary>SambaSAMAccount</primary></indexterm>
1381 Please refer to the pdbedit man page for further information relating to SambaSAMAccount
1385 <sect5 id="TOSHARG-acctflags">
1386 <title>Account Flags Management</title>
1389 <indexterm><primary>Samba SAM account flags</primary></indexterm>
1390 <indexterm><primary>account control block</primary><see>ACB</see></indexterm>
1391 <indexterm><primary>account encode_bits</primary></indexterm>
1392 <indexterm><primary>account control flags</primary></indexterm>
1393 The Samba SAM account flags are properly called the ACB (account control block) within
1394 the Samba source code. In some parts of the Samba source code they are referred to as the
1395 account encode_bits, and also as the account control flags.
1399 <indexterm><primary>pdbedit</primary></indexterm>
1400 <indexterm><primary>user account</primary></indexterm>
1401 <indexterm><primary>machine account</primary></indexterm>
1402 <indexterm><primary>trust account</primary></indexterm>
1403 <indexterm><primary>damaged data</primary></indexterm>
1404 The manual adjustment of user, machine (workstation or server) or an inter-domain trust
1405 account account flgas should not be necessary under normal conditions of use of Samba. On the other hand,
1406 where this information becomes corrupted for some reason, the ability to correct the damaged data is certainly
1407 useful. The tool of choice by which such correction can be affected is the <command>pdbedit</command> utility.
1411 <indexterm><primary>account flags</primary></indexterm>
1412 <indexterm><primary>LDAP directory</primary></indexterm>
1413 There have been a few requests for information regarding the account flags from developers
1414 who are creating their own Samba management tools. An example of a need for information regarding
1415 the proper management of the account flags is evident when developing scripts that will be used
1416 to manage an LDAP directory.
1420 <indexterm><primary>pdbedit</primary></indexterm>
1421 <indexterm><primary>account flag order</primary></indexterm>
1422 The account flag field can contain up to 16 characters. Presently, only 11 are in use.
1423 These are listed in <link linkend="accountflags">Samba SAM Account Control Block Flags</link>.
1424 The order in which the flags are specified to the <command>pdbedit</command> command is not important.
1425 In fact, they can be set without problem in any order in the SambaAcctFlags record in the LDAP directory.
1428 <table frame="all" id="accountflags">
1429 <title>Samba SAM Account Control Block Flags</title>
1430 <tgroup cols="2" align="center">
1432 <row><entry align="center">Flag</entry><entry>Description</entry></row>
1436 <entry align="center">D</entry>
1437 <entry align="left">Account is disabled.</entry>
1440 <entry align="center">H</entry>
1441 <entry align="left">A home directory is required.</entry>
1444 <entry align="center">I</entry>
1445 <entry align="left">An inter-domain trust account.</entry>
1448 <entry align="center">L</entry>
1449 <entry align="left">Account has been auto-locked.</entry>
1452 <entry align="center">M</entry>
1453 <entry align="left">An MNS (Microsoft network service) logon account.</entry>
1456 <entry align="center">N</entry>
1457 <entry align="left">Password not required.</entry>
1460 <entry align="center">S</entry>
1461 <entry align="left">A server trust account.</entry>
1464 <entry align="center">T</entry>
1465 <entry align="left">Temporary duplicate account entry.</entry>
1468 <entry align="center">U</entry>
1469 <entry align="left">A normal user account.</entry>
1472 <entry align="center">W</entry>
1473 <entry align="left">A workstation trust account.</entry>
1476 <entry align="center">X</entry>
1477 <entry align="left">Password does not expire.</entry>
1484 <indexterm><primary>pdbedit</primary></indexterm>
1485 <indexterm><primary>account control flags</primary></indexterm>
1486 An example of use of the <command>pdbedit</command> utility to set the account control flags
1489 &rootprompt; pdbedit -r -c "[DLX]" jht
1492 Account Flags: [DHULX ]
1493 User SID: S-1-5-21-729263-4123605-1186429-3000
1494 Primary Group SID: S-1-5-21-729263-4123605-1186429-513
1495 Full Name: John H Terpstra,Utah Office
1496 Home Directory: \\aurora\jht
1498 Logon Script: scripts\logon.bat
1499 Profile Path: \\aurora\profiles\jht
1501 Account desc: BluntObject
1504 Logoff time: Mon, 18 Jan 2038 20:14:07 GMT
1506 Password last set: Sun, 03 Jul 2005 23:19:18 GMT
1507 Password can change: Sun, 03 Jul 2005 23:19:18 GMT
1508 Password must change: Mon, 18 Jan 2038 20:14:07 GMT
1509 Last bad password : 0
1510 Bad password count : 0
1511 Logon hours : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
1513 <indexterm><primary>default settings</primary></indexterm>
1514 The flags can be reset to the default settings by executing:
1516 &rootprompt; pdbedit -r -c "[]" jht
1520 User SID: S-1-5-21-729263-4123605-1186429-3000
1521 Primary Group SID: S-1-5-21-729263-4123605-1186429-513
1522 Full Name: John H Terpstra,Utah Office
1523 Home Directory: \\aurora\jht
1525 Logon Script: scripts\logon.bat
1526 Profile Path: \\aurora\profiles\jht
1528 Account desc: BluntObject
1531 Logoff time: Mon, 18 Jan 2038 20:14:07 GMT
1533 Password last set: Sun, 03 Jul 2005 23:19:18 GMT
1534 Password can change: Sun, 03 Jul 2005 23:19:18 GMT
1535 Password must change: Mon, 18 Jan 2038 20:14:07 GMT
1536 Last bad password : 0
1537 Bad password count : 0
1538 Logon hours : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
1547 <title>Domain Account Policy Managment</title>
1550 <indexterm><primary>domain account access policies</primary></indexterm>
1551 <indexterm><primary>access policies</primary></indexterm>
1552 To view the domain account access policies that may be configured execute:
1554 &rootprompt; pdbedit -P ?
1555 No account policy by that name
1556 Account policy names are :
1559 user must logon to change password
1560 maximum password age
1561 minimum password age
1566 refuse machine password change
1571 Commands will be executed to establish controls for our domain as follows:
1575 <listitem><para>min password length = 8 characters.</para></listitem>
1576 <listitem><para>password history = last 4 passwords.</para></listitem>
1577 <listitem><para>maximum password age = 90 days.</para></listitem>
1578 <listitem><para>minimum password age = 7 days.</para></listitem>
1579 <listitem><para>bad lockout attempt = 8 bad logon attempts.</para></listitem>
1580 <listitem><para>lockout duration = forever, account must be manually reenabled.</para></listitem>
1584 The following command execution will achieve these settings:
1586 &rootprompt; pdbedit -P "min password length" -C 8
1587 account policy value for min password length was 5
1588 account policy value for min password length is now 8
1589 &rootprompt; pdbedit -P "password history" -C 4
1590 account policy value for password history was 0
1591 account policy value for password history is now 4
1592 &rootprompt; pdbedit -P "maximum password age" -C 7776000
1593 account policy value for maximum password age was 4294967295
1594 account policy value for maximum password age is now 7776000
1595 &rootprompt; pdbedit -P "minimum password age" -C 604800
1596 account policy value for minimum password age was 0
1597 account policy value for minimum password age is now 7
1598 &rootprompt; pdbedit -P "bad lockout attempt" -C 8
1599 account policy value for bad lockout attempt was 0
1600 account policy value for bad lockout attempt is now 8
1601 &rootprompt; pdbedit -P "lockout duration" -C -1
1602 account policy value for lockout duration was 30
1603 account policy value for lockout duration is now 4294967295
1608 To set the maximum (infinite) lockout time use the value of -1.
1612 Account policies must be set individually on each PDC and BDC. At this time (Samba 3.0.11 to Samba 3.0.14a)
1613 account policies are not replicated automatically. This may be fixed before Samba 3.0.20 ships or some
1614 time there after. Please check the WHATSNEW.txt file in the Samba-3 tarball for specific update notiations
1615 regarding this facility.
1623 <title>Account Import/Export</title>
1626 <indexterm><primary>pdbedit</primary></indexterm>
1627 <indexterm><primary>account import/export</primary></indexterm>
1628 <indexterm><primary>authentication</primary></indexterm>
1629 The <command>pdbedit</command> tool allows import/export of authentication (account)
1630 databases from one backend to another. For example, to import/export accounts from an
1631 old <filename>smbpasswd</filename> database to a <parameter>tdbsam</parameter>
1637 <indexterm><primary>pdbedit</primary></indexterm>
1639 &rootprompt;<userinput>pdbedit -i smbpasswd -e tdbsam</userinput>
1644 <indexterm><primary>smbpasswd</primary></indexterm>
1645 Replace the <parameter>smbpasswd</parameter> with <parameter>tdbsam</parameter> in the
1646 <parameter>passdb backend</parameter> configuration in &smb.conf;.
1655 <title>Password Backends</title>
1658 <indexterm><primary>account database</primary></indexterm>
1659 <indexterm><primary>SMB/CIFS server</primary></indexterm>
1660 Samba offers flexibility in backend account database design. The flexibility is immediately obvious as one
1661 begins to explore this capability. Recent changes to Samba (since 3.0.23) have removed the mulitple backend
1662 feature in order to simplify problems that broke some installations. This removal has made the internal
1663 operation of Samba-3 more consistent and predictable.
1667 <indexterm><primary>multiple backends</primary></indexterm>
1668 <indexterm><primary>tdbsam databases</primary></indexterm>
1669 Beginning with Samba 3.0.23 it is no longer possible to specify use of mulitple passdb backends. Earlier
1670 versions of Samba-3 made it possible to specify multiple password backends, and even multiple
1671 backends of the same type. The multiple passdb backend capability caused many problems with name to SID and
1672 SID to name ID resolution. The Samba team wrestled with the challenges and decided that this feature needed
1677 <title>Plaintext</title>
1680 <indexterm><primary>user database</primary></indexterm>
1681 <indexterm><primary>/etc/samba/smbpasswd</primary></indexterm>
1682 <indexterm><primary>/etc/smbpasswd</primary></indexterm>
1683 <indexterm><primary>password encryption</primary></indexterm>
1684 <indexterm><primary>/etc/passwd</primary></indexterm>
1685 <indexterm><primary>PAM</primary></indexterm>
1686 Older versions of Samba retrieved user information from the UNIX user database
1687 and eventually some other fields from the file <filename>/etc/samba/smbpasswd</filename>
1688 or <filename>/etc/smbpasswd</filename>. When password encryption is disabled, no
1689 SMB-specific data is stored at all. Instead, all operations are conducted via the way
1690 that the Samba host OS will access its <filename>/etc/passwd</filename> database.
1691 On most Linux systems, for example, all user and group resolution is done via PAM.
1697 <title>smbpasswd: Encrypted Password Database</title>
1700 <indexterm><primary>SAM backend</primary><secondary>smbpasswd</secondary></indexterm>
1701 <indexterm><primary>user account</primary></indexterm>
1702 <indexterm><primary>LM/NT password hashes</primary></indexterm>
1703 <indexterm><primary>smbpasswd</primary></indexterm>
1704 Traditionally, when configuring <smbconfoption name="encrypt passwords">yes</smbconfoption>
1705 in Samba's &smb.conf; file, user account information such as username, LM/NT password hashes,
1706 password change times, and account flags have been stored in the <filename>smbpasswd(5)</filename>
1707 file. There are several disadvantages to this approach for sites with large numbers of users
1708 (counted in the thousands).
1713 <indexterm><primary>lookups</primary></indexterm>
1714 The first problem is that all lookups must be performed sequentially. Given that
1715 there are approximately two lookups per domain logon (one during initial logon validation
1716 and one for a session connection setup, such as when mapping a network drive or printer), this
1717 is a performance bottleneck for large sites. What is needed is an indexed approach
1718 such as that used in databases.
1722 <indexterm><primary>smbpasswd</primary></indexterm>
1723 <indexterm><primary>replicate</primary></indexterm>
1724 <indexterm><primary>rsync</primary></indexterm>
1725 <indexterm><primary>ssh</primary></indexterm>
1726 <indexterm><primary>custom scripts</primary></indexterm>
1727 The second problem is that administrators who desire to replicate an smbpasswd file
1728 to more than one Samba server are left to use external tools such as
1729 <command>rsync(1)</command> and <command>ssh(1)</command> and write custom,
1734 <indexterm><primary>smbpasswd</primary></indexterm>
1735 <indexterm><primary>home directory</primary></indexterm>
1736 <indexterm><primary>password expiration</primary></indexterm>
1737 <indexterm><primary>relative identifier</primary></indexterm>
1738 <indexterm><primary>relative identifier</primary><see>RID</see></indexterm>
1739 Finally, the amount of information that is stored in an smbpasswd entry leaves
1740 no room for additional attributes such as a home directory, password expiration time,
1741 or even a relative identifier (RID).
1746 <indexterm><primary>user attributes</primary></indexterm>
1747 <indexterm><primary>smbd</primary></indexterm>
1748 <indexterm><primary>API</primary></indexterm>
1749 <indexterm><primary>samdb interface</primary></indexterm>
1750 As a result of these deficiencies, a more robust means of storing user attributes
1751 used by smbd was developed. The API that defines access to user accounts
1752 is commonly referred to as the samdb interface (previously, this was called the passdb
1753 API and is still so named in the Samba source code trees).
1757 <indexterm><primary>passdb backends</primary></indexterm>
1758 <indexterm><primary>smbpasswd plaintext database</primary></indexterm>
1759 <indexterm><primary>tdbsam</primary></indexterm>
1760 <indexterm><primary>ldapsam</primary></indexterm>
1761 <indexterm><primary>enterprise</primary></indexterm>
1762 Samba provides an enhanced set of passdb backends that overcome the deficiencies
1763 of the smbpasswd plaintext database. These are tdbsam and ldapsam.
1764 Of these, ldapsam will be of most interest to large corporate or enterprise sites.
1770 <title>tdbsam</title>
1773 <indexterm><primary>SAM backend</primary><secondary>tdbsam</secondary></indexterm>
1774 <indexterm><primary>trivial database</primary><see>TDB</see></indexterm>
1775 <indexterm><primary>machine account</primary></indexterm>
1776 Samba can store user and machine account data in a <quote>TDB</quote> (trivial database).
1777 Using this backend does not require any additional configuration. This backend is
1778 recommended for new installations that do not require LDAP.
1782 <indexterm><primary>tdbsam</primary></indexterm>
1783 <indexterm><primary>PDC</primary></indexterm>
1784 <indexterm><primary>BDC</primary></indexterm>
1785 <indexterm><primary>scalability</primary></indexterm>
1786 As a general guide, the Samba Team does not recommend using the tdbsam backend for sites
1787 that have 250 or more users. Additionally, tdbsam is not capable of scaling for use
1788 in sites that require PDB/BDC implementations that require replication of the account
1789 database. Clearly, for reason of scalability, the use of ldapsam should be encouraged.
1793 <indexterm><primary>250-user limit</primary></indexterm>
1794 <indexterm><primary>performance-based</primary></indexterm>
1795 <indexterm><primary>tdbsam</primary></indexterm>
1796 The recommendation of a 250-user limit is purely based on the notion that this
1797 would generally involve a site that has routed networks, possibly spread across
1798 more than one physical location. The Samba Team has not at this time established
1799 the performance-based scalability limits of the tdbsam architecture.
1803 <indexterm><primary>4,500 user accounts</primary></indexterm>
1804 <indexterm><primary>passdb backend</primary></indexterm>
1805 <indexterm><primary>tdbsam</primary></indexterm>
1806 <indexterm><primary>SambaSAMAccount</primary></indexterm>
1807 There are sites that have thousands of users and yet require only one server.
1808 One site recently reported having 4,500 user accounts on one UNIX system and
1809 reported excellent performance with the <literal>tdbsam</literal> passdb backend.
1810 The limitation of where the <literal>tdbsam</literal> passdb backend can be used
1811 is not one pertaining to a limitation in the TDB storage system, it is based
1812 only on the need for a reliable distribution mechanism for the SambaSAMAccount
1819 <title>ldapsam</title>
1822 <indexterm><primary>LDAP</primary></indexterm>
1823 <indexterm><primary>ldapsam</primary></indexterm>
1824 <indexterm><primary>SAM backend</primary><secondary>ldapsam</secondary></indexterm>
1825 There are a few points to stress that the ldapsam does not provide. The LDAP
1826 support referred to in this documentation does not include:
1830 <listitem><para>A means of retrieving user account information from
1831 a Windows 200x Active Directory server.</para></listitem>
1832 <listitem><para>A means of replacing /etc/passwd.</para></listitem>
1836 <indexterm><primary>LDAP</primary></indexterm>
1837 <indexterm><primary>NSS</primary></indexterm>
1838 <indexterm><primary>PAM</primary></indexterm>
1839 <indexterm><primary>LGPL</primary></indexterm>
1840 The second item can be accomplished by using LDAP NSS and PAM modules. LGPL versions of these libraries can be
1841 obtained from <ulink url="http://www.padl.com/">PADL Software</ulink>. More information about the
1842 configuration of these packages may be found in <ulink url="http://safari.oreilly.com/?XmlId=1-56592-491-6">
1843 <emphasis>LDAP, System Administration</emphasis> by Gerald Carter, Chapter 6, Replacing NIS"</ulink>.
1847 <indexterm><primary>LDAP directory</primary></indexterm>
1848 <indexterm><primary>smbpasswd</primary></indexterm>
1849 <indexterm><primary>directory server</primary></indexterm>
1850 This document describes how to use an LDAP directory for storing Samba user
1851 account information traditionally stored in the smbpasswd(5) file. It is
1852 assumed that the reader already has a basic understanding of LDAP concepts
1853 and has a working directory server already installed. For more information
1854 on LDAP architectures and directories, please refer to the following sites:
1858 <listitem><para><ulink url="http://www.openldap.org/">OpenLDAP</ulink></para></listitem>
1859 <listitem><para><ulink url="http://www.sun.com/software/products/directory_srvr_ee/index.xml">
1860 Sun One Directory Server</ulink></para></listitem>
1861 <listitem><para><ulink url="http://www.novell.com/products/edirectory/">Novell eDirectory</ulink></para></listitem>
1862 <listitem><para><ulink url="http://www-306.ibm.com/software/tivoli/products/directory-server/">IBM
1863 Tivoli Directory Server</ulink></para></listitem>
1864 <listitem><para><ulink url="http://www.redhat.com/software/rha/directory/">Red Hat Directory
1865 Server</ulink></para></listitem>
1866 <listitem><para><ulink url="http://www.linuxsecurity.com/content/view/119229">Fedora Directory
1867 Server</ulink></para></listitem>
1871 Two additional Samba resources that may prove to be helpful are:
1876 <indexterm><primary>Samba-PDC-LDAP-HOWTO</primary></indexterm>
1877 The <ulink url="http://www.unav.es/cti/ldap-smb/ldap-smb-3-howto.html">Samba-PDC-LDAP-HOWTO</ulink>
1878 maintained by Ignacio Coupeau.
1882 <indexterm><primary>IDEALX</primary></indexterm>
1883 <indexterm><primary>NT migration scripts</primary></indexterm>
1884 <indexterm><primary>smbldap-tools</primary></indexterm>
1885 The NT migration scripts from <ulink url="http://samba.idealx.org/">IDEALX</ulink> that are
1886 geared to manage users and groups in such a Samba-LDAP domain controller configuration.
1887 Idealx also produced the smbldap-tools and the Interactive Console Management tool.
1892 <title>Supported LDAP Servers</title>
1895 <indexterm><primary>LDAP</primary></indexterm>
1896 <indexterm><primary>ldapsam</primary></indexterm>
1897 <indexterm><primary>OpenLDAP</primary></indexterm>
1898 <indexterm><primary>Netscape's Directory Server</primary></indexterm>
1899 The LDAP ldapsam code was developed and tested using the OpenLDAP 2.x server and
1900 client libraries. The same code should work with Netscape's Directory Server and client SDK.
1901 However, there are bound to be compile errors and bugs. These should not be hard to fix.
1902 Please submit fixes via the process outlined in <link linkend="bugreport">Reporting Bugs</link>.
1906 Samba is capable of working with any standards-compliant LDAP server.
1912 <title>Schema and Relationship to the RFC 2307 posixAccount</title>
1916 Samba-3.0 includes the necessary schema file for OpenLDAP 2.x in the
1917 <filename>examples/LDAP/samba.schema</filename> directory of the source code distribution
1918 tarball. The schema entry for the sambaSamAccount ObjectClass is shown here:
1920 ObjectClass (1.3.6.1.4.1.7165.2.2.6 NAME 'sambaSamAccount' SUP top AUXILIARY
1921 DESC 'Samba-3.0 Auxiliary SAM Account'
1922 MUST ( uid $ sambaSID )
1923 MAY ( cn $ sambaLMPassword $ sambaNTPassword $ sambaPwdLastSet $
1924 sambaLogonTime $ sambaLogoffTime $ sambaKickoffTime $
1925 sambaPwdCanChange $ sambaPwdMustChange $ sambaAcctFlags $
1926 displayName $ sambaHomePath $ sambaHomeDrive $ sambaLogonScript $
1927 sambaProfilePath $ description $ sambaUserWorkstations $
1928 sambaPrimaryGroupSID $ sambaDomainName ))
1933 <indexterm><primary>samba.schema</primary></indexterm>
1934 <indexterm><primary>OpenLDAP</primary></indexterm>
1935 <indexterm><primary>OID</primary></indexterm>
1936 The <filename>samba.schema</filename> file has been formatted for OpenLDAP 2.0/2.1.
1937 The Samba Team owns the OID space used by the above schema and recommends its use.
1938 If you translate the schema to be used with Netscape DS, please submit the modified
1939 schema file as a patch to <ulink url="mailto:jerry@samba.org">jerry@samba.org</ulink>.
1943 <indexterm><primary>smbpasswd</primary></indexterm>
1944 <indexterm><primary>/etc/passwd</primary></indexterm>
1945 <indexterm><primary>sambaSamAccount</primary></indexterm>
1946 <indexterm><primary>AUXILIARY</primary></indexterm>
1947 <indexterm><primary>ObjectClass</primary></indexterm>
1948 <indexterm><primary>LDAP</primary></indexterm>
1949 <indexterm><primary>RFC 2307.</primary></indexterm>
1950 Just as the smbpasswd file is meant to store information that provides information
1951 additional to a user's <filename>/etc/passwd</filename> entry, so is the sambaSamAccount
1952 object meant to supplement the UNIX user account information. A sambaSamAccount is an
1953 <constant>AUXILIARY</constant> ObjectClass, so it can be used to augment existing
1954 user account information in the LDAP directory, thus providing information needed
1955 for Samba account handling. However, there are several fields (e.g., uid) that overlap
1956 with the posixAccount ObjectClass outlined in RFC 2307. This is by design.
1960 <indexterm><primary>account information</primary></indexterm>
1961 <indexterm><primary>sambaSamAccount</primary></indexterm>
1962 <indexterm><primary>posixAccount</primary></indexterm>
1963 <indexterm><primary>ObjectClasses</primary></indexterm>
1964 <indexterm><primary>smbd</primary></indexterm>
1965 <indexterm><primary>getpwnam</primary></indexterm>
1966 <indexterm><primary>LDAP</primary></indexterm>
1967 <indexterm><primary>NIS</primary></indexterm>
1968 <indexterm><primary>NSS</primary></indexterm>
1969 In order to store all user account information (UNIX and Samba) in the directory,
1970 it is necessary to use the sambaSamAccount and posixAccount ObjectClasses in
1971 combination. However, <command>smbd</command> will still obtain the user's UNIX account
1972 information via the standard C library calls, such as getpwnam().
1973 This means that the Samba server must also have the LDAP NSS library installed
1974 and functioning correctly. This division of information makes it possible to
1975 store all Samba account information in LDAP, but still maintain UNIX account
1976 information in NIS while the network is transitioning to a full LDAP infrastructure.
1981 <title>OpenLDAP Configuration</title>
1984 <indexterm><primary>sambaSamAccount</primary></indexterm>
1985 <indexterm><primary>OpenLDAP</primary></indexterm>
1986 <indexterm><primary>slapd</primary></indexterm>
1987 <indexterm><primary>samba.schema</primary></indexterm>
1988 To include support for the sambaSamAccount object in an OpenLDAP directory
1989 server, first copy the samba.schema file to slapd's configuration directory.
1990 The samba.schema file can be found in the directory <filename>examples/LDAP</filename>
1991 in the Samba source distribution.
1993 &rootprompt;<userinput>cp samba.schema /etc/openldap/schema/</userinput>
1998 <indexterm><primary>samba.schema</primary></indexterm>
1999 <indexterm><primary>slapd.conf</primary></indexterm>
2000 <indexterm><primary>sambaSamAccount</primary></indexterm>
2001 <indexterm><primary>cosine.schema</primary></indexterm>
2002 <indexterm><primary>uid</primary></indexterm>
2003 <indexterm><primary>inetorgperson.schema</primary></indexterm>
2004 <indexterm><primary>displayName</primary></indexterm>
2005 <indexterm><primary>attribute</primary></indexterm>
2006 Next, include the <filename>samba.schema</filename> file in <filename>slapd.conf</filename>.
2007 The sambaSamAccount object contains two attributes that depend on other schema
2008 files. The <parameter>uid</parameter> attribute is defined in <filename>cosine.schema</filename> and
2009 the <parameter>displayName</parameter> attribute is defined in the <filename>inetorgperson.schema</filename>
2010 file. Both of these must be included before the <filename>samba.schema</filename> file.
2012 ## /etc/openldap/slapd.conf
2014 ## schema files (core.schema is required by default)
2015 include /etc/openldap/schema/core.schema
2017 ## needed for sambaSamAccount
2018 include /etc/openldap/schema/cosine.schema
2019 include /etc/openldap/schema/inetorgperson.schema
2020 include /etc/openldap/schema/nis.schema
2021 include /etc/openldap/schema/samba.schema
2027 <indexterm><primary>sambaSamAccount</primary></indexterm>
2028 <indexterm><primary>posixAccount</primary></indexterm>
2029 <indexterm><primary>posixGroup</primary></indexterm>
2030 <indexterm><primary>ObjectClasses</primary></indexterm>
2031 It is recommended that you maintain some indices on some of the most useful attributes,
2032 as in the following example, to speed up searches made on sambaSamAccount ObjectClasses
2033 (and possibly posixAccount and posixGroup as well):
2038 # Indices to maintain
2039 ## required by OpenLDAP
2040 index objectclass eq
2042 index cn pres,sub,eq
2043 index sn pres,sub,eq
2044 ## required to support pdb_getsampwnam
2045 index uid pres,sub,eq
2046 ## required to support pdb_getsambapwrid()
2047 index displayName pres,sub,eq
2049 ## uncomment these if you are storing posixAccount and
2050 ## posixGroup entries in the directory as well
2051 ##index uidNumber eq
2052 ##index gidNumber eq
2053 ##index memberUid eq
2056 index sambaPrimaryGroupSID eq
2057 index sambaDomainName eq
2063 Create the new index by executing:
2065 &rootprompt;./sbin/slapindex -f slapd.conf
2070 Remember to restart slapd after making these changes:
2072 &rootprompt;<userinput>/etc/init.d/slapd restart</userinput>
2079 <title>Initialize the LDAP Database</title>
2082 <indexterm><primary>LDAP database</primary></indexterm>
2083 <indexterm><primary>account containers</primary></indexterm>
2084 <indexterm><primary>LDIF file</primary></indexterm>
2085 <indexterm><primary>DNS</primary></indexterm>
2086 Before you can add accounts to the LDAP database, you must create the account containers
2087 that they will be stored in. The following LDIF file should be modified to match your
2088 needs (DNS entries, and so on):
2090 # Organization for Samba Base
2091 dn: dc=quenya,dc=org
2092 objectclass: dcObject
2093 objectclass: organization
2095 o: Quenya Org Network
2096 description: The Samba-3 Network LDAP Example
2098 # Organizational Role for Directory Management
2099 dn: cn=Manager,dc=quenya,dc=org
2100 objectclass: organizationalRole
2102 description: Directory Manager
2104 # Setting up container for Users OU
2105 dn: ou=People,dc=quenya,dc=org
2107 objectclass: organizationalUnit
2110 # Setting up admin handle for People OU
2111 dn: cn=admin,ou=People,dc=quenya,dc=org
2114 objectclass: organizationalRole
2115 objectclass: simpleSecurityObject
2116 userPassword: {SSHA}c3ZM9tBaBo9autm1dL3waDS21+JSfQVz
2118 # Setting up container for groups
2119 dn: ou=Groups,dc=quenya,dc=org
2121 objectclass: organizationalUnit
2124 # Setting up admin handle for Groups OU
2125 dn: cn=admin,ou=Groups,dc=quenya,dc=org
2128 objectclass: organizationalRole
2129 objectclass: simpleSecurityObject
2130 userPassword: {SSHA}c3ZM9tBaBo9autm1dL3waDS21+JSfQVz
2132 # Setting up container for computers
2133 dn: ou=Computers,dc=quenya,dc=org
2135 objectclass: organizationalUnit
2138 # Setting up admin handle for Computers OU
2139 dn: cn=admin,ou=Computers,dc=quenya,dc=org
2142 objectclass: organizationalRole
2143 objectclass: simpleSecurityObject
2144 userPassword: {SSHA}c3ZM9tBaBo9autm1dL3waDS21+JSfQVz
2149 <indexterm><primary>userPassword</primary></indexterm>
2150 <indexterm><primary>slappasswd</primary></indexterm>
2151 The userPassword shown above should be generated using <command>slappasswd</command>.
2155 <indexterm><primary>LDIF</primary></indexterm>
2156 <indexterm><primary>LDAP</primary></indexterm>
2157 The following command will then load the contents of the LDIF file into the LDAP
2159 <indexterm><primary>slapadd</primary></indexterm>
2161 &prompt;<userinput>slapadd -v -l initldap.dif</userinput>
2166 Do not forget to secure your LDAP server with an adequate access control list
2167 as well as an admin password.
2171 <indexterm><primary>secrets.tdb</primary></indexterm>
2172 Before Samba can access the LDAP server, you need to store the LDAP admin password
2173 in the Samba-3 <filename>secrets.tdb</filename> database by:
2174 <indexterm><primary>smbpasswd</primary></indexterm>
2176 &rootprompt;<userinput>smbpasswd -w <replaceable>secret</replaceable></userinput>
2183 <title>Configuring Samba</title>
2186 <indexterm><primary>LDAP</primary></indexterm>
2187 <indexterm><primary>smbd</primary></indexterm>
2188 The following parameters are available in &smb.conf; only if your version of Samba was built with
2189 LDAP support. Samba automatically builds with LDAP support if the LDAP libraries are found. The
2190 best method to verify that Samba was built with LDAP support is:
2192 &rootprompt; smbd -b | grep LDAP
2195 HAVE_LDAP_DOMAIN2HOSTLIST
2197 HAVE_LDAP_INITIALIZE
2198 HAVE_LDAP_SET_REBIND_PROC
2200 LDAP_SET_REBIND_PROC_ARGS
2202 If the build of the <command>smbd</command> command you are using does not produce output
2203 that includes <literal>HAVE_LDAP_H</literal> it is necessary to discover why the LDAP headers
2204 and libraries were not found during compilation.
2207 <para>LDAP-related smb.conf options include these:
2209 <smbconfoption name="passdb backend">ldapsam:url</smbconfoption>
2210 <smbconfoption name="ldap admin dn"/>
2211 <smbconfoption name="ldap delete dn"/>
2212 <smbconfoption name="ldap filter"/>
2213 <smbconfoption name="ldap group suffix"/>
2214 <smbconfoption name="ldap idmap suffix"/>
2215 <smbconfoption name="ldap machine suffix"/>
2216 <smbconfoption name="ldap passwd sync"/>
2217 <smbconfoption name="ldap ssl"/>
2218 <smbconfoption name="ldap suffix"/>
2219 <smbconfoption name="ldap user suffix"/>
2220 <smbconfoption name="ldap replication sleep"/>
2221 <smbconfoption name="ldap timeout"/>
2222 <smbconfoption name="ldap page size"/>
2227 These are described in the &smb.conf; man page and so are not repeated here. However, an example
2228 for use with an LDAP directory is shown in <link linkend="confldapex">the Configuration with LDAP.</link>
2231 <example id="confldapex">
2232 <title>Configuration with LDAP</title>
2234 <smbconfsection name="[global]"/>
2235 <smbconfoption name="security">user</smbconfoption>
2236 <smbconfoption name="encrypt passwords">yes</smbconfoption>
2237 <smbconfoption name="netbios name">MORIA</smbconfoption>
2238 <smbconfoption name="workgroup">NOLDOR</smbconfoption>
2240 <smbconfcomment>LDAP related parameters:</smbconfcomment>
2242 <smbconfcomment>Define the DN used when binding to the LDAP servers.</smbconfcomment>
2243 <smbconfcomment>The password for this DN is not stored in smb.conf</smbconfcomment>
2244 <smbconfcomment>Set it using 'smbpasswd -w secret' to store the</smbconfcomment>
2245 <smbconfcomment>passphrase in the secrets.tdb file.</smbconfcomment>
2246 <smbconfcomment>If the "ldap admin dn" value changes, it must be reset.</smbconfcomment>
2247 <smbconfoption name="ldap admin dn">"cn=Manager,dc=quenya,dc=org"</smbconfoption>
2249 <smbconfcomment>SSL directory connections can be configured by:</smbconfcomment>
2250 <smbconfcomment>('off', 'start tls', or 'on' (default))</smbconfcomment>
2251 <smbconfoption name="ldap ssl">start tls</smbconfoption>
2253 <smbconfcomment>syntax: passdb backend = ldapsam:ldap://server-name[:port]</smbconfcomment>
2254 <smbconfoption name="passdb backend">ldapsam:ldap://frodo.quenya.org</smbconfoption>
2256 <smbconfcomment>smbpasswd -x delete the entire dn-entry</smbconfcomment>
2257 <smbconfoption name="ldap delete dn">no</smbconfoption>
2259 <smbconfcomment>The machine and user suffix are added to the base suffix</smbconfcomment>
2260 <smbconfcomment>wrote WITHOUT quotes. NULL suffixes by default</smbconfcomment>
2261 <smbconfoption name="ldap user suffix">ou=People</smbconfoption>
2262 <smbconfoption name="ldap group suffix">ou=Groups</smbconfoption>
2263 <smbconfoption name="ldap machine suffix">ou=Computers</smbconfoption>
2265 <smbconfcomment>Trust UNIX account information in LDAP</smbconfcomment>
2266 <smbconfcomment> (see the smb.conf man page for details)</smbconfcomment>
2268 <smbconfcomment>Specify the base DN to use when searching the directory</smbconfcomment>
2269 <smbconfoption name="ldap suffix">dc=quenya,dc=org</smbconfoption>
2276 <title>Accounts and Groups Management</title>
2279 <indexterm><primary>User Management</primary></indexterm>
2280 <indexterm><primary>User Accounts</primary><secondary>Adding/Deleting</secondary></indexterm>
2281 Because user accounts are managed through the sambaSamAccount ObjectClass, you should
2282 modify your existing administration tools to deal with sambaSamAccount attributes.
2286 <indexterm><primary>sambaSamAccount</primary></indexterm>
2287 <indexterm><primary>/etc/openldap/sldap.conf</primary></indexterm>
2288 <indexterm><primary>NSS</primary></indexterm>
2289 Machine accounts are managed with the sambaSamAccount ObjectClass, just
2290 like user accounts. However, it is up to you to store those accounts
2291 in a different tree of your LDAP namespace. You should use
2292 <quote>ou=Groups,dc=quenya,dc=org</quote> to store groups and
2293 <quote>ou=People,dc=quenya,dc=org</quote> to store users. Just configure your
2294 NSS and PAM accordingly (usually, in the <filename>/etc/openldap/sldap.conf</filename>
2295 configuration file).
2299 <indexterm><primary>POSIX</primary></indexterm>
2300 <indexterm><primary>posixGroup</primary></indexterm>
2301 <indexterm><primary>Domain Groups</primary></indexterm>
2302 <indexterm><primary>ADS</primary></indexterm>
2303 In Samba-3, the group management system is based on POSIX
2304 groups. This means that Samba makes use of the posixGroup ObjectClass.
2305 For now, there is no NT-like group system management (global and local
2306 groups). Samba-3 knows only about <constant>Domain Groups</constant>
2307 and, unlike MS Windows 2000 and Active Directory, Samba-3 does not
2308 support nested groups.
2314 <title>Security and sambaSamAccount</title>
2318 <indexterm><primary>sambaSAMAccount</primary></indexterm>
2319 There are two important points to remember when discussing the security
2320 of sambaSAMAccount entries in the directory.
2324 <listitem><para><emphasis>Never</emphasis> retrieve the SambaLMPassword or
2325 <indexterm><primary>SambaNTPassword</primary></indexterm>
2326 SambaNTPassword attribute values over an unencrypted LDAP session.</para></listitem>
2327 <listitem><para><emphasis>Never</emphasis> allow non-admin users to
2328 view the SambaLMPassword or SambaNTPassword attribute values.</para></listitem>
2332 <indexterm><primary>clear-text</primary></indexterm>
2333 <indexterm><primary>impersonate</primary></indexterm>
2334 <indexterm><primary>LM/NT password hashes</primary></indexterm>
2335 These password hashes are clear-text equivalents and can be used to impersonate
2336 the user without deriving the original clear-text strings. For more information
2337 on the details of LM/NT password hashes, refer to <link linkend="passdb">the
2338 Account Information Database section</link>.
2342 <indexterm><primary>encrypted session</primary></indexterm>
2343 <indexterm><primary>StartTLS</primary></indexterm>
2344 <indexterm><primary>LDAPS</primary></indexterm>
2345 <indexterm><primary>secure communications</primary></indexterm>
2346 To remedy the first security issue, the <smbconfoption name="ldap ssl"/> &smb.conf;
2347 parameter defaults to require an encrypted session (<smbconfoption name="ldap
2348 ssl">on</smbconfoption>) using the default port of <constant>636</constant> when
2349 contacting the directory server. When using an OpenLDAP server, it
2350 is possible to use the StartTLS LDAP extended operation in the place of LDAPS.
2351 In either case, you are strongly encouraged to use secure communications protocols
2352 (so do not set <smbconfoption name="ldap ssl">off</smbconfoption>).
2356 <indexterm><primary>LDAPS</primary></indexterm>
2357 <indexterm><primary>StartTLS</primary></indexterm>
2358 <indexterm><primary>LDAPv3</primary></indexterm>
2359 Note that the LDAPS protocol is deprecated in favor of the LDAPv3 StartTLS
2360 extended operation. However, the OpenLDAP library still provides support for
2361 the older method of securing communication between clients and servers.
2365 <indexterm><primary>harvesting password hashes</primary></indexterm>
2366 <indexterm><primary>ACL</primary></indexterm>
2367 <indexterm><primary>slapd.conf</primary></indexterm>
2368 The second security precaution is to prevent non-administrative users from
2369 harvesting password hashes from the directory. This can be done using the
2370 following ACL in <filename>slapd.conf</filename>:
2375 ## allow the "ldap admin dn" access, but deny everyone else
2376 access to attrs=SambaLMPassword,SambaNTPassword
2377 by dn="cn=Samba Admin,ou=People,dc=quenya,dc=org" write
2385 <title>LDAP Special Attributes for sambaSamAccounts</title>
2387 <para> The sambaSamAccount ObjectClass is composed of the attributes shown in next tables: <link
2388 linkend="attribobjclPartA">Part A</link>, and <link linkend="attribobjclPartB">Part B</link>.
2391 <table frame="all" id="attribobjclPartA">
2392 <title>Attributes in the sambaSamAccount ObjectClass (LDAP), Part A</title>
2393 <tgroup cols="2" align="justify">
2394 <colspec align="left"/>
2395 <colspec align="justify" colwidth="1*"/>
2397 <row><entry><constant>sambaLMPassword</constant></entry><entry>The LanMan password 16-byte hash stored as a character
2398 representation of a hexadecimal string.</entry></row>
2399 <row><entry><constant>sambaNTPassword</constant></entry><entry>The NT password 16-byte hash stored as a character
2400 representation of a hexadecimal string.</entry></row>
2401 <row><entry><constant>sambaPwdLastSet</constant></entry><entry>The integer time in seconds since 1970 when the
2402 <constant>sambaLMPassword</constant> and <constant>sambaNTPassword</constant> attributes were last set.
2405 <row><entry><constant>sambaAcctFlags</constant></entry><entry>String of 11 characters surrounded by square brackets [ ]
2406 representing account flags such as U (user), W (workstation), X (no password expiration),
2407 I (domain trust account), H (home dir required), S (server trust account),
2408 and D (disabled).</entry></row>
2410 <row><entry><constant>sambaLogonTime</constant></entry><entry>Integer value currently unused.</entry></row>
2412 <row><entry><constant>sambaLogoffTime</constant></entry><entry>Integer value currently unused.</entry></row>
2414 <row><entry><constant>sambaKickoffTime</constant></entry><entry>Specifies the time (UNIX time format) when the user
2415 will be locked down and cannot login any longer. If this attribute is omitted, then the account will never expire.
2416 Using this attribute together with shadowExpire of the shadowAccount ObjectClass will enable accounts to
2417 expire completely on an exact date.</entry></row>
2419 <row><entry><constant>sambaPwdCanChange</constant></entry><entry>Specifies the time (UNIX time format)
2420 after which the user is allowed to change his password. If this attribute is not set, the user will be free
2421 to change his password whenever he wants.</entry></row>
2423 <row><entry><constant>sambaPwdMustChange</constant></entry><entry>Specifies the time (UNIX time format) when the user is
2424 forced to change his password. If this value is set to 0, the user will have to change his password at first login.
2425 If this attribute is not set, then the password will never expire.</entry></row>
2427 <row><entry><constant>sambaHomeDrive</constant></entry><entry>Specifies the drive letter to which to map the
2428 UNC path specified by sambaHomePath. The drive letter must be specified in the form <quote>X:</quote>
2429 where X is the letter of the drive to map. Refer to the <quote>logon drive</quote> parameter in the
2430 smb.conf(5) man page for more information.</entry></row>
2432 <row><entry><constant>sambaLogonScript</constant></entry><entry>The sambaLogonScript property specifies the path of
2433 the user's logon script, .CMD, .EXE, or .BAT file. The string can be null. The path
2434 is relative to the netlogon share. Refer to the <smbconfoption name="logon script"/> parameter in the
2435 &smb.conf; man page for more information.</entry></row>
2437 <row><entry><constant>sambaProfilePath</constant></entry><entry>Specifies a path to the user's profile.
2438 This value can be a null string, a local absolute path, or a UNC path. Refer to the
2439 <smbconfoption name="logon path"/> parameter in the &smb.conf; man page for more information.</entry></row>
2441 <row><entry><constant>sambaHomePath</constant></entry><entry>The sambaHomePath property specifies the path of
2442 the home directory for the user. The string can be null. If sambaHomeDrive is set and specifies
2443 a drive letter, sambaHomePath should be a UNC path. The path must be a network
2444 UNC path of the form <filename>\\server\share\directory</filename>. This value can be a null string.
2445 Refer to the <command>logon home</command> parameter in the &smb.conf; man page for more information.
2451 <table frame="all" id="attribobjclPartB">
2452 <title>Attributes in the sambaSamAccount ObjectClass (LDAP), Part B</title>
2453 <tgroup cols="2" align="justify">
2454 <colspec align="left"/>
2455 <colspec align="justify" colwidth="1*"/>
2457 <row><entry><constant>sambaUserWorkstations</constant></entry><entry>Here you can give a comma-separated list of machines
2458 on which the user is allowed to login. You may observe problems when you try to connect to a Samba domain member.
2459 Because domain members are not in this list, the domain controllers will reject them. Where this attribute is omitted,
2460 the default implies no restrictions.
2463 <row><entry><constant>sambaSID</constant></entry><entry>The security identifier(SID) of the user.
2464 The Windows equivalent of UNIX UIDs.</entry></row>
2466 <row><entry><constant>sambaPrimaryGroupSID</constant></entry><entry>The security identifier (SID) of the primary group
2467 of the user.</entry></row>
2469 <row><entry><constant>sambaDomainName</constant></entry><entry>Domain the user is part of.</entry></row>
2475 <indexterm><primary>PDC</primary></indexterm>
2476 <indexterm><primary>sambaSamAccount</primary></indexterm>
2477 The majority of these parameters are only used when Samba is acting as a PDC of
2478 a domain (refer to <link linkend="samba-pdc">Domain Control</link>, for details on
2479 how to configure Samba as a PDC). The following four attributes
2480 are only stored with the sambaSamAccount entry if the values are non-default values:
2484 <indexterm><primary>sambaHomePath</primary></indexterm>
2485 <indexterm><primary>sambaLogonScript</primary></indexterm>
2486 <indexterm><primary>sambaProfilePath</primary></indexterm>
2487 <indexterm><primary>sambaHomeDrive</primary></indexterm>
2488 <listitem><para>sambaHomePath</para></listitem>
2489 <listitem><para>sambaLogonScript</para></listitem>
2490 <listitem><para>sambaProfilePath</para></listitem>
2491 <listitem><para>sambaHomeDrive</para></listitem>
2495 <indexterm><primary>sambaSamAccount</primary></indexterm>
2496 <indexterm><primary>PDC</primary></indexterm>
2497 <indexterm><primary>smbHome</primary></indexterm>
2498 These attributes are only stored with the sambaSamAccount entry if
2499 the values are non-default values. For example, assume MORIA has now been
2500 configured as a PDC and that <smbconfoption name="logon home">\\%L\%u</smbconfoption> was defined in
2501 its &smb.conf; file. When a user named <quote>becky</quote> logs on to the domain,
2502 the <smbconfoption name="logon home"/> string is expanded to \\MORIA\becky.
2503 If the smbHome attribute exists in the entry <quote>uid=becky,ou=People,dc=samba,dc=org</quote>,
2504 this value is used. However, if this attribute does not exist, then the value
2505 of the <smbconfoption name="logon home"/> parameter is used in its place. Samba
2506 will only write the attribute value to the directory entry if the value is
2507 something other than the default (e.g., <filename>\\MOBY\becky</filename>).
2513 <title>Example LDIF Entries for a sambaSamAccount</title>
2516 The following is a working LDIF that demonstrates the use of the SambaSamAccount ObjectClass:
2518 dn: uid=guest2, ou=People,dc=quenya,dc=org
2519 sambaLMPassword: 878D8014606CDA29677A44EFA1353FC7
2520 sambaPwdMustChange: 2147483647
2521 sambaPrimaryGroupSID: S-1-5-21-2447931902-1787058256-3961074038-513
2522 sambaNTPassword: 552902031BEDE9EFAAD3B435B51404EE
2523 sambaPwdLastSet: 1010179124
2525 objectClass: sambaSamAccount
2527 sambaKickoffTime: 2147483647
2528 sambaAcctFlags: [UX ]
2529 sambaLogoffTime: 2147483647
2530 sambaSID: S-1-5-21-2447931902-1787058256-3961074038-5006
2531 sambaPwdCanChange: 0
2536 The following is an LDIF entry for using both the sambaSamAccount and
2537 posixAccount ObjectClasses:
2539 dn: uid=gcarter, ou=People,dc=quenya,dc=org
2541 displayName: Gerald Carter
2542 sambaLMPassword: 552902031BEDE9EFAAD3B435B51404EE
2543 sambaPrimaryGroupSID: S-1-5-21-2447931902-1787058256-3961074038-1201
2544 objectClass: posixAccount
2545 objectClass: sambaSamAccount
2546 sambaAcctFlags: [UX ]
2547 userPassword: {crypt}BpM2ej8Rkzogo
2551 loginShell: /bin/bash
2552 logoffTime: 2147483647
2554 sambaKickoffTime: 2147483647
2555 sambaPwdLastSet: 1010179230
2556 sambaSID: S-1-5-21-2447931902-1787058256-3961074038-5004
2557 homeDirectory: /home/moria/gcarter
2558 sambaPwdCanChange: 0
2559 sambaPwdMustChange: 2147483647
2560 sambaNTPassword: 878D8014606CDA29677A44EFA1353FC7
2567 <title>Password Synchronization</title>
2570 Samba-3 and later can update the non-Samba (LDAP) password stored with an account. When
2571 using pam_ldap, this allows changing both UNIX and Windows passwords at once.
2574 <para>The <smbconfoption name="ldap passwd sync"/> options can have the values shown in
2575 <link linkend="ldappwsync">Possible <emphasis>ldap passwd sync</emphasis> Values</link>.</para>
2577 <table frame="all" id="ldappwsync">
2578 <title>Possible <parameter>ldap passwd sync</parameter> Values</title>
2580 <colspec align="left" colwidth="1*"/>
2581 <colspec align="justify" colwidth="4*"/>
2583 <row><entry align="left">Value</entry><entry align="center">Description</entry></row>
2586 <row><entry>yes</entry><entry><para>When the user changes his password, update
2587 <constant>SambaNTPassword</constant>, <constant>SambaLMPassword</constant>,
2588 and the <constant>password</constant> fields.</para></entry></row>
2590 <row><entry>no</entry><entry><para>Only update <constant>SambaNTPassword</constant> and
2591 <constant>SambaLMPassword</constant>.</para></entry></row>
2593 <row><entry>only</entry><entry><para>Only update the LDAP password and let the LDAP server
2594 worry about the other fields. This option is only available on some LDAP servers and
2595 only when the LDAP server supports LDAP_EXOP_X_MODIFY_PASSWD.</para></entry></row>
2601 <para>More information can be found in the &smb.conf; man page.</para>
2606 <title>Using OpenLDAP Overlay for Password Synchronization</title>
2609 Howard Chu has written a special overlay called <command>smbk5pwd</command>. This tool modifies the
2610 <literal>SambaNTPassword</literal>, <literal>SambaLMPassword</literal> and <literal>Heimdal</literal>
2611 hashes in an OpenLDAP entry when an LDAP_EXOP_X_MODIFY_PASSWD operation is performed.
2615 The overlay is shipped with OpenLDAP-2.3 and can be found in the
2616 <filename>contrib/slapd-modules/smbk5pwd</filename> subdirectory. This module can also be used with
2627 <title>Common Errors</title>
2630 <title>Users Cannot Logon</title>
2632 <para><quote>I've installed Samba, but now I can't log on with my UNIX account! </quote></para>
2634 <para>Make sure your user has been added to the current Samba <smbconfoption name="passdb backend"/>.
2635 Read the <link linkend="acctmgmttools">Account Management Tools</link> for details.</para>
2640 <title>Configuration of <parameter>auth methods</parameter></title>
2643 When explicitly setting an <smbconfoption name="auth methods"/> parameter,
2644 <parameter>guest</parameter> must be specified as the first entry on the line &smbmdash;
2645 for example, <smbconfoption name="auth methods">guest sam</smbconfoption>.