trying to get HEAD building again. If you want the code
[Samba.git] / docs / htmldocs / winbind.html
blob567e882367f92c7317a7a684104f2109840adeae
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 21. Integrated Logon Support using Winbind</title><link rel="stylesheet" href="samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.60.1"><link rel="home" href="index.html" title="SAMBA Project Documentation"><link rel="up" href="optional.html" title="Part III. Advanced Configuration"><link rel="previous" href="VFS.html" title="Chapter 20. Stackable VFS modules"><link rel="next" href="AdvancedNetworkManagement.html" title="Chapter 22. Advanced Network Management"></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 21. Integrated Logon Support using Winbind</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="VFS.html">Prev</a> </td><th width="60%" align="center">Part III. Advanced Configuration</th><td width="20%" align="right"> <a accesskey="n" href="AdvancedNetworkManagement.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="winbind"></a>Chapter 21. Integrated Logon Support using Winbind</h2></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">Tim</span> <span class="surname">Potter</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt class="email">&lt;<a href="mailto:tpot@linuxcare.com.au">tpot@linuxcare.com.au</a>&gt;</tt></p></div></div></div><div class="author"><h3 class="author"><span class="firstname">Andrew</span> <span class="surname">Tridgell</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt class="email">&lt;<a href="mailto:tridge@samba.org">tridge@samba.org</a>&gt;</tt></p></div></div></div><div class="author"><h3 class="author"><span class="firstname">Naag</span> <span class="surname">Mummaneni</span></h3><div class="affiliation"><div class="address"><p><tt class="email">&lt;<a href="mailto:getnag@rediffmail.com">getnag@rediffmail.com</a>&gt;</tt></p></div></div></div><div class="author"><h3 class="author"><span class="firstname">Jelmer</span> <span class="othername">R.</span> <span class="surname">Vernooij</span></h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt class="email">&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div><div class="author"><h3 class="author"><span class="firstname">John</span> <span class="othername">H.</span> <span class="surname">Terpstra</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt class="email">&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div></div><div><p class="pubdate">27 June 2002</p></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="winbind.html#id2979695">Features and Benefits</a></dt><dt><a href="winbind.html#id2979724">Introduction</a></dt><dt><a href="winbind.html#id2979795">What Winbind Provides</a></dt><dd><dl><dt><a href="winbind.html#id2979856">Target Uses</a></dt></dl></dd><dt><a href="winbind.html#id2979886">How Winbind Works</a></dt><dd><dl><dt><a href="winbind.html#id2979914">Microsoft Remote Procedure Calls</a></dt><dt><a href="winbind.html#id2979949">Microsoft Active Directory Services</a></dt><dt><a href="winbind.html#id2979971">Name Service Switch</a></dt><dt><a href="winbind.html#id2980108">Pluggable Authentication Modules</a></dt><dt><a href="winbind.html#id2980179">User and Group ID Allocation</a></dt><dt><a href="winbind.html#id2980214">Result Caching</a></dt></dl></dd><dt><a href="winbind.html#id2980242">Installation and Configuration</a></dt><dd><dl><dt><a href="winbind.html#id2980271">Introduction</a></dt><dt><a href="winbind.html#id2980346">Requirements</a></dt><dt><a href="winbind.html#id2980438">Testing Things Out</a></dt></dl></dd><dt><a href="winbind.html#id2982058">Conclusion</a></dt><dt><a href="winbind.html#id2982077">Common Errors</a></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2979695"></a>Features and Benefits</h2></div></div><div></div></div><p>Integration of UNIX and Microsoft Windows NT through
2 a unified logon has been considered a &quot;holy grail&quot; in heterogeneous
3 computing environments for a long time. We present
4 <span class="emphasis"><em>winbind</em></span>, a component of the Samba suite
5 of programs as a solution to the unified logon problem. Winbind
6 uses a UNIX implementation
7 of Microsoft RPC calls, Pluggable Authentication Modules, and the Name
8 Service Switch to allow Windows NT domain users to appear and operate
9 as UNIX users on a UNIX machine. This paper describes the winbind
10 system, explaining the functionality it provides, how it is configured,
11 and how it works internally.</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2979724"></a>Introduction</h2></div></div><div></div></div><p>It is well known that UNIX and Microsoft Windows NT have
12 different models for representing user and group information and
13 use different technologies for implementing them. This fact has
14 made it difficult to integrate the two systems in a satisfactory
15 manner.</p><p>One common solution in use today has been to create
16 identically named user accounts on both the UNIX and Windows systems
17 and use the Samba suite of programs to provide file and print services
18 between the two. This solution is far from perfect however, as
19 adding and deleting users on both sets of machines becomes a chore
20 and two sets of passwords are required both of which
21 can lead to synchronization problems between the UNIX and Windows
22 systems and confusion for users.</p><p>We divide the unified logon problem for UNIX machines into
23 three smaller problems:</p><div class="itemizedlist"><ul type="disc"><li><p>Obtaining Windows NT user and group information
24 </p></li><li><p>Authenticating Windows NT users
25 </p></li><li><p>Password changing for Windows NT users
26 </p></li></ul></div><p>Ideally, a prospective solution to the unified logon problem
27 would satisfy all the above components without duplication of
28 information on the UNIX machines and without creating additional
29 tasks for the system administrator when maintaining users and
30 groups on either system. The winbind system provides a simple
31 and elegant solution to all three components of the unified logon
32 problem.</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2979795"></a>What Winbind Provides</h2></div></div><div></div></div><p>Winbind unifies UNIX and Windows NT account management by
33 allowing a UNIX box to become a full member of a NT domain. Once
34 this is done the UNIX box will see NT users and groups as if
35 they were native UNIX users and groups, allowing the NT domain
36 to be used in much the same manner that NIS+ is used within
37 UNIX-only environments.</p><p>The end result is that whenever any
38 program on the UNIX machine asks the operating system to lookup
39 a user or group name, the query will be resolved by asking the
40 NT domain controller for the specified domain to do the lookup.
41 Because Winbind hooks into the operating system at a low level
42 (via the NSS name resolution modules in the C library) this
43 redirection to the NT domain controller is completely
44 transparent.</p><p>Users on the UNIX machine can then use NT user and group
45 names as they would use &quot;native&quot; UNIX names. They can chown files
46 so that they are owned by NT domain users or even login to the
47 UNIX machine and run a UNIX X-Window session as a domain user.</p><p>The only obvious indication that Winbind is being used is
48 that user and group names take the form DOMAIN\user and
49 DOMAIN\group. This is necessary as it allows Winbind to determine
50 that redirection to a domain controller is wanted for a particular
51 lookup and which trusted domain is being referenced.</p><p>Additionally, Winbind provides an authentication service
52 that hooks into the Pluggable Authentication Modules (PAM) system
53 to provide authentication via a NT domain to any PAM enabled
54 applications. This capability solves the problem of synchronizing
55 passwords between systems since all passwords are stored in a single
56 location (on the domain controller).</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2979856"></a>Target Uses</h3></div></div><div></div></div><p>Winbind is targeted at organizations that have an
57 existing NT based domain infrastructure into which they wish
58 to put UNIX workstations or servers. Winbind will allow these
59 organizations to deploy UNIX workstations without having to
60 maintain a separate account infrastructure. This greatly
61 simplifies the administrative overhead of deploying UNIX
62 workstations into a NT based organization.</p><p>Another interesting way in which we expect Winbind to
63 be used is as a central part of UNIX based appliances. Appliances
64 that provide file and print services to Microsoft based networks
65 will be able to use Winbind to provide seamless integration of
66 the appliance into the domain.</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2979886"></a>How Winbind Works</h2></div></div><div></div></div><p>The winbind system is designed around a client/server
67 architecture. A long running <b class="command">winbindd</b> daemon
68 listens on a UNIX domain socket waiting for requests
69 to arrive. These requests are generated by the NSS and PAM
70 clients and processed sequentially.</p><p>The technologies used to implement winbind are described
71 in detail below.</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2979914"></a>Microsoft Remote Procedure Calls</h3></div></div><div></div></div><p>Over the last few years, efforts have been underway
72 by various Samba Team members to decode various aspects of
73 the Microsoft Remote Procedure Call (MSRPC) system. This
74 system is used for most network related operations between
75 Windows NT machines including remote management, user authentication
76 and print spooling. Although initially this work was done
77 to aid the implementation of Primary Domain Controller (PDC)
78 functionality in Samba, it has also yielded a body of code which
79 can be used for other purposes.</p><p>Winbind uses various MSRPC calls to enumerate domain users
80 and groups and to obtain detailed information about individual
81 users or groups. Other MSRPC calls can be used to authenticate
82 NT domain users and to change user passwords. By directly querying
83 a Windows PDC for user and group information, winbind maps the
84 NT account information onto UNIX user and group names.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2979949"></a>Microsoft Active Directory Services</h3></div></div><div></div></div><p>
85 Since late 2001, Samba has gained the ability to
86 interact with Microsoft Windows 2000 using its 'Native
87 Mode' protocols, rather than the NT4 RPC services.
88 Using LDAP and Kerberos, a domain member running
89 winbind can enumerate users and groups in exactly the
90 same way as a Win2k client would, and in so doing
91 provide a much more efficient and
92 effective winbind implementation.
93 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2979971"></a>Name Service Switch</h3></div></div><div></div></div><p>The Name Service Switch, or NSS, is a feature that is
94 present in many UNIX operating systems. It allows system
95 information such as hostnames, mail aliases and user information
96 to be resolved from different sources. For example, a standalone
97 UNIX workstation may resolve system information from a series of
98 flat files stored on the local filesystem. A networked workstation
99 may first attempt to resolve system information from local files,
100 and then consult a NIS database for user information or a DNS server
101 for hostname information.</p><p>The NSS application programming interface allows winbind
102 to present itself as a source of system information when
103 resolving UNIX usernames and groups. Winbind uses this interface,
104 and information obtained from a Windows NT server using MSRPC
105 calls to provide a new source of account enumeration. Using standard
106 UNIX library calls, one can enumerate the users and groups on
107 a UNIX machine running winbind and see all users and groups in
108 a NT domain plus any trusted domain as though they were local
109 users and groups.</p><p>The primary control file for NSS is
110 <tt class="filename">/etc/nsswitch.conf</tt>.
111 When a UNIX application makes a request to do a lookup
112 the C library looks in <tt class="filename">/etc/nsswitch.conf</tt>
113 for a line which matches the service type being requested, for
114 example the &quot;passwd&quot; service type is used when user or group names
115 are looked up. This config line species which implementations
116 of that service should be tried and in what order. If the passwd
117 config line is:</p><pre class="programlisting">
118 passwd: files example
119 </pre><p>then the C library will first load a module called
120 <tt class="filename">/lib/libnss_files.so</tt> followed by
121 the module <tt class="filename">/lib/libnss_example.so</tt>. The
122 C library will dynamically load each of these modules in turn
123 and call resolver functions within the modules to try to resolve
124 the request. Once the request is resolved the C library returns the
125 result to the application.</p><p>This NSS interface provides a very easy way for Winbind
126 to hook into the operating system. All that needs to be done
127 is to put <tt class="filename">libnss_winbind.so</tt> in <tt class="filename">/lib/</tt>
128 then add &quot;winbind&quot; into <tt class="filename">/etc/nsswitch.conf</tt> at
129 the appropriate place. The C library will then call Winbind to
130 resolve user and group names.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2980108"></a>Pluggable Authentication Modules</h3></div></div><div></div></div><p>Pluggable Authentication Modules, also known as PAM,
131 is a system for abstracting authentication and authorization
132 technologies. With a PAM module it is possible to specify different
133 authentication methods for different system applications without
134 having to recompile these applications. PAM is also useful
135 for implementing a particular policy for authorization. For example,
136 a system administrator may only allow console logins from users
137 stored in the local password file but only allow users resolved from
138 a NIS database to log in over the network.</p><p>Winbind uses the authentication management and password
139 management PAM interface to integrate Windows NT users into a
140 UNIX system. This allows Windows NT users to log in to a UNIX
141 machine and be authenticated against a suitable Primary Domain
142 Controller. These users can also change their passwords and have
143 this change take effect directly on the Primary Domain Controller.
144 </p><p>PAM is configured by providing control files in the directory
145 <tt class="filename">/etc/pam.d/</tt> for each of the services that
146 require authentication. When an authentication request is made
147 by an application the PAM code in the C library looks up this
148 control file to determine what modules to load to do the
149 authentication check and in what order. This interface makes adding
150 a new authentication service for Winbind very easy, all that needs
151 to be done is that the <tt class="filename">pam_winbind.so</tt> module
152 is copied to <tt class="filename">/lib/security/</tt> and the PAM
153 control files for relevant services are updated to allow
154 authentication via winbind. See the PAM documentation
155 for more details.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2980179"></a>User and Group ID Allocation</h3></div></div><div></div></div><p>When a user or group is created under Windows NT
156 is it allocated a numerical relative identifier (RID). This is
157 slightly different to UNIX which has a range of numbers that are
158 used to identify users, and the same range in which to identify
159 groups. It is winbind's job to convert RIDs to UNIX id numbers and
160 vice versa. When winbind is configured it is given part of the UNIX
161 user id space and a part of the UNIX group id space in which to
162 store Windows NT users and groups. If a Windows NT user is
163 resolved for the first time, it is allocated the next UNIX id from
164 the range. The same process applies for Windows NT groups. Over
165 time, winbind will have mapped all Windows NT users and groups
166 to UNIX user ids and group ids.</p><p>The results of this mapping are stored persistently in
167 an ID mapping database held in a tdb database). This ensures that
168 RIDs are mapped to UNIX IDs in a consistent way.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2980214"></a>Result Caching</h3></div></div><div></div></div><p>An active system can generate a lot of user and group
169 name lookups. To reduce the network cost of these lookups winbind
170 uses a caching scheme based on the SAM sequence number supplied
171 by NT domain controllers. User or group information returned
172 by a PDC is cached by winbind along with a sequence number also
173 returned by the PDC. This sequence number is incremented by
174 Windows NT whenever any user or group information is modified. If
175 a cached entry has expired, the sequence number is requested from
176 the PDC and compared against the sequence number of the cached entry.
177 If the sequence numbers do not match, then the cached information
178 is discarded and up to date information is requested directly
179 from the PDC.</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2980242"></a>Installation and Configuration</h2></div></div><div></div></div><p>
180 Many thanks to John Trostel <a href="mailto:jtrostel@snapserver.com" target="_top">jtrostel@snapserver.com</a>
181 for providing the HOWTO for this section.
182 </p><p>
183 This HOWTO describes how to get winbind services up and running
184 to control access and authenticate users on your Linux box using
185 the winbind services which come with SAMBA 3.0.
186 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2980271"></a>Introduction</h3></div></div><div></div></div><p>
187 This section describes the procedures used to get winbind up and
188 running on a RedHat 7.1 system. Winbind is capable of providing access
189 and authentication control for Windows Domain users through an NT
190 or Win2K PDC for 'regular' services, such as telnet a nd ftp, as
191 well for SAMBA services.
192 </p><p>
193 This HOWTO has been written from a 'RedHat-centric' perspective, so if
194 you are using another distribution, you may have to modify the instructions
195 somewhat to fit the way your distribution works.
196 </p><div class="itemizedlist"><ul type="disc"><li><p>
197 <span class="emphasis"><em>Why should I to this?</em></span>
198 </p><p>This allows the SAMBA administrator to rely on the
199 authentication mechanisms on the NT/Win2K PDC for the authentication
200 of domain members. NT/Win2K users no longer need to have separate
201 accounts on the SAMBA server.
202 </p></li><li><p>
203 <span class="emphasis"><em>Who should be reading this document?</em></span>
204 </p><p>
205 This HOWTO is designed for system administrators. If you are
206 implementing SAMBA on a file server and wish to (fairly easily)
207 integrate existing NT/Win2K users from your PDC onto the
208 SAMBA server, this HOWTO is for you. That said, I am no NT or PAM
209 expert, so you may find a better or easier way to accomplish
210 these tasks.
211 </p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2980346"></a>Requirements</h3></div></div><div></div></div><p>
212 If you have a Samba configuration file that you are currently
213 using... <span class="emphasis"><em>BACK IT UP!</em></span> If your system already uses PAM,
214 <span class="emphasis"><em>back up the <tt class="filename">/etc/pam.d</tt> directory
215 contents!</em></span> If you haven't already made a boot disk,
216 <span class="emphasis"><em>MAKE ONE NOW!</em></span>
217 </p><p>
218 Messing with the PAM configuration files can make it nearly impossible
219 to log in to your machine. That's why you want to be able to boot back
220 into your machine in single user mode and restore your
221 <tt class="filename">/etc/pam.d</tt> back to the original state they were in if
222 you get frustrated with the way things are going. ;-)
223 </p><p>
224 The latest version of SAMBA (version 3.0 as of this writing), now
225 includes a functioning winbindd daemon. Please refer to the
226 <a href="http://samba.org/" target="_top">main SAMBA web page</a> or,
227 better yet, your closest SAMBA mirror site for instructions on
228 downloading the source code.
229 </p><p>
230 To allow Domain users the ability to access SAMBA shares and
231 files, as well as potentially other services provided by your
232 SAMBA machine, PAM (pluggable authentication modules) must
233 be setup properly on your machine. In order to compile the
234 winbind modules, you should have at least the pam libraries resident
235 on your system. For recent RedHat systems (7.1, for instance), that
236 means <tt class="filename">pam-0.74-22</tt>. For best results, it is helpful to also
237 install the development packages in <tt class="filename">pam-devel-0.74-22</tt>.
238 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2980438"></a>Testing Things Out</h3></div></div><div></div></div><p>
239 Before starting, it is probably best to kill off all the SAMBA
240 related daemons running on your server. Kill off all <span class="application">smbd</span>,
241 <span class="application">nmbd</span>, and <span class="application">winbindd</span> processes that may
242 be running. To use PAM, you will want to make sure that you have the
243 standard PAM package (for RedHat) which supplies the <tt class="filename">/etc/pam.d</tt>
244 directory structure, including the pam modules are used by pam-aware
245 services, several pam libraries, and the <tt class="filename">/usr/doc</tt>
246 and <tt class="filename">/usr/man</tt> entries for pam. Winbind built better
247 in SAMBA if the pam-devel package was also installed. This package includes
248 the header files needed to compile pam-aware applications.
249 </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2980500"></a>Configure and compile SAMBA</h4></div></div><div></div></div><p>
250 The configuration and compilation of SAMBA is pretty straightforward.
251 The first three steps may not be necessary depending upon
252 whether or not you have previously built the Samba binaries.
253 </p><pre class="screen">
254 <tt class="prompt">root# </tt><b class="command">autoconf</b>
255 <tt class="prompt">root# </tt><b class="command">make clean</b>
256 <tt class="prompt">root# </tt><b class="command">rm config.cache</b>
257 <tt class="prompt">root# </tt><b class="command">./configure</b>
258 <tt class="prompt">root# </tt><b class="command">make</b>
259 <tt class="prompt">root# </tt><b class="command">make install</b>
260 </pre><p>
261 This will, by default, install SAMBA in <tt class="filename">/usr/local/samba</tt>.
262 See the main SAMBA documentation if you want to install SAMBA somewhere else.
263 It will also build the winbindd executable and libraries.
264 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2980613"></a>Configure <tt class="filename">nsswitch.conf</tt> and the
265 winbind libraries on Linux and Solaris</h4></div></div><div></div></div><p>
266 The libraries needed to run the <span class="application">winbindd</span> daemon
267 through nsswitch need to be copied to their proper locations, so
268 </p><p>
269 </p><pre class="screen">
270 <tt class="prompt">root# </tt><b class="userinput"><tt>cp ../samba/source/nsswitch/libnss_winbind.so /lib</tt></b>
271 </pre><p>
272 </p><p>
273 I also found it necessary to make the following symbolic link:
274 </p><p>
275 <tt class="prompt">root# </tt> <b class="userinput"><tt>ln -s /lib/libnss_winbind.so /lib/libnss_winbind.so.2</tt></b>
276 </p><p>And, in the case of Sun Solaris:</p><pre class="screen">
277 <tt class="prompt">root# </tt><b class="userinput"><tt>ln -s /usr/lib/libnss_winbind.so /usr/lib/libnss_winbind.so.1</tt></b>
278 <tt class="prompt">root# </tt><b class="userinput"><tt>ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.1</tt></b>
279 <tt class="prompt">root# </tt><b class="userinput"><tt>ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.2</tt></b>
280 </pre><p>
281 Now, as root you need to edit <tt class="filename">/etc/nsswitch.conf</tt> to
282 allow user and group entries to be visible from the <span class="application">winbindd</span>
283 daemon. My <tt class="filename">/etc/nsswitch.conf</tt> file look like
284 this after editing:
285 </p><pre class="programlisting">
286 passwd: files winbind
287 shadow: files
288 group: files winbind
289 </pre><p>
290 The libraries needed by the winbind daemon will be automatically
291 entered into the <b class="command">ldconfig</b> cache the next time
292 your system reboots, but it
293 is faster (and you don't need to reboot) if you do it manually:
294 </p><p>
295 <tt class="prompt">root# </tt><b class="userinput"><tt>/sbin/ldconfig -v | grep winbind</tt></b>
296 </p><p>
297 This makes <tt class="filename">libnss_winbind</tt> available to winbindd
298 and echos back a check to you.
299 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2980820"></a>NSS Winbind on AIX</h4></div></div><div></div></div><p>(This section is only for those running AIX)</p><p>
300 The winbind AIX identification module gets built as libnss_winbind.so in the
301 nsswitch directory of the samba source. This file can be copied to
302 /usr/lib/security, and the AIX naming convention would indicate that it
303 should be named WINBIND. A stanza like the following:
304 </p><pre class="programlisting">
305 WINBIND:
306 program = /usr/lib/security/WINBIND
307 options = authonly
308 </pre><p>can then be added to
309 <tt class="filename">/usr/lib/security/methods.cfg</tt>. This module only
310 supports identification, but there have been success reports using the
311 standard winbind pam module for authentication. Use caution configuring
312 loadable authentication modules as it is possible to make it impossible
313 to logon to the system. More information about the AIX authentication
314 module API can be found at &quot;Kernel Extensions and Device Support
315 Programming Concepts for AIX&quot;: <a href="http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/kernextc/sec_load_mod.htm" target="_top">
316 Chapter 18. Loadable Authentication Module Programming Interface</a>
317 and more information on administering the modules at <a href="http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixbman/baseadmn/iandaadmin.htm" target="_top">
318 &quot;System Management Guide: Operating System and Devices&quot;</a>.
319 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2980900"></a>Configure smb.conf</h4></div></div><div></div></div><p>
320 Several parameters are needed in the smb.conf file to control
321 the behavior of <span class="application">winbindd</span>. Configure
322 <tt class="filename">smb.conf</tt> These are described in more detail in
323 the <a href="winbindd.8.html"><span class="citerefentry"><span class="refentrytitle">winbindd</span>(8)</span></a> man page. My
324 <tt class="filename">smb.conf</tt> file was modified to
325 include the following entries in the [global] section:
326 </p><pre class="programlisting">
327 [global]
328 &lt;...&gt;
329 # separate domain and username with '+', like DOMAIN+username
330 <a href="winbindd.8.html#WINBINDSEPARATOR" target="_top">winbind separator</a> = +
331 # use uids from 10000 to 20000 for domain users
332 <a href="winbindd.8.html#WINBINDUID" target="_top">idmap uid</a> = 10000-20000
333 # use gids from 10000 to 20000 for domain groups
334 <a href="winbindd.8.html#WINBINDGID" target="_top">idmap gid</a> = 10000-20000
335 # allow enumeration of winbind users and groups
336 <a href="winbindd.8.html#WINBINDENUMUSERS" target="_top">winbind enum users</a> = yes
337 <a href="winbindd.8.html#WINBINDENUMGROUP" target="_top">winbind enum groups</a> = yes
338 # give winbind users a real shell (only needed if they have telnet access)
339 <a href="winbindd.8.html#TEMPLATEHOMEDIR" target="_top">template homedir</a> = /home/winnt/%D/%U
340 <a href="winbindd.8.html#TEMPLATESHELL" target="_top">template shell</a> = /bin/bash
341 </pre></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2981017"></a>Join the SAMBA server to the PDC domain</h4></div></div><div></div></div><p>
342 Enter the following command to make the SAMBA server join the
343 PDC domain, where <i class="replaceable"><tt>DOMAIN</tt></i> is the name of
344 your Windows domain and <i class="replaceable"><tt>Administrator</tt></i> is
345 a domain user who has administrative privileges in the domain.
346 </p><p>
347 <tt class="prompt">root# </tt><b class="userinput"><tt>/usr/local/samba/bin/net join -S PDC -U Administrator</tt></b>
348 </p><p>
349 The proper response to the command should be: &quot;Joined the domain
350 <i class="replaceable"><tt>DOMAIN</tt></i>&quot; where <i class="replaceable"><tt>DOMAIN</tt></i>
351 is your DOMAIN name.
352 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2981071"></a>Start up the winbindd daemon and test it!</h4></div></div><div></div></div><p>
353 Eventually, you will want to modify your smb startup script to
354 automatically invoke the winbindd daemon when the other parts of
355 SAMBA start, but it is possible to test out just the winbind
356 portion first. To start up winbind services, enter the following
357 command as root:
358 </p><p>
359 <tt class="prompt">root# </tt><b class="userinput"><tt>/usr/local/samba/bin/winbindd</tt></b>
360 </p><p>
361 Winbindd can now also run in 'dual daemon mode'. This will make it
362 run as 2 processes. The first will answer all requests from the cache,
363 thus making responses to clients faster. The other will
364 update the cache for the query that the first has just responded.
365 Advantage of this is that responses stay accurate and are faster.
366 You can enable dual daemon mode by adding <tt class="option">-B</tt> to the commandline:
367 </p><p>
368 <tt class="prompt">root# </tt><b class="userinput"><tt>/usr/local/samba/bin/winbindd -B</tt></b>
369 </p><p>
370 I'm always paranoid and like to make sure the daemon
371 is really running...
372 </p><p>
373 <tt class="prompt">root# </tt><b class="userinput"><tt>ps -ae | grep winbindd</tt></b>
374 </p><p>
375 This command should produce output like this, if the daemon is running
376 </p><pre class="screen">
377 3025 ? 00:00:00 winbindd
378 </pre><p>
379 Now... for the real test, try to get some information about the
380 users on your PDC
381 </p><p>
382 <tt class="prompt">root# </tt><b class="userinput"><tt>/usr/local/samba/bin/wbinfo -u</tt></b>
383 </p><p>
384 This should echo back a list of users on your Windows users on
385 your PDC. For example, I get the following response:
386 </p><pre class="screen">
387 CEO+Administrator
388 CEO+burdell
389 CEO+Guest
390 CEO+jt-ad
391 CEO+krbtgt
392 CEO+TsInternetUser
393 </pre><p>
394 Obviously, I have named my domain 'CEO' and my <i class="parameter"><tt>winbind
395 separator</tt></i> is '+'.
396 </p><p>
397 You can do the same sort of thing to get group information from
398 the PDC:
399 </p><pre class="screen">
400 <tt class="prompt">root# </tt><b class="userinput"><tt>/usr/local/samba/bin/wbinfo -g</tt></b>
401 CEO+Domain Admins
402 CEO+Domain Users
403 CEO+Domain Guests
404 CEO+Domain Computers
405 CEO+Domain Controllers
406 CEO+Cert Publishers
407 CEO+Schema Admins
408 CEO+Enterprise Admins
409 CEO+Group Policy Creator Owners
410 </pre><p>
411 The function 'getent' can now be used to get unified
412 lists of both local and PDC users and groups.
413 Try the following command:
414 </p><p>
415 <tt class="prompt">root# </tt><b class="userinput"><tt>getent passwd</tt></b>
416 </p><p>
417 You should get a list that looks like your <tt class="filename">/etc/passwd</tt>
418 list followed by the domain users with their new uids, gids, home
419 directories and default shells.
420 </p><p>
421 The same thing can be done for groups with the command
422 </p><p>
423 <tt class="prompt">root# </tt><b class="userinput"><tt>getent group</tt></b>
424 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2981312"></a>Fix the init.d startup scripts</h4></div></div><div></div></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2981320"></a>Linux</h5></div></div><div></div></div><p>
425 The <span class="application">winbindd</span> daemon needs to start up after the
426 <span class="application">smbd</span> and <span class="application">nmbd</span> daemons are running.
427 To accomplish this task, you need to modify the startup scripts of your system.
428 They are located at <tt class="filename">/etc/init.d/smb</tt> in RedHat and
429 <tt class="filename">/etc/init.d/samba</tt> in Debian.
430 script to add commands to invoke this daemon in the proper sequence. My
431 startup script starts up <span class="application">smbd</span>, <span class="application">nmbd</span>, and <span class="application">winbindd</span> from the
432 <tt class="filename">/usr/local/samba/bin</tt> directory directly. The 'start'
433 function in the script looks like this:
434 </p><pre class="programlisting">
435 start() {
436 KIND=&quot;SMB&quot;
437 echo -n $&quot;Starting $KIND services: &quot;
438 daemon /usr/local/samba/bin/smbd $SMBDOPTIONS
439 RETVAL=$?
440 echo
441 KIND=&quot;NMB&quot;
442 echo -n $&quot;Starting $KIND services: &quot;
443 daemon /usr/local/samba/bin/nmbd $NMBDOPTIONS
444 RETVAL2=$?
445 echo
446 KIND=&quot;Winbind&quot;
447 echo -n $&quot;Starting $KIND services: &quot;
448 daemon /usr/local/samba/bin/winbindd
449 RETVAL3=$?
450 echo
451 [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] &amp;&amp; \
452 touch /var/lock/subsys/smb || RETVAL=1
453 return $RETVAL
455 </pre><p>If you would like to run winbindd in dual daemon mode, replace
456 the line
457 </p><pre class="programlisting">
458 daemon /usr/local/samba/bin/winbindd
459 </pre><p>
461 in the example above with:
463 </p><pre class="programlisting">
464 daemon /usr/local/samba/bin/winbindd -B
465 </pre><p>.
466 </p><p>
467 The 'stop' function has a corresponding entry to shut down the
468 services and looks like this:
469 </p><pre class="programlisting">
470 stop() {
471 KIND=&quot;SMB&quot;
472 echo -n $&quot;Shutting down $KIND services: &quot;
473 killproc smbd
474 RETVAL=$?
475 echo
476 KIND=&quot;NMB&quot;
477 echo -n $&quot;Shutting down $KIND services: &quot;
478 killproc nmbd
479 RETVAL2=$?
480 echo
481 KIND=&quot;Winbind&quot;
482 echo -n $&quot;Shutting down $KIND services: &quot;
483 killproc winbindd
484 RETVAL3=$?
485 [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] &amp;&amp; \
486 rm -f /var/lock/subsys/smb
487 echo &quot;&quot;
488 return $RETVAL
490 </pre></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2981482"></a>Solaris</h5></div></div><div></div></div><p>Winbind doesn't work on Solaris 9, see the <a href="Portability.html#winbind-solaris9" title="Winbind on Solaris 9">Portability</a> chapter for details.</p><p>On Solaris, you need to modify the
491 <tt class="filename">/etc/init.d/samba.server</tt> startup script. It usually
492 only starts smbd and nmbd but should now start winbindd too. If you
493 have samba installed in <tt class="filename">/usr/local/samba/bin</tt>,
494 the file could contains something like this:
495 </p><pre class="programlisting">
497 ## samba.server
500 if [ ! -d /usr/bin ]
501 then # /usr not mounted
502 exit
505 killproc() { # kill the named process(es)
506 pid=`/usr/bin/ps -e |
507 /usr/bin/grep -w $1 |
508 /usr/bin/sed -e 's/^ *//' -e 's/ .*//'`
509 [ &quot;$pid&quot; != &quot;&quot; ] &amp;&amp; kill $pid
512 # Start/stop processes required for samba server
514 case &quot;$1&quot; in
516 'start')
518 # Edit these lines to suit your installation (paths, workgroup, host)
520 echo Starting SMBD
521 /usr/local/samba/bin/smbd -D -s \
522 /usr/local/samba/smb.conf
524 echo Starting NMBD
525 /usr/local/samba/bin/nmbd -D -l \
526 /usr/local/samba/var/log -s /usr/local/samba/smb.conf
528 echo Starting Winbind Daemon
529 /usr/local/samba/bin/winbindd
532 'stop')
533 killproc nmbd
534 killproc smbd
535 killproc winbindd
539 echo &quot;Usage: /etc/init.d/samba.server { start | stop }&quot;
541 esac
542 </pre><p>
543 Again, if you would like to run samba in dual daemon mode, replace
544 </p><pre class="programlisting">
545 /usr/local/samba/bin/winbindd
546 </pre><p>
548 in the script above with:
550 </p><pre class="programlisting">
551 /usr/local/samba/bin/winbindd -B
552 </pre><p>
553 </p></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2981600"></a>Restarting</h5></div></div><div></div></div><p>
554 If you restart the <span class="application">smbd</span>, <span class="application">nmbd</span>, and <span class="application">winbindd</span> daemons at this point, you
555 should be able to connect to the samba server as a domain member just as
556 if you were a local user.
557 </p></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2981637"></a>Configure Winbind and PAM</h4></div></div><div></div></div><p>
558 If you have made it this far, you know that winbindd and samba are working
559 together. If you want to use winbind to provide authentication for other
560 services, keep reading. The pam configuration files need to be altered in
561 this step. (Did you remember to make backups of your original
562 <tt class="filename">/etc/pam.d</tt> files? If not, do it now.)
563 </p><p>
564 You will need a pam module to use winbindd with these other services. This
565 module will be compiled in the <tt class="filename">../source/nsswitch</tt> directory
566 by invoking the command
567 </p><p>
568 <tt class="prompt">root# </tt><b class="userinput"><tt>make nsswitch/pam_winbind.so</tt></b>
569 </p><p>
570 from the <tt class="filename">../source</tt> directory. The
571 <tt class="filename">pam_winbind.so</tt> file should be copied to the location of
572 your other pam security modules. On my RedHat system, this was the
573 <tt class="filename">/lib/security</tt> directory. On Solaris, the pam security
574 modules reside in <tt class="filename">/usr/lib/security</tt>.
575 </p><p>
576 <tt class="prompt">root# </tt><b class="userinput"><tt>cp ../samba/source/nsswitch/pam_winbind.so /lib/security</tt></b>
577 </p><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2981743"></a>Linux/FreeBSD-specific PAM configuration</h5></div></div><div></div></div><p>
578 The <tt class="filename">/etc/pam.d/samba</tt> file does not need to be changed. I
579 just left this file as it was:
580 </p><pre class="programlisting">
581 auth required /lib/security/pam_stack.so service=system-auth
582 account required /lib/security/pam_stack.so service=system-auth
583 </pre><p>
584 The other services that I modified to allow the use of winbind
585 as an authentication service were the normal login on the console (or a terminal
586 session), telnet logins, and ftp service. In order to enable these
587 services, you may first need to change the entries in
588 <tt class="filename">/etc/xinetd.d</tt> (or <tt class="filename">/etc/inetd.conf</tt>).
589 RedHat 7.1 uses the new xinetd.d structure, in this case you need
590 to change the lines in <tt class="filename">/etc/xinetd.d/telnet</tt>
591 and <tt class="filename">/etc/xinetd.d/wu-ftp</tt> from
592 </p><pre class="programlisting">
593 enable = no
594 </pre><p>
596 </p><pre class="programlisting">
597 enable = yes
598 </pre><p>
599 For ftp services to work properly, you will also need to either
600 have individual directories for the domain users already present on
601 the server, or change the home directory template to a general
602 directory for all domain users. These can be easily set using
603 the <tt class="filename">smb.conf</tt> global entry
604 <i class="parameter"><tt>template homedir</tt></i>.
605 </p><p>
606 The <tt class="filename">/etc/pam.d/ftp</tt> file can be changed
607 to allow winbind ftp access in a manner similar to the
608 samba file. My <tt class="filename">/etc/pam.d/ftp</tt> file was
609 changed to look like this:
610 </p><pre class="programlisting">
611 auth required /lib/security/pam_listfile.so item=user sense=deny \
612 file=/etc/ftpusers onerr=succeed
613 auth sufficient /lib/security/pam_winbind.so
614 auth required /lib/security/pam_stack.so service=system-auth
615 auth required /lib/security/pam_shells.so
616 account sufficient /lib/security/pam_winbind.so
617 account required /lib/security/pam_stack.so service=system-auth
618 session required /lib/security/pam_stack.so service=system-auth
619 </pre><p>
620 The <tt class="filename">/etc/pam.d/login</tt> file can be changed nearly the
621 same way. It now looks like this:
622 </p><pre class="programlisting">
623 auth required /lib/security/pam_securetty.so
624 auth sufficient /lib/security/pam_winbind.so
625 auth sufficient /lib/security/pam_unix.so use_first_pass
626 auth required /lib/security/pam_stack.so service=system-auth
627 auth required /lib/security/pam_nologin.so
628 account sufficient /lib/security/pam_winbind.so
629 account required /lib/security/pam_stack.so service=system-auth
630 password required /lib/security/pam_stack.so service=system-auth
631 session required /lib/security/pam_stack.so service=system-auth
632 session optional /lib/security/pam_console.so
633 </pre><p>
634 In this case, I added the </p><pre class="programlisting">auth sufficient /lib/security/pam_winbind.so</pre><p>
635 lines as before, but also added the </p><pre class="programlisting">required pam_securetty.so</pre><p>
636 above it, to disallow root logins over the network. I also added a
637 <b class="command">sufficient /lib/security/pam_unix.so use_first_pass</b>
638 line after the <b class="command">winbind.so</b> line to get rid of annoying
639 double prompts for passwords.
640 </p></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2981966"></a>Solaris-specific configuration</h5></div></div><div></div></div><p>
641 The /etc/pam.conf needs to be changed. I changed this file so that my Domain
642 users can logon both locally as well as telnet.The following are the changes
643 that I made.You can customize the pam.conf file as per your requirements,but
644 be sure of those changes because in the worst case it will leave your system
645 nearly impossible to boot.
646 </p><pre class="programlisting">
648 #ident &quot;@(#)pam.conf 1.14 99/09/16 SMI&quot;
650 # Copyright (c) 1996-1999, Sun Microsystems, Inc.
651 # All Rights Reserved.
653 # PAM configuration
655 # Authentication management
657 login auth required /usr/lib/security/pam_winbind.so
658 login auth required /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
659 login auth required /usr/lib/security/$ISA/pam_dial_auth.so.1 try_first_pass
661 rlogin auth sufficient /usr/lib/security/pam_winbind.so
662 rlogin auth sufficient /usr/lib/security/$ISA/pam_rhosts_auth.so.1
663 rlogin auth required /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
665 dtlogin auth sufficient /usr/lib/security/pam_winbind.so
666 dtlogin auth required /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
668 rsh auth required /usr/lib/security/$ISA/pam_rhosts_auth.so.1
669 other auth sufficient /usr/lib/security/pam_winbind.so
670 other auth required /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
672 # Account management
674 login account sufficient /usr/lib/security/pam_winbind.so
675 login account requisite /usr/lib/security/$ISA/pam_roles.so.1
676 login account required /usr/lib/security/$ISA/pam_unix.so.1
678 dtlogin account sufficient /usr/lib/security/pam_winbind.so
679 dtlogin account requisite /usr/lib/security/$ISA/pam_roles.so.1
680 dtlogin account required /usr/lib/security/$ISA/pam_unix.so.1
682 other account sufficient /usr/lib/security/pam_winbind.so
683 other account requisite /usr/lib/security/$ISA/pam_roles.so.1
684 other account required /usr/lib/security/$ISA/pam_unix.so.1
686 # Session management
688 other session required /usr/lib/security/$ISA/pam_unix.so.1
690 # Password management
692 #other password sufficient /usr/lib/security/pam_winbind.so
693 other password required /usr/lib/security/$ISA/pam_unix.so.1
694 dtsession auth required /usr/lib/security/$ISA/pam_unix.so.1
696 # Support for Kerberos V5 authentication (uncomment to use Kerberos)
698 #rlogin auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
699 #login auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
700 #dtlogin auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
701 #other auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
702 #dtlogin account optional /usr/lib/security/$ISA/pam_krb5.so.1
703 #other account optional /usr/lib/security/$ISA/pam_krb5.so.1
704 #other session optional /usr/lib/security/$ISA/pam_krb5.so.1
705 #other password optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
706 </pre><p>
707 I also added a try_first_pass line after the winbind.so line to get rid of
708 annoying double prompts for passwords.
709 </p><p>
710 Now restart your Samba and try connecting through your application that you
711 configured in the pam.conf.
712 </p></div></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2982058"></a>Conclusion</h2></div></div><div></div></div><p>The winbind system, through the use of the Name Service
713 Switch, Pluggable Authentication Modules, and appropriate
714 Microsoft RPC calls have allowed us to provide seamless
715 integration of Microsoft Windows NT domain users on a
716 UNIX system. The result is a great reduction in the administrative
717 cost of running a mixed UNIX and NT network.</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2982077"></a>Common Errors</h2></div></div><div></div></div><p>Winbind has a number of limitations in its current
718 released version that we hope to overcome in future
719 releases:</p><div class="itemizedlist"><ul type="disc"><li><p>Winbind is currently only available for
720 the Linux, Solaris and IRIX operating systems, although ports to other operating
721 systems are certainly possible. For such ports to be feasible,
722 we require the C library of the target operating system to
723 support the Name Service Switch and Pluggable Authentication
724 Modules systems. This is becoming more common as NSS and
725 PAM gain support among UNIX vendors.</p></li><li><p>The mappings of Windows NT RIDs to UNIX ids
726 is not made algorithmically and depends on the order in which
727 unmapped users or groups are seen by winbind. It may be difficult
728 to recover the mappings of rid to UNIX id mapping if the file
729 containing this information is corrupted or destroyed.</p></li><li><p>Currently the winbind PAM module does not take
730 into account possible workstation and logon time restrictions
731 that may be been set for Windows NT users, this is
732 instead up to the PDC to enforce.</p></li></ul></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="VFS.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="AdvancedNetworkManagement.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 20. Stackable VFS modules </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 22. Advanced Network Management</td></tr></table></div></body></html>