1
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter�11.�Account Information Databases</title><link rel="stylesheet" href="../samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"><link rel="home" href="index.html" title="The Official Samba 3.4.x HOWTO and Reference Guide"><link rel="up" href="optional.html" title="Part�III.�Advanced Configuration"><link rel="prev" href="NetworkBrowsing.html" title="Chapter�10.�Network Browsing"><link rel="next" href="groupmapping.html" title="Chapter�12.�Group Mapping: MS Windows and UNIX"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter�11.�Account Information Databases</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="NetworkBrowsing.html">Prev</a>�</td><th width="60%" align="center">Part�III.�Advanced Configuration</th><td width="20%" align="right">�<a accesskey="n" href="groupmapping.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="passdb"></a>Chapter�11.�Account Information Databases</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Jelmer</span> <span class="othername">R.</span> <span class="orgname">The Samba Team</span> <span class="surname">Vernooij</span></h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:jelmer@samba.org">jelmer@samba.org</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">John</span> <span class="othername">H.</span> <span class="orgname">Samba Team</span> <span class="surname">Terpstra</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:jht@samba.org">jht@samba.org</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Gerald</span> <span class="othername">(Jerry)</span> <span class="orgname">Samba Team</span> <span class="surname">Carter</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:jerry@samba.org">jerry@samba.org</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Jeremy</span> <span class="orgname">Samba Team</span> <span class="surname">Allison</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:jra@samba.org">jra@samba.org</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Guenther</span> <span class="orgname">Samba Team</span> <span class="surname">Deschner</span></h3><span class="contrib">LDAP updates</span>�<div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:gd@samba.org">gd@samba.org</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Olivier (lem)</span> <span class="orgname">IDEALX</span> <span class="surname">Lemaire</span></h3><div class="affiliation"><span class="orgname">IDEALX<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:olem@IDEALX.org">olem@IDEALX.org</a>></code></p></div></div></div></div><div><p class="pubdate">May 24, 2003</p></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="passdb.html#id2587230">Features and Benefits</a></span></dt><dd><dl><dt><span class="sect2"><a href="passdb.html#id2587266">Backward Compatibility Account Storage Systems</a></span></dt><dt><span class="sect2"><a href="passdb.html#id2587457">New Account Storage Systems</a></span></dt></dl></dd><dt><span class="sect1"><a href="passdb.html#passdbtech">Technical Information</a></span></dt><dd><dl><dt><span class="sect2"><a href="passdb.html#id2588025">Important Notes About Security</a></span></dt><dt><span class="sect2"><a href="passdb.html#id2588545">Mapping User Identifiers between MS Windows and UNIX</a></span></dt><dt><span class="sect2"><a href="passdb.html#idmapbackend">Mapping Common UIDs/GIDs on Distributed Machines</a></span></dt><dt><span class="sect2"><a href="passdb.html#id2589094">Comments Regarding LDAP</a></span></dt><dt><span class="sect2"><a href="passdb.html#id2589506">LDAP Directories and Windows Computer Accounts</a></span></dt></dl></dd><dt><span class="sect1"><a href="passdb.html#acctmgmttools">Account Management Tools</a></span></dt><dd><dl><dt><span class="sect2"><a href="passdb.html#id2589947">The smbpasswd Tool</a></span></dt><dt><span class="sect2"><a href="passdb.html#pdbeditthing">The pdbedit Tool</a></span></dt></dl></dd><dt><span class="sect1"><a href="passdb.html#id2592500">Password Backends</a></span></dt><dd><dl><dt><span class="sect2"><a href="passdb.html#id2592553">Plaintext</a></span></dt><dt><span class="sect2"><a href="passdb.html#id2592629">smbpasswd: Encrypted Password Database</a></span></dt><dt><span class="sect2"><a href="passdb.html#id2592895">tdbsam</a></span></dt><dt><span class="sect2"><a href="passdb.html#id2593053">ldapsam</a></span></dt></dl></dd><dt><span class="sect1"><a href="passdb.html#id2595578">Common Errors</a></span></dt><dd><dl><dt><span class="sect2"><a href="passdb.html#id2595583">Users Cannot Logon</a></span></dt><dt><span class="sect2"><a href="passdb.html#id2595621">Configuration of auth methods</a></span></dt></dl></dd></dl></div><p>
2
<a class="indexterm" name="id2587032"></a>
3
<a class="indexterm" name="id2587039"></a>
4
<a class="indexterm" name="id2587046"></a>
5
<a class="indexterm" name="id2587053"></a>
6
Early releases of Samba-3 implemented new capability to work concurrently with multiple account backends. This
7
capability was removed beginning with release of Samba 3.0.23. Commencing with Samba 3.0.23 it is possible to
8
work with only one specified passwd backend.
10
<a class="indexterm" name="id2587067"></a>
11
<a class="indexterm" name="id2587074"></a>
12
<a class="indexterm" name="id2587081"></a>
13
<a class="indexterm" name="id2587088"></a>
14
<a class="indexterm" name="id2587095"></a>
15
<a class="indexterm" name="id2587102"></a>
16
The three passdb backends that are fully maintained (actively supported) by the Samba Team are:
17
<code class="literal">smbpasswd</code> (being obsoleted), <code class="literal">tdbsam</code> (a tdb-based binary file format),
18
and <code class="literal">ldapsam</code> (LDAP directory). Of these, only the <code class="literal">ldapsam</code> backend
19
stores both POSIX (UNIX) and Samba user and group account information in a single repository. The
20
<code class="literal">smbpasswd</code> and <code class="literal">tdbsam</code> backends store only Samba user accounts.
22
In a strict sense, there are three supported account storage and access systems. One of these is considered
23
obsolete (smbpasswd). It is recommended to use the <code class="literal">tdbsam</code> method for all simple systems. Use
24
<code class="literal">ldapsam</code> for larger and more complex networks.
26
<a class="indexterm" name="id2587172"></a>
27
<a class="indexterm" name="id2587179"></a>
28
<a class="indexterm" name="id2587186"></a>
29
<a class="indexterm" name="id2587193"></a>
30
<a class="indexterm" name="id2587200"></a>
31
<a class="indexterm" name="id2587207"></a>
32
<a class="indexterm" name="id2587214"></a>
33
In a strict and literal sense, the passdb backends are account storage mechanisms (or methods) alone. The choice
34
of terminology can be misleading, however we are stuck with this choice of wording. This chapter documents the
35
nature of the account storage system with a focus on user and trust accounts. Trust accounts have two forms,
36
machine trust accounts (computer accounts) and interdomain trust accounts. These are all treated as user-like
38
</p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2587230"></a>Features and Benefits</h2></div></div></div><p>
39
Samba-3 provides for complete backward compatibility with Samba-2.2.x functionality
41
<a class="indexterm" name="id2587240"></a>
42
<a class="indexterm" name="id2587249"></a>
43
<a class="indexterm" name="id2587258"></a>
44
</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2587266"></a>Backward Compatibility Account Storage Systems</h3></div></div></div><div class="variablelist"><dl><dt><span class="term">Plaintext</span></dt><dd><p>
45
<a class="indexterm" name="id2587283"></a>
46
<a class="indexterm" name="id2587290"></a>
47
<a class="indexterm" name="id2587297"></a>
48
<a class="indexterm" name="id2587304"></a>
49
<a class="indexterm" name="id2587311"></a>
50
This isn't really a backend at all, but is listed here for simplicity. Samba can be configured to pass
51
plaintext authentication requests to the traditional UNIX/Linux <code class="filename">/etc/passwd</code> and
52
<code class="filename">/etc/shadow</code>-style subsystems. On systems that have Pluggable Authentication Modules
53
(PAM) support, all PAM modules are supported. The behavior is just as it was with Samba-2.2.x, and the
54
protocol limitations imposed by MS Windows clients apply likewise. Please refer to <a class="link" href="passdb.html#passdbtech" title="Technical Information">Technical Information</a>, for more information regarding the limitations of plaintext
56
</p></dd><dt><span class="term">smbpasswd</span></dt><dd><p>
57
<a class="indexterm" name="id2587358"></a>
58
<a class="indexterm" name="id2587365"></a>
59
<a class="indexterm" name="id2587372"></a>
60
<a class="indexterm" name="id2587379"></a>
61
This option allows continued use of the <code class="filename">smbpasswd</code>
62
file that maintains a plain ASCII (text) layout that includes the MS Windows
63
LanMan and NT-encrypted passwords as well as a field that stores some
64
account information. This form of password backend does not store any of
65
the MS Windows NT/200x SAM (Security Account Manager) information required to
66
provide the extended controls that are needed for more comprehensive
67
interoperation with MS Windows NT4/200x servers.
69
This backend should be used only for backward compatibility with older
70
versions of Samba. It may be deprecated in future releases.
71
</p></dd><dt><span class="term">ldapsam_compat (Samba-2.2 LDAP Compatibility)</span></dt><dd><p>
72
<a class="indexterm" name="id2587425"></a>
73
<a class="indexterm" name="id2587432"></a>
74
<a class="indexterm" name="id2587439"></a>
75
There is a password backend option that allows continued operation with
76
an existing OpenLDAP backend that uses the Samba-2.2.x LDAP schema extension.
77
This option is provided primarily as a migration tool, although there is
78
no reason to force migration at this time. This tool will eventually
80
</p></dd></dl></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2587457"></a>New Account Storage Systems</h3></div></div></div><p>
81
Samba-3 introduces a number of new password backend capabilities.
82
<a class="indexterm" name="id2587466"></a>
83
<a class="indexterm" name="id2587475"></a>
84
</p><div class="variablelist"><dl><dt><span class="term">tdbsam</span></dt><dd><p>
85
<a class="indexterm" name="id2587496"></a>
86
<a class="indexterm" name="id2587504"></a>
87
<a class="indexterm" name="id2587510"></a>
88
This backend provides a rich database backend for local servers. This
89
backend is not suitable for multiple domain controllers (i.e., PDC + one
90
or more BDC) installations.
92
<a class="indexterm" name="id2587523"></a>
93
<a class="indexterm" name="id2587530"></a>
94
<a class="indexterm" name="id2587537"></a>
95
<a class="indexterm" name="id2587544"></a>
96
<a class="indexterm" name="id2587551"></a>
97
<a class="indexterm" name="id2587558"></a>
98
The <span class="emphasis"><em>tdbsam</em></span> password backend stores the old <span class="emphasis"><em>
99
smbpasswd</em></span> information plus the extended MS Windows NT/200x
100
SAM information into a binary format TDB (trivial database) file.
101
The inclusion of the extended information makes it possible for Samba-3
102
to implement the same account and system access controls that are possible
103
with MS Windows NT4/200x-based systems.
105
<a class="indexterm" name="id2587581"></a>
106
<a class="indexterm" name="id2587588"></a>
107
<a class="indexterm" name="id2587595"></a>
108
The inclusion of the <span class="emphasis"><em>tdbsam</em></span> capability is a direct
109
response to user requests to allow simple site operation without the overhead
110
of the complexities of running OpenLDAP. It is recommended to use this only
111
for sites that have fewer than 250 users. For larger sites or implementations,
112
the use of OpenLDAP or of Active Directory integration is strongly recommended.
113
</p></dd><dt><span class="term">ldapsam</span></dt><dd><p>
114
<a class="indexterm" name="id2587624"></a>
115
<a class="indexterm" name="id2587631"></a>
116
This provides a rich directory backend for distributed account installation.
118
<a class="indexterm" name="id2587642"></a>
119
<a class="indexterm" name="id2587649"></a>
120
<a class="indexterm" name="id2587656"></a>
121
<a class="indexterm" name="id2587663"></a>
122
<a class="indexterm" name="id2587670"></a>
123
Samba-3 has a new and extended LDAP implementation that requires configuration
124
of OpenLDAP with a new format Samba schema. The new format schema file is
125
included in the <code class="filename">examples/LDAP</code> directory of the Samba distribution.
127
<a class="indexterm" name="id2587692"></a>
128
<a class="indexterm" name="id2587699"></a>
129
<a class="indexterm" name="id2587706"></a>
130
<a class="indexterm" name="id2587713"></a>
131
<a class="indexterm" name="id2587720"></a>
132
The new LDAP implementation significantly expands the control abilities that
133
were possible with prior versions of Samba. It is now possible to specify
134
“<span class="quote">per-user</span>” profile settings, home directories, account access controls, and
135
much more. Corporate sites will see that the Samba Team has listened to their
136
requests both for capability and greater scalability.
137
</p></dd></dl></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="passdbtech"></a>Technical Information</h2></div></div></div><p>
138
<a class="indexterm" name="id2587754"></a>
139
<a class="indexterm" name="id2587761"></a>
140
Old Windows clients send plaintext passwords over the wire. Samba can check these
141
passwords by encrypting them and comparing them to the hash stored in the UNIX user database.
143
<a class="indexterm" name="id2587774"></a>
144
<a class="indexterm" name="id2587781"></a>
145
<a class="indexterm" name="id2587788"></a>
146
<a class="indexterm" name="id2587795"></a>
147
Newer Windows clients send encrypted passwords (LanMan and NT hashes) instead of plaintext passwords over
148
the wire. The newest clients will send only encrypted passwords and refuse to send plaintext passwords unless
149
their registry is tweaked.
151
<a class="indexterm" name="id2587809"></a>
152
<a class="indexterm" name="id2587816"></a>
153
Many people ask why Samba cannot simply use the UNIX password database. Windows requires
154
passwords that are encrypted in its own format. The UNIX passwords can't be converted to
155
UNIX-style encrypted passwords. Because of that, you can't use the standard UNIX user
156
database, and you have to store the LanMan and NT hashes somewhere else.
158
<a class="indexterm" name="id2587832"></a>
159
<a class="indexterm" name="id2587840"></a>
160
<a class="indexterm" name="id2587846"></a>
161
<a class="indexterm" name="id2587853"></a>
162
In addition to differently encrypted passwords, Windows also stores certain data for each
163
user that is not stored in a UNIX user database: for example, workstations the user may logon from,
164
the location where the user's profile is stored, and so on. Samba retrieves and stores this
165
information using a <a class="link" href="smb.conf.5.html#PASSDBBACKEND" target="_top">passdb backend</a>. Commonly available backends are LDAP,
166
tdbsam, and plain text file. For more information, see the man page for <code class="filename">smb.conf</code> regarding the
167
<a class="link" href="smb.conf.5.html#PASSDBBACKEND" target="_top">passdb backend</a> parameter.
168
</p><div class="figure"><a name="idmap-sid2uid"></a><p class="title"><b>Figure�11.1.�IDMAP: Resolution of SIDs to UIDs.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/idmap-sid2uid.png" width="216" alt="IDMAP: Resolution of SIDs to UIDs."></div></div></div><br class="figure-break"><p>
169
<a class="indexterm" name="id2587943"></a>
170
<a class="indexterm" name="id2587949"></a>
171
<a class="indexterm" name="id2587956"></a>
172
The resolution of SIDs to UIDs is fundamental to correct operation of Samba. In both cases shown, if winbindd
173
is not running or cannot be contacted, then only local SID/UID resolution is possible. See <a class="link" href="passdb.html#idmap-sid2uid" title="Figure�11.1.�IDMAP: Resolution of SIDs to UIDs.">resolution of SIDs to UIDs</a> and <a class="link" href="passdb.html#idmap-uid2sid" title="Figure�11.2.�IDMAP: Resolution of UIDs to SIDs.">resolution of UIDs
174
to SIDs</a> diagrams.
175
</p><div class="figure"><a name="idmap-uid2sid"></a><p class="title"><b>Figure�11.2.�IDMAP: Resolution of UIDs to SIDs.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/idmap-uid2sid.png" width="270" alt="IDMAP: Resolution of UIDs to SIDs."></div></div></div><br class="figure-break"><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2588025"></a>Important Notes About Security</h3></div></div></div><p>
176
<a class="indexterm" name="id2588033"></a>
177
<a class="indexterm" name="id2588040"></a>
178
<a class="indexterm" name="id2588048"></a>
179
<a class="indexterm" name="id2588055"></a>
180
<a class="indexterm" name="id2588061"></a>
181
The UNIX and SMB password encryption techniques seem similar on the surface. This
182
similarity is, however, only skin deep. The UNIX scheme typically sends clear-text
183
passwords over the network when logging in. This is bad. The SMB encryption scheme
184
never sends the clear-text password over the network, but it does store the 16-byte
185
hashed values on disk. This is also bad. Why? Because the 16 byte hashed values
186
are a “<span class="quote">password equivalent.</span>” You cannot derive the user's password from them, but
187
they could potentially be used in a modified client to gain access to a server.
188
This would require considerable technical knowledge on behalf of the attacker but
189
is perfectly possible. You should therefore treat the data stored in whatever passdb
190
backend you use (smbpasswd file, LDAP) as though it contained the clear-text
191
passwords of all your users. Its contents must be kept secret, and the file should
192
be protected accordingly.
194
<a class="indexterm" name="id2588091"></a>
195
<a class="indexterm" name="id2588097"></a>
196
<a class="indexterm" name="id2588104"></a>
197
Ideally, we would like a password scheme that involves neither plaintext passwords
198
on the network nor plaintext passwords on disk. Unfortunately, this is not available because Samba is stuck with
199
having to be compatible with other SMB systems (Windows NT, Windows for Workgroups, Windows 9x/Me).
201
<a class="indexterm" name="id2588119"></a>
202
<a class="indexterm" name="id2588126"></a>
203
Windows NT 4.0 Service Pack 3 changed the default setting so plaintext passwords
204
are disabled from being sent over the wire. This mandates either the use of encrypted
205
password support or editing the Windows NT registry to re-enable plaintext passwords.
207
<a class="indexterm" name="id2588141"></a>
208
<a class="indexterm" name="id2588148"></a>
209
The following versions of Microsoft Windows do not support full domain security protocols,
210
although they may log onto a domain environment:
211
</p><div class="itemizedlist"><ul type="disc"><li><p>MS DOS Network client 3.0 with the basic network redirector installed.</p></li><li><p>Windows 95 with the network redirector update installed.</p></li><li><p>Windows 98 [Second Edition].</p></li><li><p>Windows Me.</p></li></ul></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
212
<a class="indexterm" name="id2588186"></a>
213
<a class="indexterm" name="id2588193"></a>
214
<a class="indexterm" name="id2588200"></a>
215
MS Windows XP Home does not have facilities to become a domain member, and it cannot participate in domain logons.
217
The following versions of MS Windows fully support domain security protocols.
218
</p><div class="itemizedlist"><ul type="disc"><li><p>Windows NT 3.5x.</p></li><li><p>Windows NT 4.0.</p></li><li><p>Windows 2000 Professional.</p></li><li><p>Windows 200x Server/Advanced Server.</p></li><li><p>Windows XP Professional.</p></li></ul></div><p>
219
<a class="indexterm" name="id2588245"></a>
220
<a class="indexterm" name="id2588252"></a>
221
<a class="indexterm" name="id2588259"></a>
222
<a class="indexterm" name="id2588266"></a>
223
<a class="indexterm" name="id2588273"></a>
224
<a class="indexterm" name="id2588280"></a>
225
All current releases of Microsoft SMB/CIFS clients support authentication via the
226
SMB challenge/response mechanism described here. Enabling clear-text authentication
227
does not disable the ability of the client to participate in encrypted authentication.
228
Instead, it allows the client to negotiate either plaintext or encrypted password
231
<a class="indexterm" name="id2588296"></a>
232
<a class="indexterm" name="id2588303"></a>
233
<a class="indexterm" name="id2588310"></a>
234
<a class="indexterm" name="id2588317"></a>
235
<a class="indexterm" name="id2588324"></a>
236
MS Windows clients will cache the encrypted password alone. Where plaintext passwords
237
are re-enabled through the appropriate registry change, the plaintext password is never
238
cached. This means that in the event that a network connections should become disconnected
239
(broken), only the cached (encrypted) password will be sent to the resource server to
240
effect an auto-reconnect. If the resource server does not support encrypted passwords, the
241
auto-reconnect will fail. Use of encrypted passwords is strongly advised.
242
</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2588340"></a>Advantages of Encrypted Passwords</h4></div></div></div><div class="itemizedlist"><ul type="disc"><li><p>
243
<a class="indexterm" name="id2588352"></a>
244
<a class="indexterm" name="id2588359"></a>
245
<a class="indexterm" name="id2588366"></a>
246
Plaintext passwords are not passed across the network. Someone using a network sniffer
247
cannot just record passwords going to the SMB server.
249
<a class="indexterm" name="id2588380"></a>
250
<a class="indexterm" name="id2588386"></a>
251
<a class="indexterm" name="id2588393"></a>
252
Plaintext passwords are not stored anywhere in memory or on disk.
254
<a class="indexterm" name="id2588406"></a>
255
<a class="indexterm" name="id2588413"></a>
256
<a class="indexterm" name="id2588420"></a>
257
<a class="indexterm" name="id2588426"></a>
258
Windows NT does not like talking to a server that does not support encrypted passwords. It will refuse to
259
browse the server if the server is also in user-level security mode. It will insist on prompting the user for
260
the password on each connection, which is very annoying. The only thing you can do to stop this is to use SMB
263
<a class="indexterm" name="id2588444"></a>
264
<a class="indexterm" name="id2588451"></a>
265
Encrypted password support allows automatic share (resource) reconnects.
267
<a class="indexterm" name="id2588464"></a>
268
<a class="indexterm" name="id2588470"></a>
269
Encrypted passwords are essential for PDC/BDC operation.
270
</p></li></ul></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2588481"></a>Advantages of Non-Encrypted Passwords</h4></div></div></div><div class="itemizedlist"><ul type="disc"><li><p>
271
<a class="indexterm" name="id2588492"></a>
272
Plaintext passwords are not kept on disk and are not cached in memory.
274
<a class="indexterm" name="id2588505"></a>
275
<a class="indexterm" name="id2588512"></a>
276
Plaintext passwords use the same password file as other UNIX services, such as Login and FTP.
278
<a class="indexterm" name="id2588525"></a>
279
<a class="indexterm" name="id2588531"></a>
280
Use of other services (such as Telnet and FTP) that send plaintext passwords over
281
the network makes sending them for SMB not such a big deal.
282
</p></li></ul></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2588545"></a>Mapping User Identifiers between MS Windows and UNIX</h3></div></div></div><p>
283
<a class="indexterm" name="id2588553"></a>
284
<a class="indexterm" name="id2588560"></a>
285
<a class="indexterm" name="id2588566"></a>
286
Every operation in UNIX/Linux requires a user identifier (UID), just as in
287
MS Windows NT4/200x this requires a security identifier (SID). Samba provides
288
two means for mapping an MS Windows user to a UNIX/Linux UID.
290
<a class="indexterm" name="id2588580"></a>
291
<a class="indexterm" name="id2588587"></a>
292
<a class="indexterm" name="id2588594"></a>
293
<a class="indexterm" name="id2588600"></a>
294
<a class="indexterm" name="id2588607"></a>
295
First, all Samba SAM database accounts require a UNIX/Linux UID that the account will map to. As users are
296
added to the account information database, Samba will call the <a class="link" href="smb.conf.5.html#ADDUSERSCRIPT" target="_top">add user script</a>
297
interface to add the account to the Samba host OS. In essence all accounts in the local SAM require a local
300
<a class="indexterm" name="id2588636"></a>
301
<a class="indexterm" name="id2588643"></a>
302
<a class="indexterm" name="id2588649"></a>
303
<a class="indexterm" name="id2588656"></a>
304
<a class="indexterm" name="id2588662"></a>
305
<a class="indexterm" name="id2588669"></a>
306
<a class="indexterm" name="id2588676"></a>
307
The second way to map Windows SID to UNIX UID is via the <span class="emphasis"><em>idmap uid</em></span> and
308
<span class="emphasis"><em>idmap gid</em></span> parameters in <code class="filename">smb.conf</code>. Please refer to the man page for information about
309
these parameters. These parameters are essential when mapping users from a remote (non-member Windows client
310
or a member of a foreign domain) SAM server.
311
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="idmapbackend"></a>Mapping Common UIDs/GIDs on Distributed Machines</h3></div></div></div><p>
312
<a class="indexterm" name="id2588716"></a>
313
<a class="indexterm" name="id2588722"></a>
314
<a class="indexterm" name="id2588729"></a>
315
<a class="indexterm" name="id2588735"></a>
316
<a class="indexterm" name="id2588742"></a>
317
<a class="indexterm" name="id2588749"></a>
318
Samba-3 has a special facility that makes it possible to maintain identical UIDs and GIDs
319
on all servers in a distributed network. A distributed network is one where there exists
320
a PDC, one or more BDCs, and/or one or more domain member servers. Why is this important?
321
This is important if files are being shared over more than one protocol (e.g., NFS) and where
322
users are copying files across UNIX/Linux systems using tools such as <code class="literal">rsync</code>.
324
<a class="indexterm" name="id2588772"></a>
325
<a class="indexterm" name="id2588779"></a>
326
<a class="indexterm" name="id2588786"></a>
327
<a class="indexterm" name="id2588792"></a>
328
<a class="indexterm" name="id2588799"></a>
329
<a class="indexterm" name="id2588805"></a>
330
<a class="indexterm" name="id2588812"></a>
331
<a class="indexterm" name="id2588819"></a>
332
The special facility is enabled using a parameter called <em class="parameter"><code>idmap backend</code></em>.
333
The default setting for this parameter is an empty string. Technically it is possible to use
334
an LDAP-based idmap backend for UIDs and GIDs, but it makes most sense when this is done for
335
network configurations that also use LDAP for the SAM backend.
336
<a class="link" href="passdb.html#idmapbackendexample" title="Example�11.1.�Example Configuration with the LDAP idmap Backend">Example Configuration with the LDAP idmap Backend</a>
337
shows that configuration.
338
</p><a class="indexterm" name="id2588848"></a><div class="example"><a name="idmapbackendexample"></a><p class="title"><b>Example�11.1.�Example Configuration with the LDAP idmap Backend</b></p><div class="example-contents"><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[global]</code></em></td></tr><tr><td><a class="indexterm" name="id2588882"></a><em class="parameter"><code>idmap backend = ldap:ldap://ldap-server.quenya.org:636</code></em></td></tr><tr><td># Alternatively, this could be specified as:</td></tr><tr><td><a class="indexterm" name="id2588898"></a><em class="parameter"><code>idmap backend = ldap:ldaps://ldap-server.quenya.org</code></em></td></tr></table></div></div><br class="example-break"><p>
339
<a class="indexterm" name="id2588914"></a>
340
<a class="indexterm" name="id2588920"></a>
341
A network administrator who wants to make significant use of LDAP backends will sooner or later be
342
exposed to the excellent work done by PADL Software. PADL <a class="ulink" href="http://www.padl.com" target="_top">http://www.padl.com</a> have
343
produced and released to open source an array of tools that might be of interest. These tools include:
344
</p><div class="itemizedlist"><ul type="disc"><li><p>
345
<a class="indexterm" name="id2588944"></a>
346
<a class="indexterm" name="id2588951"></a>
347
<a class="indexterm" name="id2588958"></a>
348
<a class="indexterm" name="id2588964"></a>
349
<a class="indexterm" name="id2588971"></a>
350
<a class="indexterm" name="id2588978"></a>
351
<a class="indexterm" name="id2588985"></a>
352
<a class="indexterm" name="id2588991"></a>
353
<span class="emphasis"><em>nss_ldap:</em></span> An LDAP name service switch (NSS) module to provide native
354
name service support for AIX, Linux, Solaris, and other operating systems. This tool
355
can be used for centralized storage and retrieval of UIDs and GIDs.
357
<a class="indexterm" name="id2589012"></a>
358
<a class="indexterm" name="id2589018"></a>
359
<a class="indexterm" name="id2589025"></a>
360
<a class="indexterm" name="id2589032"></a>
361
<span class="emphasis"><em>pam_ldap:</em></span> A PAM module that provides LDAP integration for UNIX/Linux
362
system access authentication.
364
<a class="indexterm" name="id2589050"></a>
365
<a class="indexterm" name="id2589057"></a>
366
<a class="indexterm" name="id2589064"></a>
367
<a class="indexterm" name="id2589071"></a>
368
<span class="emphasis"><em>idmap_ad:</em></span> An IDMAP backend that supports the Microsoft Services for
369
UNIX RFC 2307 schema available from the PADL Web
370
<a class="ulink" href="http://www.padl.com/download/xad_oss_plugins.tar.gz" target="_top">site</a>.
371
</p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2589094"></a>Comments Regarding LDAP</h3></div></div></div><p>
372
<a class="indexterm" name="id2589102"></a>
373
<a class="indexterm" name="id2589111"></a>
374
<a class="indexterm" name="id2589118"></a>
375
<a class="indexterm" name="id2589125"></a>
376
There is much excitement and interest in LDAP directories in the information technology world
377
today. The LDAP architecture was designed to be highly scalable. It was also designed for
378
use across a huge number of potential areas of application encompassing a wide range of operating
379
systems and platforms. LDAP technologies are at the heart of the current generations of Federated
380
Identity Management (FIM) solutions that can underlie a corporate Single Sign-On (SSO) environment.
382
<a class="indexterm" name="id2589143"></a>
383
<a class="indexterm" name="id2589150"></a>
384
<a class="indexterm" name="id2589156"></a>
385
<a class="indexterm" name="id2589163"></a>
386
LDAP implementations have been built across a wide variety of platforms. It lies at the core of Microsoft
387
Windows Active Directory services (ADS), Novell's eDirectory, as well as many others. Implementation of the
388
directory services LDAP involves interaction with legacy as well as new generation applications, all of which
389
depend on some form of authentication services.
391
<a class="indexterm" name="id2589179"></a>
392
<a class="indexterm" name="id2589186"></a>
393
<a class="indexterm" name="id2589193"></a>
394
<a class="indexterm" name="id2589200"></a>
395
<a class="indexterm" name="id2589207"></a>
396
<a class="indexterm" name="id2589214"></a>
397
<a class="indexterm" name="id2589221"></a>
398
<a class="indexterm" name="id2589228"></a>
399
<a class="indexterm" name="id2589235"></a>
400
<a class="indexterm" name="id2589242"></a>
401
<a class="indexterm" name="id2589248"></a>
402
<a class="indexterm" name="id2589255"></a>
403
<a class="indexterm" name="id2589262"></a>
404
<a class="indexterm" name="id2589269"></a>
405
UNIX services can utilize LDAP directory information for authentication and access controls
406
through intermediate tools and utilities. The total environment that consists of the LDAP directory
407
and the middle-ware tools and utilities makes it possible for all user access to the UNIX platform
408
to be managed from a central environment and yet distributed to wherever the point of need may
409
be physically located. Applications that benefit from this infrastructure include: UNIX login
410
shells, mail and messaging systems, quota controls, printing systems, DNS servers, DHCP servers,
413
<a class="indexterm" name="id2589289"></a>
414
<a class="indexterm" name="id2589296"></a>
415
<a class="indexterm" name="id2589302"></a>
416
<a class="indexterm" name="id2589309"></a>
417
<a class="indexterm" name="id2589316"></a>
418
<a class="indexterm" name="id2589323"></a>
419
Many sites are installing LDAP for the first time in order to provide a scalable passdb backend
420
for Samba. Others are faced with the need to adapt an existing LDAP directory to new uses such
421
as for the Samba SAM backend. Whatever your particular need and attraction to Samba may be,
422
decisions made in respect of the design of the LDAP directory structure and its implementation
423
are of a durable nature for the site. These have far-reaching implications that affect long-term
424
information systems management costs.
426
<a class="indexterm" name="id2589342"></a>
427
<a class="indexterm" name="id2589349"></a>
428
Do not rush into an LDAP deployment. Take the time to understand how the design of the Directory
429
Information Tree (DIT) may impact current and future site needs, as well as the ability to meet
430
them. The way that Samba SAM information should be stored within the DIT varies from site to site
431
and with each implementation new experience is gained. It is well understood by LDAP veterans that
432
first implementations create awakening, second implementations of LDAP create fear, and
433
third-generation deployments bring peace and tranquility.
434
</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2589369"></a>Caution Regarding LDAP and Samba</h4></div></div></div><p>
435
<a class="indexterm" name="id2589377"></a>
436
<a class="indexterm" name="id2589384"></a>
437
<a class="indexterm" name="id2589391"></a>
438
<a class="indexterm" name="id2589398"></a>
439
<a class="indexterm" name="id2589405"></a>
440
<a class="indexterm" name="id2589412"></a>
441
<a class="indexterm" name="id2589419"></a>
442
Samba requires UNIX POSIX identity information as well as a place to store information that is
443
specific to Samba and the Windows networking environment. The most used information that must
444
be dealt with includes: user accounts, group accounts, machine trust accounts, interdomain
445
trust accounts, and intermediate information specific to Samba internals.
447
<a class="indexterm" name="id2589435"></a>
448
<a class="indexterm" name="id2589442"></a>
449
<a class="indexterm" name="id2589449"></a>
450
The example deployment guidelines in this book, as well as other books and HOWTO documents
451
available from the internet may not fit with established directory designs and implementations.
452
The existing DIT may not be able to accommodate the simple information layout proposed in common
453
sources. Additionally, you may find that the common scripts and tools that are used to provision
454
the LDAP directory for use with Samba may not suit your needs.
456
<a class="indexterm" name="id2589467"></a>
457
It is not uncommon, for sites that have existing LDAP DITs to find necessity to generate a
458
set of site-specific scripts and utilities to make it possible to deploy Samba within the
459
scope of site operations. The way that user and group accounts are distributed throughout
460
the DIT may make this a challenging matter. The solution will, of course, be rewarding, but
461
the journey to it may be challenging. Take time to understand site needs and do not rush
464
<a class="indexterm" name="id2589485"></a>
465
<a class="indexterm" name="id2589492"></a>
466
Above all, do not blindly use scripts and tools that are not suitable for your site. Check
467
and validate all scripts before you execute them to make sure that the existing infrastructure
468
will not be damaged by inadvertent use of an inappropriate tool.
469
</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2589506"></a>LDAP Directories and Windows Computer Accounts</h3></div></div></div><p>
470
<a class="indexterm" name="id2589515"></a>
471
<a class="indexterm" name="id2589522"></a>
472
<a class="indexterm" name="id2589528"></a>
473
Samba doesn't provide a turnkey solution to LDAP. It is best to deal with the design and
474
configuration of an LDAP directory prior to integration with Samba. A working knowledge
475
of LDAP makes Samba integration easy, and the lack of a working knowledge of LDAP can make
476
it a frustrating experience.
478
<a class="indexterm" name="id2589544"></a>
479
<a class="indexterm" name="id2589551"></a>
480
<a class="indexterm" name="id2589558"></a>
481
Computer (machine) accounts can be placed wherever you like in an LDAP directory subject
482
to some constraints that are described in this chapter.
484
<a class="indexterm" name="id2589570"></a>
485
<a class="indexterm" name="id2589577"></a>
486
<a class="indexterm" name="id2589584"></a>
487
<a class="indexterm" name="id2589591"></a>
488
<a class="indexterm" name="id2589598"></a>
489
<a class="indexterm" name="id2589605"></a>
490
<a class="indexterm" name="id2589612"></a>
491
The POSIX and sambaSamAccount components of computer (machine) accounts are both used by Samba.
492
Thus, machine accounts are treated inside Samba in the same way that Windows NT4/200X treats
493
them. A user account and a machine account are indistinguishable from each other, except that
494
the machine account ends in a $ character, as do trust accounts.
496
<a class="indexterm" name="id2589628"></a>
497
<a class="indexterm" name="id2589635"></a>
498
<a class="indexterm" name="id2589642"></a>
499
<a class="indexterm" name="id2589649"></a>
500
<a class="indexterm" name="id2589655"></a>
501
The need for Windows user, group, machine, trust, and other accounts to be tied to a valid UNIX
502
UID is a design decision that was made a long way back in the history of Samba development. It
503
is unlikely that this decision will be reversed or changed during the remaining life of the
506
<a class="indexterm" name="id2589670"></a>
507
<a class="indexterm" name="id2589677"></a>
508
<a class="indexterm" name="id2589684"></a>
509
The resolution of a UID from the Windows SID is achieved within Samba through a mechanism that
510
must refer back to the host operating system on which Samba is running. The NSS is the preferred
511
mechanism that shields applications (like Samba) from the need to know everything about every
514
<a class="indexterm" name="id2589699"></a>
515
<a class="indexterm" name="id2589705"></a>
516
<a class="indexterm" name="id2589712"></a>
517
<a class="indexterm" name="id2589719"></a>
518
<a class="indexterm" name="id2589726"></a>
519
<a class="indexterm" name="id2589732"></a>
520
<a class="indexterm" name="id2589739"></a>
521
Samba asks the host OS to provide a UID via the “<span class="quote">passwd</span>”, “<span class="quote">shadow</span>”,
522
and “<span class="quote">group</span>” facilities in the NSS control (configuration) file. The best tool
523
for achieving this is left up to the UNIX administrator to determine. It is not imposed by
524
Samba. Samba provides winbindd with its support libraries as one method. It is
525
possible to do this via LDAP, and for that Samba provides the appropriate hooks so that
526
all account entities can be located in an LDAP directory.
528
<a class="indexterm" name="id2589767"></a>
529
<a class="indexterm" name="id2589774"></a>
530
<a class="indexterm" name="id2589781"></a>
531
<a class="indexterm" name="id2589787"></a>
532
<a class="indexterm" name="id2589794"></a>
533
For many the weapon of choice is to use the PADL nss_ldap utility. This utility must
534
be configured so that computer accounts can be resolved to a POSIX/UNIX account UID. That
535
is fundamentally an LDAP design question. The information provided on the Samba list and
536
in the documentation is directed at providing working examples only. The design
537
of an LDAP directory is a complex subject that is beyond the scope of this documentation.
538
</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="acctmgmttools"></a>Account Management Tools</h2></div></div></div><p>
539
<a class="indexterm" name="id2589825"></a>
540
<a class="indexterm" name="id2589831"></a>
541
<a class="indexterm" name="id2589838"></a>
542
Samba provides two tools for management of user and machine accounts:
543
<code class="literal">smbpasswd</code> and <code class="literal">pdbedit</code>.
545
<a class="indexterm" name="id2589861"></a>
546
<a class="indexterm" name="id2589868"></a>
547
<a class="indexterm" name="id2589875"></a>
548
The <code class="literal">pdbedit</code> can be used to manage account policies in addition to
549
Samba user account information. The policy management capability is used to administer
550
domain default settings for password aging and management controls to handle failed login
553
<a class="indexterm" name="id2589895"></a>
554
<a class="indexterm" name="id2589902"></a>
555
<a class="indexterm" name="id2589909"></a>
556
<a class="indexterm" name="id2589916"></a>
557
Some people are confused when reference is made to <code class="literal">smbpasswd</code> because the
558
name refers to a storage mechanism for SambaSAMAccount information, but it is also the name
559
of a utility tool. That tool is destined to eventually be replaced by new functionality that
560
is being added to the <code class="literal">net</code> toolset (see <a class="link" href="NetCommand.html" title="Chapter�13.�Remote and Local Management: The Net Command">the Net Command</a>.
561
</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2589947"></a>The <code class="literal">smbpasswd</code> Tool</h3></div></div></div><p>
562
<a class="indexterm" name="id2589960"></a>
563
<a class="indexterm" name="id2589967"></a>
564
<a class="indexterm" name="id2589974"></a>
565
<a class="indexterm" name="id2589981"></a>
566
<a class="indexterm" name="id2589988"></a>
567
The <code class="literal">smbpasswd</code> utility is similar to the <code class="literal">passwd</code>
568
and <code class="literal">yppasswd</code> programs. It maintains the two 32 byte password
569
fields in the passdb backend. This utility operates independently of the actual
570
account and password storage methods used (as specified by the <em class="parameter"><code>passdb
571
backend</code></em> in the <code class="filename">smb.conf</code> file.
573
<a class="indexterm" name="id2590032"></a>
574
<a class="indexterm" name="id2590039"></a>
575
<code class="literal">smbpasswd</code> works in a client-server mode where it contacts the
576
local smbd to change the user's password on its behalf. This has enormous benefits.
578
<a class="indexterm" name="id2590057"></a>
579
<a class="indexterm" name="id2590064"></a>
580
<code class="literal">smbpasswd</code> has the capability to change passwords on Windows NT
581
servers (this only works when the request is sent to the NT PDC if changing an NT
582
domain user's password).
584
<a class="indexterm" name="id2590083"></a>
585
<a class="indexterm" name="id2590090"></a>
586
<code class="literal">smbpasswd</code> can be used to:
587
</p><div class="itemizedlist"><ul type="disc"><li><p><span class="emphasis"><em>add</em></span> user or machine accounts.</p></li><li><p><span class="emphasis"><em>delete</em></span> user or machine accounts.</p></li><li><p><span class="emphasis"><em>enable</em></span> user or machine accounts.</p></li><li><p><span class="emphasis"><em>disable</em></span> user or machine accounts.</p></li><li><p><span class="emphasis"><em>set to NULL</em></span> user passwords.</p></li><li><p><span class="emphasis"><em>manage</em></span> interdomain trust accounts.</p></li></ul></div><p>
588
To run smbpasswd as a normal user, just type:
590
</p><pre class="screen">
591
<code class="prompt">$ </code><strong class="userinput"><code>smbpasswd</code></strong>
592
<code class="prompt">Old SMB password: </code><strong class="userinput"><code><em class="replaceable"><code>secret</code></em></code></strong>
594
For <em class="replaceable"><code>secret</code></em>, type the old value here or press return if
595
there is no old password.
596
</p><pre class="screen">
597
<code class="prompt">New SMB Password: </code><strong class="userinput"><code><em class="replaceable"><code>new secret</code></em></code></strong>
598
<code class="prompt">Repeat New SMB Password: </code><strong class="userinput"><code><em class="replaceable"><code>new secret</code></em></code></strong>
601
If the old value does not match the current value stored for that user, or the two
602
new values do not match each other, then the password will not be changed.
604
<a class="indexterm" name="id2590230"></a>
605
When invoked by an ordinary user, the command will allow only the user to change his or her own
608
<a class="indexterm" name="id2590242"></a>
609
<a class="indexterm" name="id2590249"></a>
610
When run by root, <code class="literal">smbpasswd</code> may take an optional argument specifying
611
the username whose SMB password you wish to change. When run as root, <code class="literal">smbpasswd</code>
612
does not prompt for or check the old password value, thus allowing root to set passwords
613
for users who have forgotten their passwords.
615
<a class="indexterm" name="id2590275"></a>
616
<a class="indexterm" name="id2590282"></a>
617
<a class="indexterm" name="id2590289"></a>
618
<a class="indexterm" name="id2590296"></a>
619
<code class="literal">smbpasswd</code> is designed to work in the way familiar to UNIX
620
users who use the <code class="literal">passwd</code> or <code class="literal">yppasswd</code> commands.
621
While designed for administrative use, this tool provides essential user-level
622
password change capabilities.
624
<a class="indexterm" name="id2590327"></a>
625
For more details on using <code class="literal">smbpasswd</code>, refer to the man page (the
626
definitive reference).
627
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="pdbeditthing"></a>The <code class="literal">pdbedit</code> Tool</h3></div></div></div><p>
628
<a class="indexterm" name="id2590361"></a>
629
<a class="indexterm" name="id2590368"></a>
630
<a class="indexterm" name="id2590375"></a>
631
<a class="indexterm" name="id2590382"></a>
632
<code class="literal">pdbedit</code> is a tool that can be used only by root. It is used to
633
manage the passdb backend, as well as domain-wide account policy settings. <code class="literal">pdbedit</code>
635
</p><div class="itemizedlist"><ul type="disc"><li><p>add, remove, or modify user accounts.</p></li><li><p>list user accounts.</p></li><li><p>migrate user accounts.</p></li><li><p>migrate group accounts.</p></li><li><p>manage account policies.</p></li><li><p>manage domain access policy settings.</p></li></ul></div><p>
636
<a class="indexterm" name="id2590441"></a>
637
Under the terms of the Sarbanes-Oxley Act of 2002, American businesses and organizations are mandated to
638
implement a series of <code class="literal">internal controls</code> and procedures to communicate, store,
639
and protect financial data. The Sarbanes-Oxley Act has far reaching implications in respect of:
640
</p><div class="orderedlist"><ol type="1"><li><p>Who has access to information systems that store financial data.</p></li><li><p>How personal and financial information is treated among employees and business
641
partners.</p></li><li><p>How security vulnerabilities are managed.</p></li><li><p>Security and patch level maintenance for all information systems.</p></li><li><p>How information systems changes are documented and tracked.</p></li><li><p>How information access controls are implemented and managed.</p></li><li><p>Auditability of all information systems in respect of change and security.</p></li><li><p>Disciplinary procedures and controls to ensure privacy.</p></li></ol></div><p>
642
<a class="indexterm" name="id2590513"></a>
643
<a class="indexterm" name="id2590520"></a>
644
In short, the Sarbanes-Oxley Act of 2002 is an instrument that enforces accountability in respect of
645
business related information systems so as to ensure the compliance of all information systems that
646
are used to store personal information and particularly for financial records processing. Similar
647
accountabilities are being demanded around the world.
649
<a class="indexterm" name="id2590543"></a>
650
<a class="indexterm" name="id2590549"></a>
651
<a class="indexterm" name="id2590556"></a>
652
<a class="indexterm" name="id2590563"></a>
653
<a class="indexterm" name="id2590570"></a>
654
The need to be familiar with the Samba tools and facilities that permit information systems operation
655
in compliance with government laws and regulations is clear to all. The <code class="literal">pdbedit</code> is
656
currently the only Samba tool that provides the capacity to manage account and systems access controls
657
and policies. During the remaining life-cycle of the Samba-3 series it is possible the new tools may
658
be implemented to aid in this important area.
660
Domain global policy controls available in Windows NT4 compared with Samba
661
is shown in <a class="link" href="passdb.html#policycontrols" title="Table�11.1.�NT4 Domain v's Samba Policy Controls">NT4 Domain v's Samba Policy Controls</a>.
662
</p><div class="table"><a name="policycontrols"></a><p class="title"><b>Table�11.1.�NT4 Domain v's Samba Policy Controls</b></p><div class="table-contents"><table summary="NT4 Domain v's Samba Policy Controls" border="1"><colgroup><col align="left"><col align="left"><col align="center"><col align="center"><col align="center"></colgroup><thead><tr><th align="left"><p>NT4 policy Name</p></th><th align="left"><p>Samba Policy Name</p></th><th align="center"><p>NT4 Range</p></th><th align="center"><p>Samba Range</p></th><th align="center"><p>Samba Default</p></th></tr></thead><tbody><tr><td align="left"><p>Maximum Password Age</p></td><td align="left"><p>maximum password age</p></td><td align="center"><p>0 - 999 (days)</p></td><td align="center"><p>0 - 4294967295 (sec)</p></td><td align="center"><p>4294967295</p></td></tr><tr><td align="left"><p>Minimum Password Age</p></td><td align="left"><p>minimum password age</p></td><td align="center"><p>0 - 999 (days)</p></td><td align="center"><p>0 - 4294967295 (sec)</p></td><td align="center"><p>0</p></td></tr><tr><td align="left"><p>Minimum Password Length</p></td><td align="left"><p>min password length</p></td><td align="center"><p>1 - 14 (Chars)</p></td><td align="center"><p>0 - 4294967295 (Chars)</p></td><td align="center"><p>5</p></td></tr><tr><td align="left"><p>Password Uniqueness</p></td><td align="left"><p>password history</p></td><td align="center"><p>0 - 23 (#)</p></td><td align="center"><p>0 - 4294967295 (#)</p></td><td align="center"><p>0</p></td></tr><tr><td align="left"><p>Account Lockout - Reset count after</p></td><td align="left"><p>reset count minutes</p></td><td align="center"><p>1 - 99998 (min)</p></td><td align="center"><p>0 - 4294967295 (min)</p></td><td align="center"><p>30</p></td></tr><tr><td align="left"><p>Lockout after bad logon attempts</p></td><td align="left"><p>bad lockout attempt</p></td><td align="center"><p>0 - 998 (#)</p></td><td align="center"><p>0 - 4294967295 (#)</p></td><td align="center"><p>0</p></td></tr><tr><td align="left"><p>*** Not Known ***</p></td><td align="left"><p>disconnect time</p></td><td align="center"><p>TBA</p></td><td align="center"><p>0 - 4294967295</p></td><td align="center"><p>0</p></td></tr><tr><td align="left"><p>Lockout Duration</p></td><td align="left"><p>lockout duration</p></td><td align="center"><p>1 - 99998 (min)</p></td><td align="center"><p>0 - 4294967295 (min)</p></td><td align="center"><p>30</p></td></tr><tr><td align="left"><p>Users must log on in order to change password</p></td><td align="left"><p>user must logon to change password</p></td><td align="center"><p>0/1</p></td><td align="center"><p>0 - 4294967295</p></td><td align="center"><p>0</p></td></tr><tr><td align="left"><p>*** Registry Setting ***</p></td><td align="left"><p>refuse machine password change</p></td><td align="center"><p>0/1</p></td><td align="center"><p>0 - 4294967295</p></td><td align="center"><p>0</p></td></tr></tbody></table></div></div><br class="table-break"><p>
663
<a class="indexterm" name="id2590953"></a>
664
<a class="indexterm" name="id2590960"></a>
665
<a class="indexterm" name="id2590967"></a>
666
<a class="indexterm" name="id2590974"></a>
667
The <code class="literal">pdbedit</code> tool is the only one that can manage the account
668
security and policy settings. It is capable of all operations that smbpasswd can
669
do as well as a superset of them.
671
<a class="indexterm" name="id2590993"></a>
672
<a class="indexterm" name="id2590999"></a>
673
<a class="indexterm" name="id2591006"></a>
674
One particularly important purpose of the <code class="literal">pdbedit</code> is to allow
675
the import/export of account information from one passdb backend to another.
676
</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2591023"></a>User Account Management</h4></div></div></div><p>
677
<a class="indexterm" name="id2591031"></a>
678
<a class="indexterm" name="id2591038"></a>
679
<a class="indexterm" name="id2591044"></a>
680
<a class="indexterm" name="id2591051"></a>
681
<a class="indexterm" name="id2591058"></a>
682
<a class="indexterm" name="id2591065"></a>
683
<a class="indexterm" name="id2591072"></a>
684
The <code class="literal">pdbedit</code> tool, like the <code class="literal">smbpasswd</code> tool, requires
685
that a POSIX user account already exists in the UNIX/Linux system accounts database (backend).
686
Neither tool will call out to the operating system to create a user account because this is
687
considered to be the responsibility of the system administrator. When the Windows NT4 domain
688
user manager is used to add an account, Samba will implement the <code class="literal">add user script</code>
689
(as well as the other interface scripts) to ensure that user, group and machine accounts are
690
correctly created and changed. The use of the <code class="literal">pdbedit</code> tool does not
691
make use of these interface scripts.
693
<a class="indexterm" name="id2591116"></a>
694
<a class="indexterm" name="id2591123"></a>
695
Before attempting to use the <code class="literal">pdbedit</code> tool to manage user and machine
696
accounts, make certain that a system (POSIX) account has already been created.
697
</p><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2591139"></a>Listing User and Machine Accounts</h5></div></div></div><p>
698
<a class="indexterm" name="id2591147"></a>
699
<a class="indexterm" name="id2591154"></a>
700
The following is an example of the user account information that is stored in
701
a tdbsam password backend. This listing was produced by running:
702
</p><pre class="screen">
703
<code class="prompt">$ </code><strong class="userinput"><code>pdbedit -Lv met</code></strong>
707
User SID: S-1-5-21-1449123459-1407424037-3116680435-2004
708
Primary Group SID: S-1-5-21-1449123459-1407424037-3116680435-1201
709
Full Name: Melissa E Terpstra
710
Home Directory: \\frodo\met\Win9Profile
712
Logon Script: scripts\logon.bat
713
Profile Path: \\frodo\Profiles\met
716
Workstations: melbelle
719
Logoff time: Mon, 18 Jan 2038 20:14:07 GMT
720
Kickoff time: Mon, 18 Jan 2038 20:14:07 GMT
721
Password last set: Sat, 14 Dec 2002 14:37:03 GMT
722
Password can change: Sat, 14 Dec 2002 14:37:03 GMT
723
Password must change: Mon, 18 Jan 2038 20:14:07 GMT
726
<a class="indexterm" name="id2591196"></a>
727
Accounts can also be listed in the older <code class="literal">smbpasswd</code> format:
728
</p><pre class="screen">
729
<code class="prompt">root# </code><strong class="userinput"><code>pdbedit -Lw</code></strong>
730
root:0:84B0D8E14D158FF8417EAF50CFAC29C3:
731
AF6DD3FD4E2EA8BDE1695A3F05EFBF52:[U ]:LCT-42681AB8:
732
jht:1000:6BBC4159020A52741486235A2333E4D2:
733
CC099521AD554A3C3CF2556274DBCFBC:[U ]:LCT-40D75B5B:
734
rcg:1002:E95D4331A6F23AF8AAD3B435B51404EE:
735
BB0F2C39B04CA6100F0E535DF8314B43:[U ]:LCT-40D7C5A3:
736
afw:1003:1AAFA7F9F6DC1DEAAAD3B435B51404EE:
737
CE92C2F9471594CDC4E7860CA6BC62DB:[T ]:LCT-40DA501F:
738
met:1004:A2848CB7E076B435AAD3B435B51404EE:
739
F25F5D3405085C555236B80B7B22C0D2:[U ]:LCT-4244FAB8:
740
aurora$:1005:060DE593EA638B8ACC4A19F14D2FF2BB:
741
060DE593EA638B8ACC4A19F14D2FF2BB:[W ]:LCT-4173E5CC:
742
temptation$:1006:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:
743
A96703C014E404E33D4049F706C45EE9:[W ]:LCT-42BF0C57:
744
vaioboss$:1001:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:
745
88A30A095160072784C88F811E89F98A:[W ]:LCT-41C3878D:
746
frodo$:1008:15891DC6B843ECA41249940C814E316B:
747
B68EADCCD18E17503D3DAD3E6B0B9A75:[W ]:LCT-42B7979F:
748
marvel$:1011:BF709959C3C94E0B3958B7B84A3BB6F3:
749
C610EFE9A385A3E8AA46ADFD576E6881:[W ]:LCT-40F07A4
751
<a class="indexterm" name="id2591245"></a>
752
<a class="indexterm" name="id2591252"></a>
753
<a class="indexterm" name="id2591258"></a>
754
<a class="indexterm" name="id2591265"></a>
755
<a class="indexterm" name="id2591272"></a>
756
<a class="indexterm" name="id2591279"></a>
757
The account information that was returned by this command in order from left to right
758
consists of the following colon separated data:
759
</p><div class="itemizedlist"><ul type="disc"><li><p>Login ID.</p></li><li><p>UNIX UID.</p></li><li><p>Microsoft LanManager password hash (password converted to upper-case then hashed.</p></li><li><p>Microsoft NT password hash (hash of the case-preserved password).</p></li><li><p>Samba SAM Account Flags.</p></li><li><p>The LCT data (password last change time).</p></li></ul></div><p>
760
<a class="indexterm" name="id2591329"></a>
761
<a class="indexterm" name="id2591336"></a>
762
The Account Flags parameters are documented in the <code class="literal">pdbedit</code> man page, and are
763
briefly documented in <a class="link" href="passdb.html#TOSHARG-acctflags" title="Account Flags Management">the Account Flags Management section</a>.
765
<a class="indexterm" name="id2591363"></a>
766
The LCT data consists of 8 hexadecimal characters representing the time since January 1, 1970, of
767
the time when the password was last changed.
768
</p></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2591374"></a>Adding User Accounts</h5></div></div></div><p>
769
<a class="indexterm" name="id2591382"></a>
770
<a class="indexterm" name="id2591389"></a>
771
<a class="indexterm" name="id2591396"></a>
772
<a class="indexterm" name="id2591403"></a>
773
<a class="indexterm" name="id2591410"></a>
774
The <code class="literal">pdbedit</code> can be used to add a user account to a standalone server
775
or to a domain. In the example shown here the account for the user <code class="literal">vlaan</code>
776
has been created before attempting to add the SambaSAMAccount.
777
</p><pre class="screen">
778
<code class="prompt">root# </code> pdbedit -a vlaan
779
new password: secretpw
780
retype new password: secretpw
784
User SID: S-1-5-21-726309263-4128913605-1168186429-3014
785
Primary Group SID: S-1-5-21-726309263-4128913605-1168186429-513
786
Full Name: Victor Laan
787
Home Directory: \\frodo\vlaan
789
Logon Script: scripts\logon.bat
790
Profile Path: \\frodo\profiles\vlaan
792
Account desc: Guest User
796
Logoff time: Mon, 18 Jan 2038 20:14:07 GMT
797
Kickoff time: Mon, 18 Jan 2038 20:14:07 GMT
798
Password last set: Wed, 29 Jun 2005 19:35:12 GMT
799
Password can change: Wed, 29 Jun 2005 19:35:12 GMT
800
Password must change: Mon, 18 Jan 2038 20:14:07 GMT
801
Last bad password : 0
802
Bad password count : 0
803
Logon hours : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
805
</p></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2591462"></a>Deleting Accounts</h5></div></div></div><p>
806
<a class="indexterm" name="id2591470"></a>
807
<a class="indexterm" name="id2591476"></a>
808
<a class="indexterm" name="id2591483"></a>
809
<a class="indexterm" name="id2591490"></a>
810
An account can be deleted from the SambaSAMAccount database
811
</p><pre class="screen">
812
<code class="prompt">root# </code> pdbedit -x vlaan
814
The account is removed without further screen output. The account is removed only from the
815
SambaSAMAccount (passdb backend) database, it is not removed from the UNIX account backend.
817
<a class="indexterm" name="id2591517"></a>
818
<a class="indexterm" name="id2591524"></a>
819
The use of the NT4 domain user manager to delete an account will trigger the <em class="parameter"><code>delete user
820
script</code></em>, but not the <code class="literal">pdbedit</code> tool.
821
</p></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2591546"></a>Changing User Accounts</h5></div></div></div><p>
822
<a class="indexterm" name="id2591554"></a>
823
Refer to the <code class="literal">pdbedit</code> man page for a full synopsis of all operations
824
that are available with this tool.
826
<a class="indexterm" name="id2591572"></a>
827
An example of a simple change in the user account information is the change of the full name
828
information shown here:
829
</p><pre class="screen">
830
<code class="prompt">root# </code> pdbedit -r --fullname="Victor Aluicious Laan" vlaan
832
Primary Group SID: S-1-5-21-726309263-4128913605-1168186429-513
833
Full Name: Victor Aluicious Laan
834
Home Directory: \\frodo\vlaan
838
<a class="indexterm" name="id2591599"></a>
839
<a class="indexterm" name="id2591606"></a>
840
<a class="indexterm" name="id2591613"></a>
841
Let us assume for a moment that a user's password has expired and the user is unable to
842
change the password at this time. It may be necessary to give the user additional grace time
843
so that it is possible to continue to work with the account and the original password. This
844
demonstrates how the password expiration settings may be updated
845
</p><pre class="screen">
846
<code class="prompt">root# </code> pdbedit -Lv vlaan
848
Password last set: Sun, 09 Sep 2001 22:21:40 GMT
849
Password can change: Thu, 03 Jan 2002 15:08:35 GMT
850
Password must change: Thu, 03 Jan 2002 15:08:35 GMT
851
Last bad password : Thu, 03 Jan 2002 15:08:35 GMT
852
Bad password count : 2
855
<a class="indexterm" name="id2591641"></a>
856
<a class="indexterm" name="id2591648"></a>
857
The user has recorded 2 bad logon attempts and the next will lock the account, but the
858
password is also expired. Here is how this account can be reset:
859
</p><pre class="screen">
860
<code class="prompt">root# </code> pdbedit -z vlaan
862
Password last set: Sun, 09 Sep 2001 22:21:40 GMT
863
Password can change: Thu, 03 Jan 2002 15:08:35 GMT
864
Password must change: Thu, 03 Jan 2002 15:08:35 GMT
865
Last bad password : 0
866
Bad password count : 0
869
The <code class="literal">Password must change:</code> parameter can be reset like this:
870
</p><pre class="screen">
871
<code class="prompt">root# </code> pdbedit --pwd-must-change-time=1200000000 vlaan
873
Password last set: Sun, 09 Sep 2001 22:21:40 GMT
874
Password can change: Thu, 03 Jan 2002 15:08:35 GMT
875
Password must change: Thu, 10 Jan 2008 14:20:00 GMT
878
Another way to use this tools is to set the date like this:
879
</p><pre class="screen">
880
<code class="prompt">root# </code> pdbedit --pwd-must-change-time="2010-01-01" \
881
--time-format="%Y-%m-%d" vlaan
883
Password last set: Sun, 09 Sep 2001 22:21:40 GMT
884
Password can change: Thu, 03 Jan 2002 15:08:35 GMT
885
Password must change: Fri, 01 Jan 2010 00:00:00 GMT
888
<a class="indexterm" name="id2591712"></a>
889
<a class="indexterm" name="id2591719"></a>
890
Refer to the strptime man page for specific time format information.
892
<a class="indexterm" name="id2591730"></a>
893
<a class="indexterm" name="id2591737"></a>
894
Please refer to the pdbedit man page for further information relating to SambaSAMAccount
896
</p><div class="sect5" lang="en"><div class="titlepage"><div><div><h6 class="title"><a name="TOSHARG-acctflags"></a>Account Flags Management</h6></div></div></div><p>
897
<a class="indexterm" name="id2591759"></a>
898
<a class="indexterm" name="id2591766"></a>
899
<a class="indexterm" name="id2591775"></a>
900
<a class="indexterm" name="id2591782"></a>
901
The Samba SAM account flags are properly called the ACB (account control block) within
902
the Samba source code. In some parts of the Samba source code they are referred to as the
903
account encode_bits, and also as the account control flags.
905
<a class="indexterm" name="id2591797"></a>
906
<a class="indexterm" name="id2591804"></a>
907
<a class="indexterm" name="id2591810"></a>
908
<a class="indexterm" name="id2591817"></a>
909
<a class="indexterm" name="id2591824"></a>
910
The manual adjustment of user, machine (workstation or server) or an inter-domain trust
911
account account flgas should not be necessary under normal conditions of use of Samba. On the other hand,
912
where this information becomes corrupted for some reason, the ability to correct the damaged data is certainly
913
useful. The tool of choice by which such correction can be affected is the <code class="literal">pdbedit</code> utility.
915
<a class="indexterm" name="id2591854"></a>
916
<a class="indexterm" name="id2591861"></a>
917
There have been a few requests for information regarding the account flags from developers
918
who are creating their own Samba management tools. An example of a need for information regarding
919
the proper management of the account flags is evident when developing scripts that will be used
920
to manage an LDAP directory.
922
<a class="indexterm" name="id2591876"></a>
923
<a class="indexterm" name="id2591883"></a>
924
The account flag field can contain up to 16 characters. Presently, only 11 are in use.
925
These are listed in <a class="link" href="passdb.html#accountflags" title="Table�11.2.�Samba SAM Account Control Block Flags">Samba SAM Account Control Block Flags</a>.
926
The order in which the flags are specified to the <code class="literal">pdbedit</code> command is not important.
927
In fact, they can be set without problem in any order in the SambaAcctFlags record in the LDAP directory.
928
</p><div class="table"><a name="accountflags"></a><p class="title"><b>Table�11.2.�Samba SAM Account Control Block Flags</b></p><div class="table-contents"><table summary="Samba SAM Account Control Block Flags" border="1"><colgroup><col><col></colgroup><thead><tr><th align="center">Flag</th><th align="center">Description</th></tr></thead><tbody><tr><td align="center">D</td><td align="left">Account is disabled.</td></tr><tr><td align="center">H</td><td align="left">A home directory is required.</td></tr><tr><td align="center">I</td><td align="left">An inter-domain trust account.</td></tr><tr><td align="center">L</td><td align="left">Account has been auto-locked.</td></tr><tr><td align="center">M</td><td align="left">An MNS (Microsoft network service) logon account.</td></tr><tr><td align="center">N</td><td align="left">Password not required.</td></tr><tr><td align="center">S</td><td align="left">A server trust account.</td></tr><tr><td align="center">T</td><td align="left">Temporary duplicate account entry.</td></tr><tr><td align="center">U</td><td align="left">A normal user account.</td></tr><tr><td align="center">W</td><td align="left">A workstation trust account.</td></tr><tr><td align="center">X</td><td align="left">Password does not expire.</td></tr></tbody></table></div></div><br class="table-break"><p>
929
<a class="indexterm" name="id2592114"></a>
930
<a class="indexterm" name="id2592121"></a>
931
An example of use of the <code class="literal">pdbedit</code> utility to set the account control flags
933
</p><pre class="screen">
934
<code class="prompt">root# </code> pdbedit -r -c "[DLX]" jht
937
Account Flags: [DHULX ]
938
User SID: S-1-5-21-729263-4123605-1186429-3000
939
Primary Group SID: S-1-5-21-729263-4123605-1186429-513
940
Full Name: John H Terpstra,Utah Office
941
Home Directory: \\aurora\jht
943
Logon Script: scripts\logon.bat
944
Profile Path: \\aurora\profiles\jht
946
Account desc: BluntObject
949
Logoff time: Mon, 18 Jan 2038 20:14:07 GMT
951
Password last set: Sun, 03 Jul 2005 23:19:18 GMT
952
Password can change: Sun, 03 Jul 2005 23:19:18 GMT
953
Password must change: Mon, 18 Jan 2038 20:14:07 GMT
954
Last bad password : 0
955
Bad password count : 0
956
Logon hours : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
958
<a class="indexterm" name="id2592176"></a>
959
The flags can be reset to the default settings by executing:
960
</p><pre class="screen">
961
<code class="prompt">root# </code> pdbedit -r -c "[]" jht
965
User SID: S-1-5-21-729263-4123605-1186429-3000
966
Primary Group SID: S-1-5-21-729263-4123605-1186429-513
967
Full Name: John H Terpstra,Utah Office
968
Home Directory: \\aurora\jht
970
Logon Script: scripts\logon.bat
971
Profile Path: \\aurora\profiles\jht
973
Account desc: BluntObject
976
Logoff time: Mon, 18 Jan 2038 20:14:07 GMT
978
Password last set: Sun, 03 Jul 2005 23:19:18 GMT
979
Password can change: Sun, 03 Jul 2005 23:19:18 GMT
980
Password must change: Mon, 18 Jan 2038 20:14:07 GMT
981
Last bad password : 0
982
Bad password count : 0
983
Logon hours : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
985
</p></div></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2592213"></a>Domain Account Policy Managment</h5></div></div></div><p>
986
<a class="indexterm" name="id2592221"></a>
987
<a class="indexterm" name="id2592228"></a>
988
To view the domain account access policies that may be configured execute:
989
</p><pre class="screen">
990
<code class="prompt">root# </code> pdbedit -P ?
991
No account policy by that name
992
Account policy names are :
995
user must logon to change password
1002
refuse machine password change
1005
Commands will be executed to establish controls for our domain as follows:
1006
</p><div class="orderedlist"><ol type="1"><li><p>min password length = 8 characters.</p></li><li><p>password history = last 4 passwords.</p></li><li><p>maximum password age = 90 days.</p></li><li><p>minimum password age = 7 days.</p></li><li><p>bad lockout attempt = 8 bad logon attempts.</p></li><li><p>lockout duration = forever, account must be manually reenabled.</p></li></ol></div><p>
1007
The following command execution will achieve these settings:
1008
</p><pre class="screen">
1009
<code class="prompt">root# </code> pdbedit -P "min password length" -C 8
1010
account policy value for min password length was 5
1011
account policy value for min password length is now 8
1012
<code class="prompt">root# </code> pdbedit -P "password history" -C 4
1013
account policy value for password history was 0
1014
account policy value for password history is now 4
1015
<code class="prompt">root# </code> pdbedit -P "maximum password age" -C 7776000
1016
account policy value for maximum password age was 4294967295
1017
account policy value for maximum password age is now 7776000
1018
<code class="prompt">root# </code> pdbedit -P "minimum password age" -C 604800
1019
account policy value for minimum password age was 0
1020
account policy value for minimum password age is now 7
1021
<code class="prompt">root# </code> pdbedit -P "bad lockout attempt" -C 8
1022
account policy value for bad lockout attempt was 0
1023
account policy value for bad lockout attempt is now 8
1024
<code class="prompt">root# </code> pdbedit -P "lockout duration" -C -1
1025
account policy value for lockout duration was 30
1026
account policy value for lockout duration is now 4294967295
1028
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
1029
To set the maximum (infinite) lockout time use the value of -1.
1030
</p></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>
1031
Account policies must be set individually on each PDC and BDC. At this time (Samba 3.0.11 to Samba 3.0.14a)
1032
account policies are not replicated automatically. This may be fixed before Samba 3.0.20 ships or some
1033
time there after. Please check the WHATSNEW.txt file in the Samba-3 tarball for specific update notiations
1034
regarding this facility.
1035
</p></div></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2592375"></a>Account Import/Export</h4></div></div></div><p>
1036
<a class="indexterm" name="id2592383"></a>
1037
<a class="indexterm" name="id2592390"></a>
1038
<a class="indexterm" name="id2592397"></a>
1039
The <code class="literal">pdbedit</code> tool allows import/export of authentication (account)
1040
databases from one backend to another. For example, to import/export accounts from an
1041
old <code class="filename">smbpasswd</code> database to a <em class="parameter"><code>tdbsam</code></em>
1043
</p><div class="procedure"><ol type="1"><li><p>
1044
<a class="indexterm" name="id2592433"></a>
1045
</p><pre class="screen">
1046
<code class="prompt">root# </code><strong class="userinput"><code>pdbedit -i smbpasswd -e tdbsam</code></strong>
1049
<a class="indexterm" name="id2592463"></a>
1050
Replace the <em class="parameter"><code>smbpasswd</code></em> with <em class="parameter"><code>tdbsam</code></em> in the
1051
<em class="parameter"><code>passdb backend</code></em> configuration in <code class="filename">smb.conf</code>.
1052
</p></li></ol></div></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2592500"></a>Password Backends</h2></div></div></div><p>
1053
<a class="indexterm" name="id2592508"></a>
1054
<a class="indexterm" name="id2592514"></a>
1055
Samba offers flexibility in backend account database design. The flexibility is immediately obvious as one
1056
begins to explore this capability. Recent changes to Samba (since 3.0.23) have removed the mulitple backend
1057
feature in order to simplify problems that broke some installations. This removal has made the internal
1058
operation of Samba-3 more consistent and predictable.
1060
<a class="indexterm" name="id2592531"></a>
1061
<a class="indexterm" name="id2592538"></a>
1062
Beginning with Samba 3.0.23 it is no longer possible to specify use of mulitple passdb backends. Earlier
1063
versions of Samba-3 made it possible to specify multiple password backends, and even multiple
1064
backends of the same type. The multiple passdb backend capability caused many problems with name to SID and
1065
SID to name ID resolution. The Samba team wrestled with the challenges and decided that this feature needed
1067
</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2592553"></a>Plaintext</h3></div></div></div><p>
1068
<a class="indexterm" name="id2592561"></a>
1069
<a class="indexterm" name="id2592568"></a>
1070
<a class="indexterm" name="id2592575"></a>
1071
<a class="indexterm" name="id2592582"></a>
1072
<a class="indexterm" name="id2592589"></a>
1073
<a class="indexterm" name="id2592596"></a>
1074
Older versions of Samba retrieved user information from the UNIX user database
1075
and eventually some other fields from the file <code class="filename">/etc/samba/smbpasswd</code>
1076
or <code class="filename">/etc/smbpasswd</code>. When password encryption is disabled, no
1077
SMB-specific data is stored at all. Instead, all operations are conducted via the way
1078
that the Samba host OS will access its <code class="filename">/etc/passwd</code> database.
1079
On most Linux systems, for example, all user and group resolution is done via PAM.
1080
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2592629"></a>smbpasswd: Encrypted Password Database</h3></div></div></div><p>
1081
<a class="indexterm" name="id2592638"></a>
1082
<a class="indexterm" name="id2592647"></a>
1083
<a class="indexterm" name="id2592654"></a>
1084
<a class="indexterm" name="id2592661"></a>
1085
Traditionally, when configuring <a class="link" href="smb.conf.5.html#ENCRYPTPASSWORDS" target="_top">encrypt passwords = yes</a>
1086
in Samba's <code class="filename">smb.conf</code> file, user account information such as username, LM/NT password hashes,
1087
password change times, and account flags have been stored in the <code class="filename">smbpasswd(5)</code>
1088
file. There are several disadvantages to this approach for sites with large numbers of users
1089
(counted in the thousands).
1090
</p><div class="itemizedlist"><ul type="disc"><li><p>
1091
<a class="indexterm" name="id2592704"></a>
1092
The first problem is that all lookups must be performed sequentially. Given that
1093
there are approximately two lookups per domain logon (one during initial logon validation
1094
and one for a session connection setup, such as when mapping a network drive or printer), this
1095
is a performance bottleneck for large sites. What is needed is an indexed approach
1096
such as that used in databases.
1098
<a class="indexterm" name="id2592721"></a>
1099
<a class="indexterm" name="id2592728"></a>
1100
<a class="indexterm" name="id2592735"></a>
1101
<a class="indexterm" name="id2592742"></a>
1102
<a class="indexterm" name="id2592748"></a>
1103
The second problem is that administrators who desire to replicate an smbpasswd file
1104
to more than one Samba server are left to use external tools such as
1105
<code class="literal">rsync(1)</code> and <code class="literal">ssh(1)</code> and write custom,
1108
<a class="indexterm" name="id2592774"></a>
1109
<a class="indexterm" name="id2592781"></a>
1110
<a class="indexterm" name="id2592788"></a>
1111
<a class="indexterm" name="id2592795"></a>
1112
<a class="indexterm" name="id2592802"></a>
1113
Finally, the amount of information that is stored in an smbpasswd entry leaves
1114
no room for additional attributes such as a home directory, password expiration time,
1115
or even a relative identifier (RID).
1116
</p></li></ul></div><p>
1117
<a class="indexterm" name="id2592818"></a>
1118
<a class="indexterm" name="id2592825"></a>
1119
<a class="indexterm" name="id2592832"></a>
1120
<a class="indexterm" name="id2592839"></a>
1121
As a result of these deficiencies, a more robust means of storing user attributes
1122
used by smbd was developed. The API that defines access to user accounts
1123
is commonly referred to as the samdb interface (previously, this was called the passdb
1124
API and is still so named in the Samba source code trees).
1126
<a class="indexterm" name="id2592855"></a>
1127
<a class="indexterm" name="id2592862"></a>
1128
<a class="indexterm" name="id2592869"></a>
1129
<a class="indexterm" name="id2592876"></a>
1130
<a class="indexterm" name="id2592882"></a>
1131
Samba provides an enhanced set of passdb backends that overcome the deficiencies
1132
of the smbpasswd plaintext database. These are tdbsam and ldapsam.
1133
Of these, ldapsam will be of most interest to large corporate or enterprise sites.
1134
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2592895"></a>tdbsam</h3></div></div></div><p>
1135
<a class="indexterm" name="id2592903"></a>
1136
<a class="indexterm" name="id2592912"></a>
1137
<a class="indexterm" name="id2592921"></a>
1138
Samba can store user and machine account data in a “<span class="quote">TDB</span>” (trivial database).
1139
Using this backend does not require any additional configuration. This backend is
1140
recommended for new installations that do not require LDAP.
1142
<a class="indexterm" name="id2592939"></a>
1143
<a class="indexterm" name="id2592946"></a>
1144
<a class="indexterm" name="id2592952"></a>
1145
<a class="indexterm" name="id2592959"></a>
1146
As a general guide, the Samba Team does not recommend using the tdbsam backend for sites
1147
that have 250 or more users. Additionally, tdbsam is not capable of scaling for use
1148
in sites that require PDB/BDC implementations that require replication of the account
1149
database. Clearly, for reason of scalability, the use of ldapsam should be encouraged.
1151
<a class="indexterm" name="id2592975"></a>
1152
<a class="indexterm" name="id2592982"></a>
1153
<a class="indexterm" name="id2592989"></a>
1154
The recommendation of a 250-user limit is purely based on the notion that this
1155
would generally involve a site that has routed networks, possibly spread across
1156
more than one physical location. The Samba Team has not at this time established
1157
the performance-based scalability limits of the tdbsam architecture.
1159
<a class="indexterm" name="id2593004"></a>
1160
<a class="indexterm" name="id2593011"></a>
1161
<a class="indexterm" name="id2593018"></a>
1162
<a class="indexterm" name="id2593025"></a>
1163
There are sites that have thousands of users and yet require only one server.
1164
One site recently reported having 4,500 user accounts on one UNIX system and
1165
reported excellent performance with the <code class="literal">tdbsam</code> passdb backend.
1166
The limitation of where the <code class="literal">tdbsam</code> passdb backend can be used
1167
is not one pertaining to a limitation in the TDB storage system, it is based
1168
only on the need for a reliable distribution mechanism for the SambaSAMAccount
1170
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2593053"></a>ldapsam</h3></div></div></div><p>
1171
<a class="indexterm" name="id2593061"></a>
1172
<a class="indexterm" name="id2593068"></a>
1173
<a class="indexterm" name="id2593074"></a>
1174
There are a few points to stress that the ldapsam does not provide. The LDAP
1175
support referred to in this documentation does not include:
1176
</p><div class="itemizedlist"><ul type="disc"><li><p>A means of retrieving user account information from
1177
a Windows 200x Active Directory server.</p></li><li><p>A means of replacing /etc/passwd.</p></li></ul></div><p>
1178
<a class="indexterm" name="id2593104"></a>
1179
<a class="indexterm" name="id2593110"></a>
1180
<a class="indexterm" name="id2593117"></a>
1181
<a class="indexterm" name="id2593123"></a>
1182
The second item can be accomplished by using LDAP NSS and PAM modules. LGPL versions of these libraries can be
1183
obtained from <a class="ulink" href="http://www.padl.com/" target="_top">PADL Software</a>. More information about the
1184
configuration of these packages may be found in <a class="ulink" href="http://safari.oreilly.com/?XmlId=1-56592-491-6" target="_top">
1185
<span class="emphasis"><em>LDAP, System Administration</em></span> by Gerald Carter, Chapter 6, Replacing NIS"</a>.
1187
<a class="indexterm" name="id2593154"></a>
1188
<a class="indexterm" name="id2593161"></a>
1189
<a class="indexterm" name="id2593168"></a>
1190
This document describes how to use an LDAP directory for storing Samba user
1191
account information traditionally stored in the smbpasswd(5) file. It is
1192
assumed that the reader already has a basic understanding of LDAP concepts
1193
and has a working directory server already installed. For more information
1194
on LDAP architectures and directories, please refer to the following sites:
1195
</p><div class="itemizedlist"><ul type="disc"><li><p><a class="ulink" href="http://www.openldap.org/" target="_top">OpenLDAP</a></p></li><li><p><a class="ulink" href="http://www.sun.com/software/products/directory_srvr_ee/index.xml" target="_top">
1196
Sun One Directory Server</a></p></li><li><p><a class="ulink" href="http://www.novell.com/products/edirectory/" target="_top">Novell eDirectory</a></p></li><li><p><a class="ulink" href="http://www-306.ibm.com/software/tivoli/products/directory-server/" target="_top">IBM
1197
Tivoli Directory Server</a></p></li><li><p><a class="ulink" href="http://www.redhat.com/software/rha/directory/" target="_top">Red Hat Directory
1198
Server</a></p></li><li><p><a class="ulink" href="http://www.linuxsecurity.com/content/view/119229" target="_top">Fedora Directory
1199
Server</a></p></li></ul></div><p>
1200
Two additional Samba resources that may prove to be helpful are:
1201
</p><div class="itemizedlist"><ul type="disc"><li><p>
1202
<a class="indexterm" name="id2593249"></a>
1203
The <a class="ulink" href="http://www.unav.es/cti/ldap-smb/ldap-smb-3-howto.html" target="_top">Samba-PDC-LDAP-HOWTO</a>
1204
maintained by Ignacio Coupeau.
1206
<a class="indexterm" name="id2593268"></a>
1207
<a class="indexterm" name="id2593275"></a>
1208
<a class="indexterm" name="id2593282"></a>
1209
The NT migration scripts from <a class="ulink" href="http://samba.idealx.org/" target="_top">IDEALX</a> that are
1210
geared to manage users and groups in such a Samba-LDAP domain controller configuration.
1211
Idealx also produced the smbldap-tools and the Interactive Console Management tool.
1212
</p></li></ul></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2593301"></a>Supported LDAP Servers</h4></div></div></div><p>
1213
<a class="indexterm" name="id2593309"></a>
1214
<a class="indexterm" name="id2593316"></a>
1215
<a class="indexterm" name="id2593322"></a>
1216
<a class="indexterm" name="id2593329"></a>
1217
The LDAP ldapsam code was developed and tested using the OpenLDAP 2.x server and
1218
client libraries. The same code should work with Netscape's Directory Server and client SDK.
1219
However, there are bound to be compile errors and bugs. These should not be hard to fix.
1220
Please submit fixes via the process outlined in <a class="link" href="bugreport.html" title="Chapter�40.�Reporting Bugs">Reporting Bugs</a>.
1222
Samba is capable of working with any standards-compliant LDAP server.
1223
</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2593356"></a>Schema and Relationship to the RFC 2307 posixAccount</h4></div></div></div><p>
1224
Samba-3.0 includes the necessary schema file for OpenLDAP 2.x in the
1225
<code class="filename">examples/LDAP/samba.schema</code> directory of the source code distribution
1226
tarball. The schema entry for the sambaSamAccount ObjectClass is shown here:
1227
</p><pre class="programlisting">
1228
ObjectClass (1.3.6.1.4.1.7165.2.2.6 NAME 'sambaSamAccount' SUP top AUXILIARY
1229
DESC 'Samba-3.0 Auxiliary SAM Account'
1230
MUST ( uid $ sambaSID )
1231
MAY ( cn $ sambaLMPassword $ sambaNTPassword $ sambaPwdLastSet $
1232
sambaLogonTime $ sambaLogoffTime $ sambaKickoffTime $
1233
sambaPwdCanChange $ sambaPwdMustChange $ sambaAcctFlags $
1234
displayName $ sambaHomePath $ sambaHomeDrive $ sambaLogonScript $
1235
sambaProfilePath $ description $ sambaUserWorkstations $
1236
sambaPrimaryGroupSID $ sambaDomainName ))
1239
<a class="indexterm" name="id2593392"></a>
1240
<a class="indexterm" name="id2593399"></a>
1241
<a class="indexterm" name="id2593406"></a>
1242
The <code class="filename">samba.schema</code> file has been formatted for OpenLDAP 2.0/2.1.
1243
The Samba Team owns the OID space used by the above schema and recommends its use.
1244
If you translate the schema to be used with Netscape DS, please submit the modified
1245
schema file as a patch to <a class="ulink" href="mailto:jerry@samba.org" target="_top">jerry@samba.org</a>.
1247
<a class="indexterm" name="id2593432"></a>
1248
<a class="indexterm" name="id2593439"></a>
1249
<a class="indexterm" name="id2593446"></a>
1250
<a class="indexterm" name="id2593453"></a>
1251
<a class="indexterm" name="id2593460"></a>
1252
<a class="indexterm" name="id2593467"></a>
1253
<a class="indexterm" name="id2593473"></a>
1254
Just as the smbpasswd file is meant to store information that provides information
1255
additional to a user's <code class="filename">/etc/passwd</code> entry, so is the sambaSamAccount
1256
object meant to supplement the UNIX user account information. A sambaSamAccount is an
1257
<code class="constant">AUXILIARY</code> ObjectClass, so it can be used to augment existing
1258
user account information in the LDAP directory, thus providing information needed
1259
for Samba account handling. However, there are several fields (e.g., uid) that overlap
1260
with the posixAccount ObjectClass outlined in RFC 2307. This is by design.
1262
<a class="indexterm" name="id2593502"></a>
1263
<a class="indexterm" name="id2593509"></a>
1264
<a class="indexterm" name="id2593516"></a>
1265
<a class="indexterm" name="id2593523"></a>
1266
<a class="indexterm" name="id2593530"></a>
1267
<a class="indexterm" name="id2593537"></a>
1268
<a class="indexterm" name="id2593544"></a>
1269
<a class="indexterm" name="id2593550"></a>
1270
<a class="indexterm" name="id2593557"></a>
1271
In order to store all user account information (UNIX and Samba) in the directory,
1272
it is necessary to use the sambaSamAccount and posixAccount ObjectClasses in
1273
combination. However, <code class="literal">smbd</code> will still obtain the user's UNIX account
1274
information via the standard C library calls, such as getpwnam().
1275
This means that the Samba server must also have the LDAP NSS library installed
1276
and functioning correctly. This division of information makes it possible to
1277
store all Samba account information in LDAP, but still maintain UNIX account
1278
information in NIS while the network is transitioning to a full LDAP infrastructure.
1279
</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2593582"></a>OpenLDAP Configuration</h4></div></div></div><p>
1280
<a class="indexterm" name="id2593590"></a>
1281
<a class="indexterm" name="id2593597"></a>
1282
<a class="indexterm" name="id2593604"></a>
1283
<a class="indexterm" name="id2593611"></a>
1284
To include support for the sambaSamAccount object in an OpenLDAP directory
1285
server, first copy the samba.schema file to slapd's configuration directory.
1286
The samba.schema file can be found in the directory <code class="filename">examples/LDAP</code>
1287
in the Samba source distribution.
1288
</p><pre class="screen">
1289
<code class="prompt">root# </code><strong class="userinput"><code>cp samba.schema /etc/openldap/schema/</code></strong>
1292
<a class="indexterm" name="id2593648"></a>
1293
<a class="indexterm" name="id2593655"></a>
1294
<a class="indexterm" name="id2593661"></a>
1295
<a class="indexterm" name="id2593668"></a>
1296
<a class="indexterm" name="id2593675"></a>
1297
<a class="indexterm" name="id2593682"></a>
1298
<a class="indexterm" name="id2593689"></a>
1299
<a class="indexterm" name="id2593696"></a>
1300
Next, include the <code class="filename">samba.schema</code> file in <code class="filename">slapd.conf</code>.
1301
The sambaSamAccount object contains two attributes that depend on other schema
1302
files. The <em class="parameter"><code>uid</code></em> attribute is defined in <code class="filename">cosine.schema</code> and
1303
the <em class="parameter"><code>displayName</code></em> attribute is defined in the <code class="filename">inetorgperson.schema</code>
1304
file. Both of these must be included before the <code class="filename">samba.schema</code> file.
1305
</p><pre class="programlisting">
1306
## /etc/openldap/slapd.conf
1308
## schema files (core.schema is required by default)
1309
include /etc/openldap/schema/core.schema
1311
## needed for sambaSamAccount
1312
include /etc/openldap/schema/cosine.schema
1313
include /etc/openldap/schema/inetorgperson.schema
1314
include /etc/openldap/schema/nis.schema
1315
include /etc/openldap/schema/samba.schema
1319
<a class="indexterm" name="id2593764"></a>
1320
<a class="indexterm" name="id2593771"></a>
1321
<a class="indexterm" name="id2593778"></a>
1322
<a class="indexterm" name="id2593784"></a>
1323
It is recommended that you maintain some indices on some of the most useful attributes,
1324
as in the following example, to speed up searches made on sambaSamAccount ObjectClasses
1325
(and possibly posixAccount and posixGroup as well):
1327
</p><pre class="programlisting">
1328
# Indices to maintain
1329
## required by OpenLDAP
1330
index objectclass eq
1332
index cn pres,sub,eq
1333
index sn pres,sub,eq
1334
## required to support pdb_getsampwnam
1335
index uid pres,sub,eq
1336
## required to support pdb_getsambapwrid()
1337
index displayName pres,sub,eq
1339
## uncomment these if you are storing posixAccount and
1340
## posixGroup entries in the directory as well
1341
##index uidNumber eq
1342
##index gidNumber eq
1343
##index memberUid eq
1346
index sambaPrimaryGroupSID eq
1347
index sambaDomainName eq
1351
Create the new index by executing:
1352
</p><pre class="screen">
1353
<code class="prompt">root# </code>./sbin/slapindex -f slapd.conf
1356
Remember to restart slapd after making these changes:
1357
</p><pre class="screen">
1358
<code class="prompt">root# </code><strong class="userinput"><code>/etc/init.d/slapd restart</code></strong>
1360
</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2593854"></a>Initialize the LDAP Database</h4></div></div></div><p>
1361
<a class="indexterm" name="id2593862"></a>
1362
<a class="indexterm" name="id2593869"></a>
1363
<a class="indexterm" name="id2593876"></a>
1364
<a class="indexterm" name="id2593883"></a>
1365
Before you can add accounts to the LDAP database, you must create the account containers
1366
that they will be stored in. The following LDIF file should be modified to match your
1367
needs (DNS entries, and so on):
1368
</p><pre class="programlisting">
1369
# Organization for Samba Base
1370
dn: dc=quenya,dc=org
1371
objectclass: dcObject
1372
objectclass: organization
1374
o: Quenya Org Network
1375
description: The Samba-3 Network LDAP Example
1377
# Organizational Role for Directory Management
1378
dn: cn=Manager,dc=quenya,dc=org
1379
objectclass: organizationalRole
1381
description: Directory Manager
1383
# Setting up container for Users OU
1384
dn: ou=People,dc=quenya,dc=org
1386
objectclass: organizationalUnit
1389
# Setting up admin handle for People OU
1390
dn: cn=admin,ou=People,dc=quenya,dc=org
1393
objectclass: organizationalRole
1394
objectclass: simpleSecurityObject
1395
userPassword: {SSHA}c3ZM9tBaBo9autm1dL3waDS21+JSfQVz
1397
# Setting up container for groups
1398
dn: ou=Groups,dc=quenya,dc=org
1400
objectclass: organizationalUnit
1403
# Setting up admin handle for Groups OU
1404
dn: cn=admin,ou=Groups,dc=quenya,dc=org
1407
objectclass: organizationalRole
1408
objectclass: simpleSecurityObject
1409
userPassword: {SSHA}c3ZM9tBaBo9autm1dL3waDS21+JSfQVz
1411
# Setting up container for computers
1412
dn: ou=Computers,dc=quenya,dc=org
1414
objectclass: organizationalUnit
1417
# Setting up admin handle for Computers OU
1418
dn: cn=admin,ou=Computers,dc=quenya,dc=org
1421
objectclass: organizationalRole
1422
objectclass: simpleSecurityObject
1423
userPassword: {SSHA}c3ZM9tBaBo9autm1dL3waDS21+JSfQVz
1426
<a class="indexterm" name="id2593926"></a>
1427
<a class="indexterm" name="id2593933"></a>
1428
The userPassword shown above should be generated using <code class="literal">slappasswd</code>.
1430
<a class="indexterm" name="id2593950"></a>
1431
<a class="indexterm" name="id2593956"></a>
1432
The following command will then load the contents of the LDIF file into the LDAP
1434
<a class="indexterm" name="id2593965"></a>
1435
</p><pre class="screen">
1436
<code class="prompt">$ </code><strong class="userinput"><code>slapadd -v -l initldap.dif</code></strong>
1439
Do not forget to secure your LDAP server with an adequate access control list
1440
as well as an admin password.
1441
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
1442
<a class="indexterm" name="id2593997"></a>
1443
Before Samba can access the LDAP server, you need to store the LDAP admin password
1444
in the Samba-3 <code class="filename">secrets.tdb</code> database by:
1445
<a class="indexterm" name="id2594012"></a>
1446
</p><pre class="screen">
1447
<code class="prompt">root# </code><strong class="userinput"><code>smbpasswd -w <em class="replaceable"><code>secret</code></em></code></strong>
1449
</p></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2594040"></a>Configuring Samba</h4></div></div></div><p>
1450
<a class="indexterm" name="id2594047"></a>
1451
<a class="indexterm" name="id2594054"></a>
1452
The following parameters are available in <code class="filename">smb.conf</code> only if your version of Samba was built with
1453
LDAP support. Samba automatically builds with LDAP support if the LDAP libraries are found. The
1454
best method to verify that Samba was built with LDAP support is:
1455
</p><pre class="screen">
1456
<code class="prompt">root# </code> smbd -b | grep LDAP
1459
HAVE_LDAP_DOMAIN2HOSTLIST
1461
HAVE_LDAP_INITIALIZE
1462
HAVE_LDAP_SET_REBIND_PROC
1464
LDAP_SET_REBIND_PROC_ARGS
1466
If the build of the <code class="literal">smbd</code> command you are using does not produce output
1467
that includes <code class="literal">HAVE_LDAP_H</code> it is necessary to discover why the LDAP headers
1468
and libraries were not found during compilation.
1469
</p><p>LDAP-related smb.conf options include these:
1470
</p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2594111"></a><em class="parameter"><code>passdb backend = ldapsam:url</code></em></td></tr><tr><td><a class="indexterm" name="id2594123"></a></td></tr><tr><td><a class="indexterm" name="id2594130"></a></td></tr><tr><td><a class="indexterm" name="id2594137"></a></td></tr><tr><td><a class="indexterm" name="id2594143"></a></td></tr><tr><td><a class="indexterm" name="id2594150"></a></td></tr><tr><td><a class="indexterm" name="id2594157"></a></td></tr><tr><td><a class="indexterm" name="id2594164"></a></td></tr><tr><td><a class="indexterm" name="id2594171"></a></td></tr><tr><td><a class="indexterm" name="id2594178"></a></td></tr><tr><td><a class="indexterm" name="id2594185"></a></td></tr><tr><td><a class="indexterm" name="id2594192"></a></td></tr><tr><td><a class="indexterm" name="id2594199"></a></td></tr><tr><td><a class="indexterm" name="id2594206"></a></td></tr></table><p>
1472
These are described in the <code class="filename">smb.conf</code> man page and so are not repeated here. However, an example
1473
for use with an LDAP directory is shown in <a class="link" href="passdb.html#confldapex" title="Example�11.2.�Configuration with LDAP">the Configuration with LDAP.</a>
1474
</p><div class="example"><a name="confldapex"></a><p class="title"><b>Example�11.2.�Configuration with LDAP</b></p><div class="example-contents"><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[global]</code></em></td></tr><tr><td><a class="indexterm" name="id2594257"></a><em class="parameter"><code>security = user</code></em></td></tr><tr><td><a class="indexterm" name="id2594269"></a><em class="parameter"><code>encrypt passwords = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2594281"></a><em class="parameter"><code>netbios name = MORIA</code></em></td></tr><tr><td><a class="indexterm" name="id2594292"></a><em class="parameter"><code>workgroup = NOLDOR</code></em></td></tr><tr><td># LDAP related parameters:</td></tr><tr><td># Define the DN used when binding to the LDAP servers.</td></tr><tr><td># The password for this DN is not stored in smb.conf</td></tr><tr><td># Set it using 'smbpasswd -w secret' to store the</td></tr><tr><td># passphrase in the secrets.tdb file.</td></tr><tr><td># If the "ldap admin dn" value changes, it must be reset.</td></tr><tr><td><a class="indexterm" name="id2594329"></a><em class="parameter"><code>ldap admin dn = "cn=Manager,dc=quenya,dc=org"</code></em></td></tr><tr><td># SSL directory connections can be configured by:</td></tr><tr><td># ('off', 'start tls', or 'on' (default))</td></tr><tr><td><a class="indexterm" name="id2594349"></a><em class="parameter"><code>ldap ssl = start tls</code></em></td></tr><tr><td># syntax: passdb backend = ldapsam:ldap://server-name[:port]</td></tr><tr><td><a class="indexterm" name="id2594365"></a><em class="parameter"><code>passdb backend = ldapsam:ldap://frodo.quenya.org</code></em></td></tr><tr><td># smbpasswd -x delete the entire dn-entry</td></tr><tr><td><a class="indexterm" name="id2594382"></a><em class="parameter"><code>ldap delete dn = no</code></em></td></tr><tr><td># The machine and user suffix are added to the base suffix</td></tr><tr><td># wrote WITHOUT quotes. NULL suffixes by default</td></tr><tr><td><a class="indexterm" name="id2594402"></a><em class="parameter"><code>ldap user suffix = ou=People</code></em></td></tr><tr><td><a class="indexterm" name="id2594414"></a><em class="parameter"><code>ldap group suffix = ou=Groups</code></em></td></tr><tr><td><a class="indexterm" name="id2594426"></a><em class="parameter"><code>ldap machine suffix = ou=Computers</code></em></td></tr><tr><td># Trust UNIX account information in LDAP</td></tr><tr><td># (see the smb.conf man page for details)</td></tr><tr><td># Specify the base DN to use when searching the directory</td></tr><tr><td><a class="indexterm" name="id2594450"></a><em class="parameter"><code>ldap suffix = dc=quenya,dc=org</code></em></td></tr></table></div></div><br class="example-break"></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2594464"></a>Accounts and Groups Management</h4></div></div></div><p>
1475
<a class="indexterm" name="id2594472"></a>
1476
<a class="indexterm" name="id2594479"></a>
1477
Because user accounts are managed through the sambaSamAccount ObjectClass, you should
1478
modify your existing administration tools to deal with sambaSamAccount attributes.
1480
<a class="indexterm" name="id2594495"></a>
1481
<a class="indexterm" name="id2594502"></a>
1482
<a class="indexterm" name="id2594509"></a>
1483
Machine accounts are managed with the sambaSamAccount ObjectClass, just
1484
like user accounts. However, it is up to you to store those accounts
1485
in a different tree of your LDAP namespace. You should use
1486
“<span class="quote">ou=Groups,dc=quenya,dc=org</span>” to store groups and
1487
“<span class="quote">ou=People,dc=quenya,dc=org</span>” to store users. Just configure your
1488
NSS and PAM accordingly (usually, in the <code class="filename">/etc/openldap/sldap.conf</code>
1489
configuration file).
1491
<a class="indexterm" name="id2594538"></a>
1492
<a class="indexterm" name="id2594545"></a>
1493
<a class="indexterm" name="id2594552"></a>
1494
<a class="indexterm" name="id2594559"></a>
1495
In Samba-3, the group management system is based on POSIX
1496
groups. This means that Samba makes use of the posixGroup ObjectClass.
1497
For now, there is no NT-like group system management (global and local
1498
groups). Samba-3 knows only about <code class="constant">Domain Groups</code>
1499
and, unlike MS Windows 2000 and Active Directory, Samba-3 does not
1500
support nested groups.
1501
</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2594577"></a>Security and sambaSamAccount</h4></div></div></div><p>
1502
<a class="indexterm" name="id2594585"></a>
1503
There are two important points to remember when discussing the security
1504
of sambaSAMAccount entries in the directory.
1505
</p><div class="itemizedlist"><ul type="disc"><li><p><span class="emphasis"><em>Never</em></span> retrieve the SambaLMPassword or
1506
<a class="indexterm" name="id2594604"></a>
1507
SambaNTPassword attribute values over an unencrypted LDAP session.</p></li><li><p><span class="emphasis"><em>Never</em></span> allow non-admin users to
1508
view the SambaLMPassword or SambaNTPassword attribute values.</p></li></ul></div><p>
1509
<a class="indexterm" name="id2594625"></a>
1510
<a class="indexterm" name="id2594632"></a>
1511
<a class="indexterm" name="id2594638"></a>
1512
These password hashes are clear-text equivalents and can be used to impersonate
1513
the user without deriving the original clear-text strings. For more information
1514
on the details of LM/NT password hashes, refer to <a class="link" href="passdb.html" title="Chapter�11.�Account Information Databases">the
1515
Account Information Database section</a>.
1517
<a class="indexterm" name="id2594660"></a>
1518
<a class="indexterm" name="id2594667"></a>
1519
<a class="indexterm" name="id2594674"></a>
1520
<a class="indexterm" name="id2594681"></a>
1521
To remedy the first security issue, the <a class="link" href="smb.conf.5.html#LDAPSSL" target="_top">ldap ssl</a> <code class="filename">smb.conf</code>
1522
parameter defaults to require an encrypted session (<a class="link" href="smb.conf.5.html#LDAPSSL" target="_top">ldap ssl = on</a>) using the default port of <code class="constant">636</code> when
1523
contacting the directory server. When using an OpenLDAP server, it
1524
is possible to use the StartTLS LDAP extended operation in the place of LDAPS.
1525
In either case, you are strongly encouraged to use secure communications protocols
1526
(so do not set <a class="link" href="smb.conf.5.html#LDAPSSL" target="_top">ldap ssl = off</a>).
1528
<a class="indexterm" name="id2594742"></a>
1529
<a class="indexterm" name="id2594748"></a>
1530
<a class="indexterm" name="id2594755"></a>
1531
Note that the LDAPS protocol is deprecated in favor of the LDAPv3 StartTLS
1532
extended operation. However, the OpenLDAP library still provides support for
1533
the older method of securing communication between clients and servers.
1535
<a class="indexterm" name="id2594769"></a>
1536
<a class="indexterm" name="id2594776"></a>
1537
<a class="indexterm" name="id2594783"></a>
1538
The second security precaution is to prevent non-administrative users from
1539
harvesting password hashes from the directory. This can be done using the
1540
following ACL in <code class="filename">slapd.conf</code>:
1542
</p><pre class="programlisting">
1543
## allow the "ldap admin dn" access, but deny everyone else
1544
access to attrs=SambaLMPassword,SambaNTPassword
1545
by dn="cn=Samba Admin,ou=People,dc=quenya,dc=org" write
1548
</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2594813"></a>LDAP Special Attributes for sambaSamAccounts</h4></div></div></div><p> The sambaSamAccount ObjectClass is composed of the attributes shown in next tables: <a class="link" href="passdb.html#attribobjclPartA" title="Table�11.3.�Attributes in the sambaSamAccount ObjectClass (LDAP), Part A">Part A</a>, and <a class="link" href="passdb.html#attribobjclPartB" title="Table�11.4.�Attributes in the sambaSamAccount ObjectClass (LDAP), Part B">Part B</a>.
1549
</p><div class="table"><a name="attribobjclPartA"></a><p class="title"><b>Table�11.3.�Attributes in the sambaSamAccount ObjectClass (LDAP), Part A</b></p><div class="table-contents"><table summary="Attributes in the sambaSamAccount ObjectClass (LDAP), Part A" border="1"><colgroup><col align="left"><col align="justify"></colgroup><tbody><tr><td align="left"><code class="constant">sambaLMPassword</code></td><td align="justify">The LanMan password 16-byte hash stored as a character
1550
representation of a hexadecimal string.</td></tr><tr><td align="left"><code class="constant">sambaNTPassword</code></td><td align="justify">The NT password 16-byte hash stored as a character
1551
representation of a hexadecimal string.</td></tr><tr><td align="left"><code class="constant">sambaPwdLastSet</code></td><td align="justify">The integer time in seconds since 1970 when the
1552
<code class="constant">sambaLMPassword</code> and <code class="constant">sambaNTPassword</code> attributes were last set.
1553
</td></tr><tr><td align="left"><code class="constant">sambaAcctFlags</code></td><td align="justify">String of 11 characters surrounded by square brackets [ ]
1554
representing account flags such as U (user), W (workstation), X (no password expiration),
1555
I (domain trust account), H (home dir required), S (server trust account),
1556
and D (disabled).</td></tr><tr><td align="left"><code class="constant">sambaLogonTime</code></td><td align="justify">Integer value currently unused.</td></tr><tr><td align="left"><code class="constant">sambaLogoffTime</code></td><td align="justify">Integer value currently unused.</td></tr><tr><td align="left"><code class="constant">sambaKickoffTime</code></td><td align="justify">Specifies the time (UNIX time format) when the user
1557
will be locked down and cannot login any longer. If this attribute is omitted, then the account will never expire.
1558
Using this attribute together with shadowExpire of the shadowAccount ObjectClass will enable accounts to
1559
expire completely on an exact date.</td></tr><tr><td align="left"><code class="constant">sambaPwdCanChange</code></td><td align="justify">Specifies the time (UNIX time format)
1560
after which the user is allowed to change his password. If this attribute is not set, the user will be free
1561
to change his password whenever he wants.</td></tr><tr><td align="left"><code class="constant">sambaPwdMustChange</code></td><td align="justify">Specifies the time (UNIX time format) when the user is
1562
forced to change his password. If this value is set to 0, the user will have to change his password at first login.
1563
If this attribute is not set, then the password will never expire.</td></tr><tr><td align="left"><code class="constant">sambaHomeDrive</code></td><td align="justify">Specifies the drive letter to which to map the
1564
UNC path specified by sambaHomePath. The drive letter must be specified in the form “<span class="quote">X:</span>”
1565
where X is the letter of the drive to map. Refer to the “<span class="quote">logon drive</span>” parameter in the
1566
smb.conf(5) man page for more information.</td></tr><tr><td align="left"><code class="constant">sambaLogonScript</code></td><td align="justify">The sambaLogonScript property specifies the path of
1567
the user's logon script, .CMD, .EXE, or .BAT file. The string can be null. The path
1568
is relative to the netlogon share. Refer to the <a class="link" href="smb.conf.5.html#LOGONSCRIPT" target="_top">logon script</a> parameter in the
1569
<code class="filename">smb.conf</code> man page for more information.</td></tr><tr><td align="left"><code class="constant">sambaProfilePath</code></td><td align="justify">Specifies a path to the user's profile.
1570
This value can be a null string, a local absolute path, or a UNC path. Refer to the
1571
<a class="link" href="smb.conf.5.html#LOGONPATH" target="_top">logon path</a> parameter in the <code class="filename">smb.conf</code> man page for more information.</td></tr><tr><td align="left"><code class="constant">sambaHomePath</code></td><td align="justify">The sambaHomePath property specifies the path of
1572
the home directory for the user. The string can be null. If sambaHomeDrive is set and specifies
1573
a drive letter, sambaHomePath should be a UNC path. The path must be a network
1574
UNC path of the form <code class="filename">\\server\share\directory</code>. This value can be a null string.
1575
Refer to the <code class="literal">logon home</code> parameter in the <code class="filename">smb.conf</code> man page for more information.
1576
</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="attribobjclPartB"></a><p class="title"><b>Table�11.4.�Attributes in the sambaSamAccount ObjectClass (LDAP), Part B</b></p><div class="table-contents"><table summary="Attributes in the sambaSamAccount ObjectClass (LDAP), Part B" border="1"><colgroup><col align="left"><col align="justify"></colgroup><tbody><tr><td align="left"><code class="constant">sambaUserWorkstations</code></td><td align="justify">Here you can give a comma-separated list of machines
1577
on which the user is allowed to login. You may observe problems when you try to connect to a Samba domain member.
1578
Because domain members are not in this list, the domain controllers will reject them. Where this attribute is omitted,
1579
the default implies no restrictions.
1580
</td></tr><tr><td align="left"><code class="constant">sambaSID</code></td><td align="justify">The security identifier(SID) of the user.
1581
The Windows equivalent of UNIX UIDs.</td></tr><tr><td align="left"><code class="constant">sambaPrimaryGroupSID</code></td><td align="justify">The security identifier (SID) of the primary group
1582
of the user.</td></tr><tr><td align="left"><code class="constant">sambaDomainName</code></td><td align="justify">Domain the user is part of.</td></tr></tbody></table></div></div><br class="table-break"><p>
1583
<a class="indexterm" name="id2595161"></a>
1584
<a class="indexterm" name="id2595168"></a>
1585
The majority of these parameters are only used when Samba is acting as a PDC of
1586
a domain (refer to <a class="link" href="samba-pdc.html" title="Chapter�4.�Domain Control">Domain Control</a>, for details on
1587
how to configure Samba as a PDC). The following four attributes
1588
are only stored with the sambaSamAccount entry if the values are non-default values:
1589
</p><div class="itemizedlist"><a class="indexterm" name="id2595190"></a><a class="indexterm" name="id2595197"></a><a class="indexterm" name="id2595204"></a><a class="indexterm" name="id2595211"></a><ul type="disc"><li><p>sambaHomePath</p></li><li><p>sambaLogonScript</p></li><li><p>sambaProfilePath</p></li><li><p>sambaHomeDrive</p></li></ul></div><p>
1590
<a class="indexterm" name="id2595239"></a>
1591
<a class="indexterm" name="id2595246"></a>
1592
<a class="indexterm" name="id2595253"></a>
1593
These attributes are only stored with the sambaSamAccount entry if
1594
the values are non-default values. For example, assume MORIA has now been
1595
configured as a PDC and that <a class="link" href="smb.conf.5.html#LOGONHOME" target="_top">logon home = \\%L\%u</a> was defined in
1596
its <code class="filename">smb.conf</code> file. When a user named “<span class="quote">becky</span>” logs on to the domain,
1597
the <a class="link" href="smb.conf.5.html#LOGONHOME" target="_top">logon home</a> string is expanded to \\MORIA\becky.
1598
If the smbHome attribute exists in the entry “<span class="quote">uid=becky,ou=People,dc=samba,dc=org</span>”,
1599
this value is used. However, if this attribute does not exist, then the value
1600
of the <a class="link" href="smb.conf.5.html#LOGONHOME" target="_top">logon home</a> parameter is used in its place. Samba
1601
will only write the attribute value to the directory entry if the value is
1602
something other than the default (e.g., <code class="filename">\\MOBY\becky</code>).
1603
</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2595327"></a>Example LDIF Entries for a sambaSamAccount</h4></div></div></div><p>
1604
The following is a working LDIF that demonstrates the use of the SambaSamAccount ObjectClass:
1605
</p><pre class="programlisting">
1606
dn: uid=guest2, ou=People,dc=quenya,dc=org
1607
sambaLMPassword: 878D8014606CDA29677A44EFA1353FC7
1608
sambaPwdMustChange: 2147483647
1609
sambaPrimaryGroupSID: S-1-5-21-2447931902-1787058256-3961074038-513
1610
sambaNTPassword: 552902031BEDE9EFAAD3B435B51404EE
1611
sambaPwdLastSet: 1010179124
1613
objectClass: sambaSamAccount
1615
sambaKickoffTime: 2147483647
1616
sambaAcctFlags: [UX ]
1617
sambaLogoffTime: 2147483647
1618
sambaSID: S-1-5-21-2447931902-1787058256-3961074038-5006
1619
sambaPwdCanChange: 0
1622
The following is an LDIF entry for using both the sambaSamAccount and
1623
posixAccount ObjectClasses:
1624
</p><pre class="programlisting">
1625
dn: uid=gcarter, ou=People,dc=quenya,dc=org
1627
displayName: Gerald Carter
1628
sambaLMPassword: 552902031BEDE9EFAAD3B435B51404EE
1629
sambaPrimaryGroupSID: S-1-5-21-2447931902-1787058256-3961074038-1201
1630
objectClass: posixAccount
1631
objectClass: sambaSamAccount
1632
sambaAcctFlags: [UX ]
1633
userPassword: {crypt}BpM2ej8Rkzogo
1637
loginShell: /bin/bash
1638
logoffTime: 2147483647
1640
sambaKickoffTime: 2147483647
1641
sambaPwdLastSet: 1010179230
1642
sambaSID: S-1-5-21-2447931902-1787058256-3961074038-5004
1643
homeDirectory: /home/moria/gcarter
1644
sambaPwdCanChange: 0
1645
sambaPwdMustChange: 2147483647
1646
sambaNTPassword: 878D8014606CDA29677A44EFA1353FC7
1648
</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2595374"></a>Password Synchronization</h4></div></div></div><p>
1649
Samba-3 and later can update the non-Samba (LDAP) password stored with an account. When
1650
using pam_ldap, this allows changing both UNIX and Windows passwords at once.
1651
</p><p>The <a class="link" href="smb.conf.5.html#LDAPPASSWDSYNC" target="_top">ldap passwd sync</a> options can have the values shown in
1652
<a class="link" href="passdb.html#ldappwsync" title="Table�11.5.�Possible ldap passwd sync Values">Possible <span class="emphasis"><em>ldap passwd sync</em></span> Values</a>.</p><div class="table"><a name="ldappwsync"></a><p class="title"><b>Table�11.5.�Possible <em class="parameter"><code>ldap passwd sync</code></em> Values</b></p><div class="table-contents"><table summary="Possible ldap passwd sync Values" border="1"><colgroup><col align="left"><col align="justify"></colgroup><thead><tr><th align="left">Value</th><th align="center">Description</th></tr></thead><tbody><tr><td align="left">yes</td><td align="justify"><p>When the user changes his password, update
1653
<code class="constant">SambaNTPassword</code>, <code class="constant">SambaLMPassword</code>,
1654
and the <code class="constant">password</code> fields.</p></td></tr><tr><td align="left">no</td><td align="justify"><p>Only update <code class="constant">SambaNTPassword</code> and
1655
<code class="constant">SambaLMPassword</code>.</p></td></tr><tr><td align="left">only</td><td align="justify"><p>Only update the LDAP password and let the LDAP server
1656
worry about the other fields. This option is only available on some LDAP servers and
1657
only when the LDAP server supports LDAP_EXOP_X_MODIFY_PASSWD.</p></td></tr></tbody></table></div></div><br class="table-break"><p>More information can be found in the <code class="filename">smb.conf</code> man page.</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2595526"></a>Using OpenLDAP Overlay for Password Synchronization</h4></div></div></div><p>
1658
Howard Chu has written a special overlay called <code class="literal">smbk5pwd</code>. This tool modifies the
1659
<code class="literal">SambaNTPassword</code>, <code class="literal">SambaLMPassword</code> and <code class="literal">Heimdal</code>
1660
hashes in an OpenLDAP entry when an LDAP_EXOP_X_MODIFY_PASSWD operation is performed.
1662
The overlay is shipped with OpenLDAP-2.3 and can be found in the
1663
<code class="filename">contrib/slapd-modules/smbk5pwd</code> subdirectory. This module can also be used with
1665
</p></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2595578"></a>Common Errors</h2></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2595583"></a>Users Cannot Logon</h3></div></div></div><p>“<span class="quote">I've installed Samba, but now I can't log on with my UNIX account! </span>”</p><p>Make sure your user has been added to the current Samba <a class="link" href="smb.conf.5.html#PASSDBBACKEND" target="_top">passdb backend</a>.
1666
Read the <a class="link" href="passdb.html#acctmgmttools" title="Account Management Tools">Account Management Tools,</a> for details.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2595621"></a>Configuration of <em class="parameter"><code>auth methods</code></em></h3></div></div></div><p>
1667
When explicitly setting an <a class="link" href="smb.conf.5.html#AUTHMETHODS" target="_top">auth methods</a> parameter,
1668
<em class="parameter"><code>guest</code></em> must be specified as the first entry on the line
1669
for example, <a class="link" href="smb.conf.5.html#AUTHMETHODS" target="_top">auth methods = guest sam</a>.
1670
</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="NetworkBrowsing.html">Prev</a>�</td><td width="20%" align="center"><a accesskey="u" href="optional.html">Up</a></td><td width="40%" align="right">�<a accesskey="n" href="groupmapping.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter�10.�Network Browsing�</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">�Chapter�12.�Group Mapping: MS Windows and UNIX</td></tr></table></div></body></html>