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