1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 21. Winbind: Use of Domain Accounts</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. Winbind: Use of Domain Accounts</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. Winbind: Use of Domain Accounts</h2></div><div><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"><<a href="mailto:tpot@linuxcare.com.au">tpot@linuxcare.com.au</a>></tt></p></div></div></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"><<a href="mailto:tridge@samba.org">tridge@samba.org</a>></tt></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Naag</span> <span class="surname">Mummaneni</span></h3><span class="contrib">Notes for Solaris</span><div class="affiliation"><div class="address"><p><tt class="email"><<a href="mailto:getnag@rediffmail.com">getnag@rediffmail.com</a>></tt></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">John</span> <span class="surname">Trostel</span></h3><div class="affiliation"><div class="address"><p><tt class="email"><<a href="mailto:jtrostel@snapserver.com">jtrostel@snapserver.com</a>></tt></p></div><span class="orgname">SNAP<br></span></div></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"><<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>></tt></p></div></div></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"><<a href="mailto:jht@samba.org">jht@samba.org</a>></tt></p></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#id2949352">Features and Benefits</a></dt><dt><a href="winbind.html#id2949476">Introduction</a></dt><dt><a href="winbind.html#id2949558">What Winbind Provides</a></dt><dd><dl><dt><a href="winbind.html#id2949633">Target Uses</a></dt></dl></dd><dt><a href="winbind.html#id2949664">How Winbind Works</a></dt><dd><dl><dt><a href="winbind.html#id2949693">Microsoft Remote Procedure Calls</a></dt><dt><a href="winbind.html#id2949726">Microsoft Active Directory Services</a></dt><dt><a href="winbind.html#id2949752">Name Service Switch</a></dt><dt><a href="winbind.html#id2949887">Pluggable Authentication Modules</a></dt><dt><a href="winbind.html#id2949965">User and Group ID Allocation</a></dt><dt><a href="winbind.html#id2949998">Result Caching</a></dt></dl></dd><dt><a href="winbind.html#id2950035">Installation and Configuration</a></dt><dd><dl><dt><a href="winbind.html#id2950042">Introduction</a></dt><dt><a href="winbind.html#id2950108">Requirements</a></dt><dt><a href="winbind.html#id2950191">Testing Things Out</a></dt></dl></dd><dt><a href="winbind.html#id2951948">Conclusion</a></dt><dt><a href="winbind.html#id2951967">Common Errors</a></dt><dd><dl><dt><a href="winbind.html#id2952021">NSCD Problem Warning</a></dt><dt><a href="winbind.html#id2952067">Winbind Is Not Resolving Users and Groups</a></dt></dl></dd></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2949352"></a>Features and Benefits</h2></div></div><div></div></div><p>
2 Integration of UNIX and Microsoft Windows NT through a unified logon has
3 been considered a “<span class="quote">holy grail</span>” in heterogeneous computing environments for
6 There is one other facility without which UNIX and Microsoft Windows network
7 interoperability would suffer greatly. It is imperative that there be a
8 mechanism for sharing files across UNIX systems and to be able to assign
9 domain user and group ownerships with integrity.
11 <span class="emphasis"><em>winbind</em></span> is a component of the Samba suite of programs that
12 solves the unified logon problem. Winbind uses a UNIX implementation of Microsoft
13 RPC calls, Pluggable Authentication Modules, and the Name Service Switch to
14 allow Windows NT domain users to appear and operate as UNIX users on a UNIX
15 machine. This chapter describes the Winbind system, explaining the functionality
16 it provides, how it is configured, and how it works internally.
18 Winbind provides three separate functions:
19 </p><div class="itemizedlist"><ul type="disc"><li><p>
20 Authentication of user credentials (via PAM).
22 Identity resolution (via NSS).
24 Winbind maintains a database called winbind_idmap.tdb in which it stores
25 mappings between UNIX UIDs / GIDs and NT SIDs. This mapping is used only
26 for users and groups that do not have a local UID/GID. It stored the UID/GID
27 allocated from the idmap uid/gid range that it has mapped to the NT SID.
28 If <i class="parameter"><tt>idmap backend</tt></i> has been specified as ldapsam:url
29 then instead of using a local mapping Winbind will obtain this information
30 from the LDAP database.
31 </p></li></ul></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
32 If <b class="command">winbindd</b> is not running, smbd (which calls <b class="command">winbindd</b>) will fall back to
33 using purely local information from <tt class="filename">/etc/passwd</tt> and <tt class="filename">/etc/group</tt> and no dynamic
35 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2949476"></a>Introduction</h2></div></div><div></div></div><p>It is well known that UNIX and Microsoft Windows NT have
36 different models for representing user and group information and
37 use different technologies for implementing them. This fact has
38 made it difficult to integrate the two systems in a satisfactory
39 manner.</p><p>One common solution in use today has been to create
40 identically named user accounts on both the UNIX and Windows systems
41 and use the Samba suite of programs to provide file and print services
42 between the two. This solution is far from perfect, however, as
43 adding and deleting users on both sets of machines becomes a chore
44 and two sets of passwords are required both of which
45 can lead to synchronization problems between the UNIX and Windows
46 systems and confusion for users.</p><p>We divide the unified logon problem for UNIX machines into
47 three smaller problems:</p><div class="itemizedlist"><ul type="disc"><li><p>Obtaining Windows NT user and group information.
48 </p></li><li><p>Authenticating Windows NT users.
49 </p></li><li><p>Password changing for Windows NT users.
50 </p></li></ul></div><p>Ideally, a prospective solution to the unified logon problem
51 would satisfy all the above components without duplication of
52 information on the UNIX machines and without creating additional
53 tasks for the system administrator when maintaining users and
54 groups on either system. The Winbind system provides a simple
55 and elegant solution to all three components of the unified logon
56 problem.</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2949558"></a>What Winbind Provides</h2></div></div><div></div></div><p>Winbind unifies UNIX and Windows NT account management by
57 allowing a UNIX box to become a full member of an NT domain. Once
58 this is done the UNIX box will see NT users and groups as if
59 they were “<span class="quote">native</span>” UNIX users and groups, allowing the NT domain
60 to be used in much the same manner that NIS+ is used within
61 UNIX-only environments.</p><p>The end result is that whenever any
62 program on the UNIX machine asks the operating system to lookup
63 a user or group name, the query will be resolved by asking the
64 NT Domain Controller for the specified domain to do the lookup.
65 Because Winbind hooks into the operating system at a low level
66 (via the NSS name resolution modules in the C library), this
67 redirection to the NT Domain Controller is completely
68 transparent.</p><p>Users on the UNIX machine can then use NT user and group
69 names as they would “<span class="quote">native</span>” UNIX names. They can chown files
70 so they are owned by NT domain users or even login to the
71 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
72 that user and group names take the form <tt class="constant">DOMAIN\user</tt> and
73 <tt class="constant">DOMAIN\group</tt>. This is necessary as it allows Winbind to determine
74 that redirection to a Domain Controller is wanted for a particular
75 lookup and which trusted domain is being referenced.</p><p>Additionally, Winbind provides an authentication service
76 that hooks into the Pluggable Authentication Modules (PAM) system
77 to provide authentication via an NT domain to any PAM-enabled
78 applications. This capability solves the problem of synchronizing
79 passwords between systems since all passwords are stored in a single
80 location (on the Domain Controller).</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2949633"></a>Target Uses</h3></div></div><div></div></div><p>Winbind is targeted at organizations that have an
81 existing NT-based domain infrastructure into which they wish
82 to put UNIX workstations or servers. Winbind will allow these
83 organizations to deploy UNIX workstations without having to
84 maintain a separate account infrastructure. This greatly
85 simplifies the administrative overhead of deploying UNIX
86 workstations into an NT-based organization.</p><p>Another interesting way in which we expect Winbind to
87 be used is as a central part of UNIX-based appliances. Appliances
88 that provide file and print services to Microsoft-based networks
89 will be able to use Winbind to provide seamless integration of
90 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="id2949664"></a>How Winbind Works</h2></div></div><div></div></div><p>The Winbind system is designed around a client/server
91 architecture. A long running <b class="command">winbindd</b> daemon
92 listens on a UNIX domain socket waiting for requests
93 to arrive. These requests are generated by the NSS and PAM
94 clients and is processed sequentially.</p><p>The technologies used to implement Winbind are described
95 in detail below.</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2949693"></a>Microsoft Remote Procedure Calls</h3></div></div><div></div></div><p>Over the last few years, efforts have been underway
96 by various Samba Team members to decode various aspects of
97 the Microsoft Remote Procedure Call (MSRPC) system. This
98 system is used for most network-related operations between
99 Windows NT machines including remote management, user authentication
100 and print spooling. Although initially this work was done
101 to aid the implementation of Primary Domain Controller (PDC)
102 functionality in Samba, it has also yielded a body of code that
103 can be used for other purposes.</p><p>Winbind uses various MSRPC calls to enumerate domain users
104 and groups and to obtain detailed information about individual
105 users or groups. Other MSRPC calls can be used to authenticate
106 NT domain users and to change user passwords. By directly querying
107 a Windows PDC for user and group information, Winbind maps the
108 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="id2949726"></a>Microsoft Active Directory Services</h3></div></div><div></div></div><p>
109 Since late 2001, Samba has gained the ability to
110 interact with Microsoft Windows 2000 using its “<span class="quote">Native
111 Mode</span>” protocols, rather than the NT4 RPC services.
112 Using LDAP and Kerberos, a Domain Member running
113 Winbind can enumerate users and groups in exactly the
114 same way as a Windows 200x client would, and in so doing
115 provide a much more efficient and effective Winbind implementation.
116 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2949752"></a>Name Service Switch</h3></div></div><div></div></div><p>The Name Service Switch, or NSS, is a feature that is
117 present in many UNIX operating systems. It allows system
118 information such as hostnames, mail aliases and user information
119 to be resolved from different sources. For example, a standalone
120 UNIX workstation may resolve system information from a series of
121 flat files stored on the local filesystem. A networked workstation
122 may first attempt to resolve system information from local files,
123 and then consult an NIS database for user information or a DNS server
124 for hostname information.</p><p>The NSS application programming interface allows Winbind
125 to present itself as a source of system information when
126 resolving UNIX usernames and groups. Winbind uses this interface,
127 and information obtained from a Windows NT server using MSRPC
128 calls to provide a new source of account enumeration. Using standard
129 UNIX library calls, one can enumerate the users and groups on
130 a UNIX machine running Winbind and see all users and groups in
131 a NT domain plus any trusted domain as though they were local
132 users and groups.</p><p>The primary control file for NSS is
133 <tt class="filename">/etc/nsswitch.conf</tt>.
134 When a UNIX application makes a request to do a lookup,
135 the C library looks in <tt class="filename">/etc/nsswitch.conf</tt>
136 for a line that matches the service type being requested, for
137 example the “<span class="quote">passwd</span>” service type is used when user or group names
138 are looked up. This config line specifies which implementations
139 of that service should be tried and in what order. If the passwd
140 config line is:</p><pre class="screen">
141 passwd: files example
142 </pre><p>then the C library will first load a module called
143 <tt class="filename">/lib/libnss_files.so</tt> followed by
144 the module <tt class="filename">/lib/libnss_example.so</tt>. The
145 C library will dynamically load each of these modules in turn
146 and call resolver functions within the modules to try to resolve
147 the request. Once the request is resolved, the C library returns the
148 result to the application.</p><p>This NSS interface provides an easy way for Winbind
149 to hook into the operating system. All that needs to be done
150 is to put <tt class="filename">libnss_winbind.so</tt> in <tt class="filename">/lib/</tt>
151 then add “<span class="quote">winbind</span>” into <tt class="filename">/etc/nsswitch.conf</tt> at
152 the appropriate place. The C library will then call Winbind to
153 resolve user and group names.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2949887"></a>Pluggable Authentication Modules</h3></div></div><div></div></div><p>Pluggable Authentication Modules, also known as PAM,
154 is a system for abstracting authentication and authorization
155 technologies. With a PAM module it is possible to specify different
156 authentication methods for different system applications without
157 having to recompile these applications. PAM is also useful
158 for implementing a particular policy for authorization. For example,
159 a system administrator may only allow console logins from users
160 stored in the local password file but only allow users resolved from
161 a NIS database to log in over the network.</p><p>Winbind uses the authentication management and password
162 management PAM interface to integrate Windows NT users into a
163 UNIX system. This allows Windows NT users to log in to a UNIX
164 machine and be authenticated against a suitable Primary Domain
165 Controller. These users can also change their passwords and have
166 this change take effect directly on the Primary Domain Controller.
167 </p><p>PAM is configured by providing control files in the directory
168 <tt class="filename">/etc/pam.d/</tt> for each of the services that
169 require authentication. When an authentication request is made
170 by an application, the PAM code in the C library looks up this
171 control file to determine what modules to load to do the
172 authentication check and in what order. This interface makes adding
173 a new authentication service for Winbind very easy. All that needs
174 to be done is that the <tt class="filename">pam_winbind.so</tt> module
175 is copied to <tt class="filename">/lib/security/</tt> and the PAM
176 control files for relevant services are updated to allow
177 authentication via Winbind. See the PAM documentation
178 in <link linkend="pam"> for more information.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2949965"></a>User and Group ID Allocation</h3></div></div><div></div></div><p>When a user or group is created under Windows NT/200x
179 it is allocated a numerical relative identifier (RID). This is
180 slightly different from UNIX which has a range of numbers that are
181 used to identify users, and the same range in which to identify
182 groups. It is Winbind's job to convert RIDs to UNIX ID numbers and
183 vice versa. When Winbind is configured, it is given part of the UNIX
184 user ID space and a part of the UNIX group ID space in which to
185 store Windows NT users and groups. If a Windows NT user is
186 resolved for the first time, it is allocated the next UNIX ID from
187 the range. The same process applies for Windows NT groups. Over
188 time, Winbind will have mapped all Windows NT users and groups
189 to UNIX user IDs and group IDs.</p><p>The results of this mapping are stored persistently in
190 an ID mapping database held in a tdb database). This ensures that
191 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="id2949998"></a>Result Caching</h3></div></div><div></div></div><p>
192 <a class="indexterm" name="id2950010"></a>
193 An active system can generate a lot of user and group
194 name lookups. To reduce the network cost of these lookups, Winbind
195 uses a caching scheme based on the SAM sequence number supplied
196 by NT Domain Controllers. User or group information returned
197 by a PDC is cached by Winbind along with a sequence number also
198 returned by the PDC. This sequence number is incremented by
199 Windows NT whenever any user or group information is modified. If
200 a cached entry has expired, the sequence number is requested from
201 the PDC and compared against the sequence number of the cached entry.
202 If the sequence numbers do not match, then the cached information
203 is discarded and up-to-date information is requested directly
204 from the PDC.</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2950035"></a>Installation and Configuration</h2></div></div><div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2950042"></a>Introduction</h3></div></div><div></div></div><p>
205 This section describes the procedures used to get Winbind up and
206 running. Winbind is capable of providing access
207 and authentication control for Windows Domain users through an NT
208 or Windows 200x PDC for regular services, such as telnet and ftp, as
209 well for Samba services.
210 </p><div class="itemizedlist"><ul type="disc"><li><p>
211 <span class="emphasis"><em>Why should I do this?</em></span>
212 </p><p>This allows the Samba administrator to rely on the
213 authentication mechanisms on the Windows NT/200x PDC for the authentication
214 of Domain Members. Windows NT/200x users no longer need to have separate
215 accounts on the Samba server.
217 <span class="emphasis"><em>Who should be reading this document?</em></span>
219 This document is designed for system administrators. If you are
220 implementing Samba on a file server and wish to (fairly easily)
221 integrate existing Windows NT/200x users from your PDC onto the
222 Samba server, this document is for you.
223 </p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2950108"></a>Requirements</h3></div></div><div></div></div><p>
224 If you have a Samba configuration file that you are currently using, <span class="emphasis"><em>BACK IT UP!</em></span>
225 If your system already uses PAM, <span class="emphasis"><em>back up the <tt class="filename">/etc/pam.d</tt> directory
226 contents!</em></span> If you haven't already made a boot disk, <span class="emphasis"><em>MAKE ONE NOW!</em></span>
228 Messing with the PAM configuration files can make it nearly impossible to log in to your machine. That's
229 why you want to be able to boot back into your machine in single user mode and restore your
230 <tt class="filename">/etc/pam.d</tt> back to the original state they were in if you get frustrated with the
231 way things are going.
233 The latest version of Samba-3 includes a functioning winbindd daemon. Please refer to the <ulink url="http://samba.org/">main Samba Web page</ulink> or, better yet, your closest Samba mirror site for
234 instructions on downloading the source code.
236 To allow domain users the ability to access Samba shares and files, as well as potentially other services
237 provided by your Samba machine, PAM must be set up properly on your
238 machine. In order to compile the Winbind modules, you should have at least the PAM development libraries installed
239 on your system. Please refer the PAM web site <ulink url="http://www.kernel.org/pub/linux/libs/pam/">http://www.kernel.org/pub/linux/libs/pam/</ulink>.
240 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2950191"></a>Testing Things Out</h3></div></div><div></div></div><p>
241 Before starting, it is probably best to kill off all the Samba-related daemons running on your server.
242 Kill off all <span class="application">smbd</span>, <span class="application">nmbd</span>, and <span class="application">winbindd</span> processes that may be running. To use PAM,
243 make sure that you have the standard PAM package that supplies the <tt class="filename">/etc/pam.d</tt>
244 directory structure, including the PAM modules that are used by PAM-aware services, several pam libraries,
245 and the <tt class="filename">/usr/doc</tt> and <tt class="filename">/usr/man</tt> entries for pam. Winbind built
246 better in Samba if the pam-devel package is also installed. This package includes the header files
247 needed to compile PAM-aware applications.
248 </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2950252"></a>Configure <tt class="filename">nsswitch.conf</tt> and the Winbind Libraries on Linux and Solaris</h4></div></div><div></div></div><p>
249 PAM is a standard component of most current generation UNIX/Linux systems. Unfortunately, few systems install
250 the <tt class="filename">pam-devel</tt> libraries that are needed to build PAM-enabled Samba. Additionally, Samba-3
251 may auto-install the Winbind files into their correct locations on your system, so before you get too far down
252 the track be sure to check if the following configuration is really
253 necessary. You may only need to configure
254 <tt class="filename">/etc/nsswitch.conf</tt>.
256 The libraries needed to run the <span class="application">winbindd</span> daemon through nsswitch need to be copied to their proper locations:
258 </p><pre class="screen">
259 <tt class="prompt">root# </tt><b class="userinput"><tt>cp ../samba/source/nsswitch/libnss_winbind.so /lib</tt></b>
262 I also found it necessary to make the following symbolic link:
264 <tt class="prompt">root# </tt> <b class="userinput"><tt>ln -s /lib/libnss_winbind.so /lib/libnss_winbind.so.2</tt></b>
265 </p><p>And, in the case of Sun Solaris:</p><pre class="screen">
266 <tt class="prompt">root# </tt><b class="userinput"><tt>ln -s /usr/lib/libnss_winbind.so /usr/lib/libnss_winbind.so.1</tt></b>
267 <tt class="prompt">root# </tt><b class="userinput"><tt>ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.1</tt></b>
268 <tt class="prompt">root# </tt><b class="userinput"><tt>ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.2</tt></b>
270 Now, as root you need to edit <tt class="filename">/etc/nsswitch.conf</tt> to
271 allow user and group entries to be visible from the <span class="application">winbindd</span>
272 daemon. My <tt class="filename">/etc/nsswitch.conf</tt> file look like
274 </p><pre class="programlisting">
275 passwd: files winbind
279 The libraries needed by the <b class="command">winbindd</b> daemon will be automatically
280 entered into the <b class="command">ldconfig</b> cache the next time
281 your system reboots, but it is faster (and you do not need to reboot) if you do it manually:
283 <tt class="prompt">root# </tt><b class="userinput"><tt>/sbin/ldconfig -v | grep winbind</tt></b>
285 This makes <tt class="filename">libnss_winbind</tt> available to winbindd
286 and echos back a check to you.
287 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2950492"></a>NSS Winbind on AIX</h4></div></div><div></div></div><p>(This section is only for those running AIX.)</p><p>
288 The Winbind AIX identification module gets built as <tt class="filename">libnss_winbind.so</tt> in the
289 nsswitch directory of the Samba source. This file can be copied to <tt class="filename">/usr/lib/security</tt>,
290 and the AIX naming convention would indicate that it should be named WINBIND. A stanza like the following:
291 </p><pre class="programlisting">
293 program = /usr/lib/security/WINBIND
296 can then be added to <tt class="filename">/usr/lib/security/methods.cfg</tt>. This module only supports
297 identification, but there have been success reports using the standard Winbind PAM module for
298 authentication. Use caution configuring loadable authentication
299 modules since you can make
300 it impossible to logon to the system. More information about the AIX authentication module API can
301 be found at “<span class="quote">Kernel Extensions and Device Support Programming Concepts for AIX</span>”<ulink url="http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/kernextc/sec_load_mod.htm">
302 in Chapter 18(John, there is no section like this in 18). Loadable Authentication Module Programming
303 Interface</ulink> and more information on administering the modules
304 can be found at <ulink url="http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixbman/baseadmn/iandaadmin.htm"> System
305 Management Guide: Operating System and Devices.</ulink>
306 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2950584"></a>Configure smb.conf</h4></div></div><div></div></div><p>
307 Several parameters are needed in the <tt class="filename">smb.conf</tt> file to control the behavior of <span class="application">winbindd</span>. These
308 are described in more detail in the <a href="winbindd.8.html"><span class="citerefentry"><span class="refentrytitle">winbindd</span>(8)</span></a> man page. My <tt class="filename">smb.conf</tt> file, as shown in <link linkend="winbindcfg">, was modified to include the necessary entries in the [global] section.
309 </p><div class="example"><a name="winbindcfg"></a><p class="title"><b>Example 21.1. smb.conf for Winbind set-up</b></p><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><i class="parameter"><tt>[global]</tt></i></td></tr><tr><td># separate domain and username with '+', like DOMAIN+username</td></tr><tr><td><i class="parameter"><tt>winbind separator = +</tt></i></td></tr><tr><td># use uids from 10000 to 20000 for domain users</td></tr><tr><td><i class="parameter"><tt>idmap uid = 10000-20000</tt></i></td></tr><tr><td># use gids from 10000 to 20000 for domain groups</td></tr><tr><td><i class="parameter"><tt>winbind gid = 10000-20000</tt></i></td></tr><tr><td># allow enumeration of winbind users and groups</td></tr><tr><td><i class="parameter"><tt>winbind enum users = yes</tt></i></td></tr><tr><td><i class="parameter"><tt>winbind enum groups = yes</tt></i></td></tr><tr><td># give winbind users a real shell (only needed if they have telnet access)</td></tr><tr><td><i class="parameter"><tt>template homedir = /home/winnt/%D/%U</tt></i></td></tr><tr><td><i class="parameter"><tt>template shell = /bin/bash</tt></i></td></tr></table></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2950748"></a>Join the Samba Server to the PDC Domain</h4></div></div><div></div></div><p>
310 Enter the following command to make the Samba server join the
311 PDC domain, where <i class="replaceable"><tt>DOMAIN</tt></i> is the name of
312 your Windows domain and <i class="replaceable"><tt>Administrator</tt></i> is
313 a domain user who has administrative privileges in the domain.
315 <tt class="prompt">root# </tt><b class="userinput"><tt>/usr/local/samba/bin/net rpc join -S PDC -U Administrator</tt></b>
317 The proper response to the command should be: “<span class="quote">Joined the domain
318 <i class="replaceable"><tt>DOMAIN</tt></i></span>” where <i class="replaceable"><tt>DOMAIN</tt></i>
320 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2950807"></a>Starting and Testing the <b class="command">winbindd</b> Daemon</h4></div></div><div></div></div><p>
321 Eventually, you will want to modify your Samba startup script to
322 automatically invoke the winbindd daemon when the other parts of
323 Samba start, but it is possible to test out just the Winbind
324 portion first. To start up Winbind services, enter the following
327 <tt class="prompt">root# </tt><b class="userinput"><tt>/usr/local/samba/bin/winbindd</tt></b>
328 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
329 The above assumes that Samba has been installed in the <tt class="filename">/usr/local/samba</tt>
330 directory tree. You may need to search for the location of Samba files if this is not the
331 location of <b class="command">winbindd</b> on your system.
333 Winbindd can now also run in “<span class="quote">dual daemon modei</span>”. This will make it
334 run as two processes. The first will answer all requests from the cache,
335 thus making responses to clients faster. The other will
336 update the cache for the query that the first has just responded.
337 The advantage of this is that responses stay accurate and are faster.
338 You can enable dual daemon mode by adding <tt class="option">-B</tt> to the commandline:
340 <tt class="prompt">root# </tt><b class="userinput"><tt>/usr/local/samba/bin/winbindd -B</tt></b>
342 I'm always paranoid and like to make sure the daemon is really running.
344 <tt class="prompt">root# </tt><b class="userinput"><tt>ps -ae | grep winbindd</tt></b>
346 This command should produce output like this, if the daemon is running you would expect
347 to see a report something like this:
348 </p><pre class="screen">
349 3025 ? 00:00:00 winbindd
351 Now, for the real test, try to get some information about the users on your PDC:
353 <tt class="prompt">root# </tt><b class="userinput"><tt>/usr/local/samba/bin/wbinfo -u</tt></b>
355 This should echo back a list of users on your Windows users on
356 your PDC. For example, I get the following response:
357 </p><pre class="screen">
365 Obviously, I have named my domain “<span class="quote">CEO</span>” and my <a class="indexterm" name="id2950988"></a><i class="parameter"><tt>winbind separator</tt></i> is “<span class="quote">+</span>”.
367 You can do the same sort of thing to get group information from the PDC:
368 </p><pre class="screen">
369 <tt class="prompt">root# </tt><b class="userinput"><tt>/usr/local/samba/bin/wbinfo -g</tt></b>
374 CEO+Domain Controllers
377 CEO+Enterprise Admins
378 CEO+Group Policy Creator Owners
380 The function <b class="command">getent</b> can now be used to get unified
381 lists of both local and PDC users and groups. Try the following command:
383 <tt class="prompt">root# </tt><b class="userinput"><tt>getent passwd</tt></b>
385 You should get a list that looks like your <tt class="filename">/etc/passwd</tt>
386 list followed by the domain users with their new UIDs, GIDs, home
387 directories and default shells.
389 The same thing can be done for groups with the command:
391 <tt class="prompt">root# </tt><b class="userinput"><tt>getent group</tt></b>
392 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2951103"></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="id2951110"></a>Linux</h5></div></div><div></div></div><p>
393 The <span class="application">winbindd</span> daemon needs to start up after the <span class="application">smbd</span> and <span class="application">nmbd</span> daemons are running.
394 To accomplish this task, you need to modify the startup scripts of your system.
395 They are located at <tt class="filename">/etc/init.d/smb</tt> in Red Hat Linux and they are located in
396 <tt class="filename">/etc/init.d/samba</tt> in Debian Linux. Edit your
397 script to add commands to invoke this daemon in the proper sequence. My
398 startup script starts up <span class="application">smbd</span>, <span class="application">nmbd</span>, and <span class="application">winbindd</span> from the
399 <tt class="filename">/usr/local/samba/bin</tt> directory directly. The <b class="command">start</b>
400 function in the script looks like this:
401 </p><pre class="programlisting">
404 echo -n $"Starting $KIND services: "
405 daemon /usr/local/samba/bin/smbd $SMBDOPTIONS
409 echo -n $"Starting $KIND services: "
410 daemon /usr/local/samba/bin/nmbd $NMBDOPTIONS
414 echo -n $"Starting $KIND services: "
415 daemon /usr/local/samba/bin/winbindd
418 [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] && \
419 touch /var/lock/subsys/smb || RETVAL=1
422 </pre><p>If you would like to run winbindd in dual daemon mode, replace
424 </p><pre class="programlisting">
425 daemon /usr/local/samba/bin/winbindd
428 in the example above with:
430 </p><pre class="programlisting">
431 daemon /usr/local/samba/bin/winbindd -B
434 The <b class="command">stop</b> function has a corresponding entry to shut down the
435 services and looks like this:
436 </p><pre class="programlisting">
439 echo -n $"Shutting down $KIND services: "
444 echo -n $"Shutting down $KIND services: "
449 echo -n $"Shutting down $KIND services: "
452 [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] && \
453 rm -f /var/lock/subsys/smb
457 </pre></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2951286"></a>Solaris</h5></div></div><div></div></div><p>
458 Winbind does not work on Solaris 9, see <link linkend="winbind-solaris9"> for details.
460 On Solaris, you need to modify the <tt class="filename">/etc/init.d/samba.server</tt> startup script. It
461 usually only starts smbd and nmbd but should now start winbindd, too. If you have Samba installed in
462 <tt class="filename">/usr/local/samba/bin</tt>, the file could contains something like this:
463 </p><pre class="programlisting">
469 then # /usr not mounted
473 killproc() { # kill the named process(es)
474 pid=`/usr/bin/ps -e |
475 /usr/bin/grep -w $1 |
476 /usr/bin/sed -e 's/^ *//' -e 's/ .*//'`
477 [ "$pid" != "" ] && kill $pid
480 # Start/stop processes required for Samba server
486 # Edit these lines to suit your installation (paths, workgroup, host)
489 /usr/local/samba/bin/smbd -D -s \
490 /usr/local/samba/smb.conf
493 /usr/local/samba/bin/nmbd -D -l \
494 /usr/local/samba/var/log -s /usr/local/samba/smb.conf
496 echo Starting Winbind Daemon
497 /usr/local/samba/bin/winbindd
507 echo "Usage: /etc/init.d/samba.server { start | stop }"
511 Again, if you would like to run Samba in dual daemon mode, replace:
512 </p><pre class="programlisting">
513 /usr/local/samba/bin/winbindd
515 in the script above with:
516 </p><pre class="programlisting">
517 /usr/local/samba/bin/winbindd -B
519 </p></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2951403"></a>Restarting</h5></div></div><div></div></div><p>
520 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
521 should be able to connect to the Samba server as a Domain Member just as
522 if you were a local user.
523 </p></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2951439"></a>Configure Winbind and PAM</h4></div></div><div></div></div><p>
524 If you have made it this far, you know that <b class="command">winbindd</b> and Samba are working
525 together. If you want to use Winbind to provide authentication for other
526 services, keep reading. The PAM configuration files need to be altered in
527 this step. (Did you remember to make backups of your original
528 <tt class="filename">/etc/pam.d</tt> files? If not, do it now.)
530 You will need a PAM module to use winbindd with these other services. This
531 module will be compiled in the <tt class="filename">../source/nsswitch</tt> directory
532 by invoking the command:
534 <tt class="prompt">root# </tt><b class="userinput"><tt>make nsswitch/pam_winbind.so</tt></b>
536 from the <tt class="filename">../source</tt> directory. The
537 <tt class="filename">pam_winbind.so</tt> file should be copied to the location of
538 your other PAM security modules. On my RedHat system, this was the
539 <tt class="filename">/lib/security</tt> directory. On Solaris, the PAM security
540 modules reside in <tt class="filename">/usr/lib/security</tt>.
542 <tt class="prompt">root# </tt><b class="userinput"><tt>cp ../samba/source/nsswitch/pam_winbind.so /lib/security</tt></b>
543 </p><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2951551"></a>Linux/FreeBSD-specific PAM configuration</h5></div></div><div></div></div><p>
544 The <tt class="filename">/etc/pam.d/samba</tt> file does not need to be changed. I
545 just left this file as it was:
546 </p><pre class="programlisting">
547 auth required /lib/security/pam_stack.so service=system-auth
548 account required /lib/security/pam_stack.so service=system-auth
550 The other services that I modified to allow the use of Winbind
551 as an authentication service were the normal login on the console (or a terminal
552 session), telnet logins, and ftp service. In order to enable these
553 services, you may first need to change the entries in
554 <tt class="filename">/etc/xinetd.d</tt> (or <tt class="filename">/etc/inetd.conf</tt>).
555 Red Hat Linux 7.1 and later uses the new xinetd.d structure, in this case you need
556 to change the lines in <tt class="filename">/etc/xinetd.d/telnet</tt>
557 and <tt class="filename">/etc/xinetd.d/wu-ftp</tt> from
558 </p><pre class="programlisting">
562 </p><pre class="programlisting">
565 For ftp services to work properly, you will also need to either
566 have individual directories for the domain users already present on
567 the server, or change the home directory template to a general
568 directory for all domain users. These can be easily set using
569 the <tt class="filename">smb.conf</tt> global entry
570 <a class="indexterm" name="id2951653"></a><i class="parameter"><tt>template homedir</tt></i>.
572 The <tt class="filename">/etc/pam.d/ftp</tt> file can be changed
573 to allow Winbind ftp access in a manner similar to the
574 samba file. My <tt class="filename">/etc/pam.d/ftp</tt> file was
575 changed to look like this:
576 </p><pre class="programlisting">
577 auth required /lib/security/pam_listfile.so item=user sense=deny \
578 file=/etc/ftpusers onerr=succeed
579 auth sufficient /lib/security/pam_winbind.so
580 auth required /lib/security/pam_stack.so service=system-auth
581 auth required /lib/security/pam_shells.so
582 account sufficient /lib/security/pam_winbind.so
583 account required /lib/security/pam_stack.so service=system-auth
584 session required /lib/security/pam_stack.so service=system-auth
586 The <tt class="filename">/etc/pam.d/login</tt> file can be changed nearly the
587 same way. It now looks like this:
588 </p><pre class="programlisting">
589 auth required /lib/security/pam_securetty.so
590 auth sufficient /lib/security/pam_winbind.so
591 auth sufficient /lib/security/pam_UNIX.so use_first_pass
592 auth required /lib/security/pam_stack.so service=system-auth
593 auth required /lib/security/pam_nologin.so
594 account sufficient /lib/security/pam_winbind.so
595 account required /lib/security/pam_stack.so service=system-auth
596 password required /lib/security/pam_stack.so service=system-auth
597 session required /lib/security/pam_stack.so service=system-auth
598 session optional /lib/security/pam_console.so
600 In this case, I added the </p><pre class="programlisting">auth sufficient /lib/security/pam_winbind.so</pre><p>
601 lines as before, but also added the </p><pre class="programlisting">required pam_securetty.so</pre><p>
602 above it, to disallow root logins over the network. I also added a
603 </p><pre class="programlisting">sufficient /lib/security/pam_unix.so use_first_pass</pre><p>
604 line after the <b class="command">winbind.so</b> line to get rid of annoying
605 double prompts for passwords.
606 </p></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2951787"></a>Solaris-specific configuration</h5></div></div><div></div></div><p>
607 The <tt class="filename">/etc/pam.conf</tt> needs to be changed. I changed this file so my Domain
608 users can logon both locally as well as telnet. The following are the changes
609 that I made. You can customize the <tt class="filename">pam.conf</tt> file as per your requirements, but
610 be sure of those changes because in the worst case it will leave your system
611 nearly impossible to boot.
612 </p><pre class="programlisting">
614 #ident "@(#)pam.conf 1.14 99/09/16 SMI"
616 # Copyright (c) 1996-1999, Sun Microsystems, Inc.
617 # All Rights Reserved.
621 # Authentication management
623 login auth required /usr/lib/security/pam_winbind.so
624 login auth required /usr/lib/security/$ISA/pam_UNIX.so.1 try_first_pass
625 login auth required /usr/lib/security/$ISA/pam_dial_auth.so.1 try_first_pass
627 rlogin auth sufficient /usr/lib/security/pam_winbind.so
628 rlogin auth sufficient /usr/lib/security/$ISA/pam_rhosts_auth.so.1
629 rlogin auth required /usr/lib/security/$ISA/pam_UNIX.so.1 try_first_pass
631 dtlogin auth sufficient /usr/lib/security/pam_winbind.so
632 dtlogin auth required /usr/lib/security/$ISA/pam_UNIX.so.1 try_first_pass
634 rsh auth required /usr/lib/security/$ISA/pam_rhosts_auth.so.1
635 other auth sufficient /usr/lib/security/pam_winbind.so
636 other auth required /usr/lib/security/$ISA/pam_UNIX.so.1 try_first_pass
640 login account sufficient /usr/lib/security/pam_winbind.so
641 login account requisite /usr/lib/security/$ISA/pam_roles.so.1
642 login account required /usr/lib/security/$ISA/pam_UNIX.so.1
644 dtlogin account sufficient /usr/lib/security/pam_winbind.so
645 dtlogin account requisite /usr/lib/security/$ISA/pam_roles.so.1
646 dtlogin account required /usr/lib/security/$ISA/pam_UNIX.so.1
648 other account sufficient /usr/lib/security/pam_winbind.so
649 other account requisite /usr/lib/security/$ISA/pam_roles.so.1
650 other account required /usr/lib/security/$ISA/pam_UNIX.so.1
654 other session required /usr/lib/security/$ISA/pam_UNIX.so.1
656 # Password management
658 #other password sufficient /usr/lib/security/pam_winbind.so
659 other password required /usr/lib/security/$ISA/pam_UNIX.so.1
660 dtsession auth required /usr/lib/security/$ISA/pam_UNIX.so.1
662 # Support for Kerberos V5 authentication (uncomment to use Kerberos)
664 #rlogin auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
665 #login auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
666 #dtlogin auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
667 #other auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
668 #dtlogin account optional /usr/lib/security/$ISA/pam_krb5.so.1
669 #other account optional /usr/lib/security/$ISA/pam_krb5.so.1
670 #other session optional /usr/lib/security/$ISA/pam_krb5.so.1
671 #other password optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
673 I also added a <i class="parameter"><tt>try_first_pass</tt></i> line after the <tt class="filename">winbind.so</tt>
674 line to get rid of annoying double prompts for passwords.
676 Now restart your Samba and try connecting through your application that you
677 configured in the pam.conf.
678 </p></div></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2951948"></a>Conclusion</h2></div></div><div></div></div><p>The Winbind system, through the use of the Name Service
679 Switch, Pluggable Authentication Modules, and appropriate
680 Microsoft RPC calls have allowed us to provide seamless
681 integration of Microsoft Windows NT domain users on a
682 UNIX system. The result is a great reduction in the administrative
683 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="id2951967"></a>Common Errors</h2></div></div><div></div></div><p>Winbind has a number of limitations in its current
684 released version that we hope to overcome in future
685 releases:</p><div class="itemizedlist"><ul type="disc"><li><p>Winbind is currently only available for
686 the Linux, Solaris, AIX, and IRIX operating systems, although ports to other operating
687 systems are certainly possible. For such ports to be feasible,
688 we require the C library of the target operating system to
689 support the Name Service Switch and Pluggable Authentication
690 Modules systems. This is becoming more common as NSS and
691 PAM gain support among UNIX vendors.</p></li><li><p>The mappings of Windows NT RIDs to UNIX IDs
692 is not made algorithmically and depends on the order in which
693 unmapped users or groups are seen by Winbind. It may be difficult
694 to recover the mappings of RID to UNIX ID mapping if the file
695 containing this information is corrupted or destroyed.</p></li><li><p>Currently the Winbind PAM module does not take
696 into account possible workstation and logon time restrictions
697 that may be set for Windows NT users, this is
698 instead up to the PDC to enforce.</p></li></ul></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2952021"></a>NSCD Problem Warning</h3></div></div><div></div></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>
699 Do not under any circumstances run <b class="command">nscd</b> on any system
700 on which <b class="command">winbindd</b> is running.
702 If <b class="command">nscd</b> is running on the UNIX/Linux system, then
703 even though NSSWITCH is correctly configured it will not be possible to resolve
704 domain users and groups for file and directory controls.
705 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2952067"></a>Winbind Is Not Resolving Users and Groups</h3></div></div><div></div></div><p>“<span class="quote">
706 My <tt class="filename">smb.conf</tt> file is correctly configured. I have specified
707 <a class="indexterm" name="id2952087"></a><i class="parameter"><tt>idmap uid</tt></i> = 12000,
708 and <a class="indexterm" name="id2952101"></a><i class="parameter"><tt>idmap gid</tt></i> = 3000-3500
709 and <b class="command">winbind</b> is running. When I do the following it all works fine.
710 </span>”</p><pre class="screen">
711 <tt class="prompt">root# </tt><b class="userinput"><tt>wbinfo -u</tt></b>
718 <tt class="prompt">root# </tt><b class="userinput"><tt>wbinfo -g</tt></b>
719 MIDEARTH+Domain Users
720 MIDEARTH+Domain Admins
721 MIDEARTH+Domain Guests
725 <tt class="prompt">root# </tt><b class="userinput"><tt>getent passwd</tt></b>
726 root:x:0:0:root:/root:/bin/bash
727 bin:x:1:1:bin:/bin:/bin/bash
729 maryo:x:15000:15003:Mary Orville:/home/MIDEARTH/maryo:/bin/false
730 </pre><p>“<span class="quote">
731 But the following command just fails:
733 <tt class="prompt">root# </tt><b class="userinput"><tt>chown maryo a_file</tt></b>
734 chown: `maryo': invalid user
736 This is driving me nuts! What can be wrong?
737 </span>”</p><p>
738 Same problem as the one above.
739 Your system is likely running <b class="command">nscd</b>, the name service
740 caching daemon. Shut it down, do not restart it! You will find your problem resolved.
741 </p></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>