1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4 <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
11 <firstname>Tim</firstname><surname>Potter</surname>
13 <orgname>Samba Team</orgname>
14 <address><email>tpot@linuxcare.com.au</email></address>
19 <firstname>Naag</firstname><surname>Mummaneni</surname>
21 <address><email>getnag@rediffmail.com</email></address>
23 <contrib>Notes for Solaris</contrib>
26 <firstname>John</firstname><surname>Trostel</surname>
28 <address><email>jtrostel@snapserver.com</email></address>
29 <orgname>SNAP</orgname>
35 <pubdate>27 June 2002</pubdate>
38 <title>Winbind: Use of Domain Accounts</title>
41 <title>Features and Benefits</title>
44 Integration of UNIX and Microsoft Windows NT through a unified logon has
45 been considered a <quote>holy grail</quote> in heterogeneous computing environments for
50 There is one other facility without which UNIX and Microsoft Windows network
51 interoperability would suffer greatly. It is imperative that there be a
52 mechanism for sharing files across UNIX systems and to be able to assign
53 domain user and group ownerships with integrity.
57 <emphasis>winbind</emphasis> is a component of the Samba suite of programs that
58 solves the unified logon problem. Winbind uses a UNIX implementation of Microsoft
59 RPC calls, Pluggable Authentication Modules, and the Name Service Switch to
60 allow Windows NT domain users to appear and operate as UNIX users on a UNIX
61 machine. This chapter describes the Winbind system, explaining the functionality
62 it provides, how it is configured, and how it works internally.
66 Winbind provides three separate functions:
71 Authentication of user credentials (via PAM).
75 Identity resolution (via NSS).
79 Winbind maintains a database called winbind_idmap.tdb in which it stores
80 mappings between UNIX UIDs / GIDs and NT SIDs. This mapping is used only
81 for users and groups that do not have a local UID/GID. It stored the UID/GID
82 allocated from the idmap uid/gid range that it has mapped to the NT SID.
83 If <parameter>idmap backend</parameter> has been specified as ldapsam:url
84 then instead of using a local mapping Winbind will obtain this information
85 from the LDAP database.
90 <indexterm><primary>winbindd</primary></indexterm>
91 <indexterm><primary>starting samba</primary><secondary>winbindd</secondary></indexterm>
92 If <command>winbindd</command> is not running, smbd (which calls <command>winbindd</command>) will fall back to
93 using purely local information from <filename>/etc/passwd</filename> and <filename>/etc/group</filename> and no dynamic
98 <!-- <figure id="winbind_idmap"><title></title>
100 <imageobject role="latex"><imagedata fileref="howto/imagefiles/idmap_winbind_no_loop" scale="50" scalefit="1"/></imageobject>
101 <imageobject><imagedata fileref="howto/imagefiles/idmap_winbind_no_loop.png" scale="50" scalefit="1"/></imageobject>
109 <title>Introduction</title>
111 <para>It is well known that UNIX and Microsoft Windows NT have
112 different models for representing user and group information and
113 use different technologies for implementing them. This fact has
114 made it difficult to integrate the two systems in a satisfactory
117 <para>One common solution in use today has been to create
118 identically named user accounts on both the UNIX and Windows systems
119 and use the Samba suite of programs to provide file and print services
120 between the two. This solution is far from perfect, however, as
121 adding and deleting users on both sets of machines becomes a chore
122 and two sets of passwords are required &smbmdash; both of which
123 can lead to synchronization problems between the UNIX and Windows
124 systems and confusion for users.</para>
126 <para>We divide the unified logon problem for UNIX machines into
127 three smaller problems:</para>
130 <listitem><para>Obtaining Windows NT user and group information.
133 <listitem><para>Authenticating Windows NT users.
136 <listitem><para>Password changing for Windows NT users.
141 <para>Ideally, a prospective solution to the unified logon problem
142 would satisfy all the above components without duplication of
143 information on the UNIX machines and without creating additional
144 tasks for the system administrator when maintaining users and
145 groups on either system. The Winbind system provides a simple
146 and elegant solution to all three components of the unified logon
152 <title>What Winbind Provides</title>
154 <para>Winbind unifies UNIX and Windows NT account management by
155 allowing a UNIX box to become a full member of an NT domain. Once
156 this is done the UNIX box will see NT users and groups as if
157 they were <quote>native</quote> UNIX users and groups, allowing the NT domain
158 to be used in much the same manner that NIS+ is used within
159 UNIX-only environments.</para>
161 <para>The end result is that whenever any
162 program on the UNIX machine asks the operating system to lookup
163 a user or group name, the query will be resolved by asking the
164 NT Domain Controller for the specified domain to do the lookup.
165 Because Winbind hooks into the operating system at a low level
166 (via the NSS name resolution modules in the C library), this
167 redirection to the NT Domain Controller is completely
170 <para>Users on the UNIX machine can then use NT user and group
171 names as they would <quote>native</quote> UNIX names. They can chown files
172 so they are owned by NT domain users or even login to the
173 UNIX machine and run a UNIX X-Window session as a domain user.</para>
175 <para>The only obvious indication that Winbind is being used is
176 that user and group names take the form <constant>DOMAIN\user</constant> and
177 <constant>DOMAIN\group</constant>. This is necessary as it allows Winbind to determine
178 that redirection to a Domain Controller is wanted for a particular
179 lookup and which trusted domain is being referenced.</para>
181 <para>Additionally, Winbind provides an authentication service
182 that hooks into the Pluggable Authentication Modules (PAM) system
183 to provide authentication via an NT domain to any PAM-enabled
184 applications. This capability solves the problem of synchronizing
185 passwords between systems since all passwords are stored in a single
186 location (on the Domain Controller).</para>
189 <title>Target Uses</title>
191 <para>Winbind is targeted at organizations that have an
192 existing NT-based domain infrastructure into which they wish
193 to put UNIX workstations or servers. Winbind will allow these
194 organizations to deploy UNIX workstations without having to
195 maintain a separate account infrastructure. This greatly
196 simplifies the administrative overhead of deploying UNIX
197 workstations into an NT-based organization.</para>
199 <para>Another interesting way in which we expect Winbind to
200 be used is as a central part of UNIX-based appliances. Appliances
201 that provide file and print services to Microsoft-based networks
202 will be able to use Winbind to provide seamless integration of
203 the appliance into the domain.</para>
210 <title>How Winbind Works</title>
212 <para>The Winbind system is designed around a client/server
213 architecture. A long running <command>winbindd</command> daemon
214 listens on a UNIX domain socket waiting for requests
215 to arrive. These requests are generated by the NSS and PAM
216 clients and is processed sequentially.</para>
218 <para>The technologies used to implement Winbind are described
219 in detail below.</para>
222 <title>Microsoft Remote Procedure Calls</title>
224 <para>Over the last few years, efforts have been underway
225 by various Samba Team members to decode various aspects of
226 the Microsoft Remote Procedure Call (MSRPC) system. This
227 system is used for most network-related operations between
228 Windows NT machines including remote management, user authentication
229 and print spooling. Although initially this work was done
230 to aid the implementation of Primary Domain Controller (PDC)
231 functionality in Samba, it has also yielded a body of code that
232 can be used for other purposes.</para>
234 <para>Winbind uses various MSRPC calls to enumerate domain users
235 and groups and to obtain detailed information about individual
236 users or groups. Other MSRPC calls can be used to authenticate
237 NT domain users and to change user passwords. By directly querying
238 a Windows PDC for user and group information, Winbind maps the
239 NT account information onto UNIX user and group names.</para>
243 <title>Microsoft Active Directory Services</title>
246 Since late 2001, Samba has gained the ability to
247 interact with Microsoft Windows 2000 using its <quote>Native
248 Mode</quote> protocols, rather than the NT4 RPC services.
249 Using LDAP and Kerberos, a Domain Member running
250 Winbind can enumerate users and groups in exactly the
251 same way as a Windows 200x client would, and in so doing
252 provide a much more efficient and effective Winbind implementation.
257 <title>Name Service Switch</title>
259 <para>The Name Service Switch, or NSS, is a feature that is
260 present in many UNIX operating systems. It allows system
261 information such as hostnames, mail aliases and user information
262 to be resolved from different sources. For example, a standalone
263 UNIX workstation may resolve system information from a series of
264 flat files stored on the local filesystem. A networked workstation
265 may first attempt to resolve system information from local files,
266 and then consult an NIS database for user information or a DNS server
267 for hostname information.</para>
269 <para>The NSS application programming interface allows Winbind
270 to present itself as a source of system information when
271 resolving UNIX usernames and groups. Winbind uses this interface,
272 and information obtained from a Windows NT server using MSRPC
273 calls to provide a new source of account enumeration. Using standard
274 UNIX library calls, one can enumerate the users and groups on
275 a UNIX machine running Winbind and see all users and groups in
276 a NT domain plus any trusted domain as though they were local
277 users and groups.</para>
279 <para>The primary control file for NSS is
280 <filename>/etc/nsswitch.conf</filename>.
281 When a UNIX application makes a request to do a lookup,
282 the C library looks in <filename>/etc/nsswitch.conf</filename>
283 for a line that matches the service type being requested, for
284 example the <quote>passwd</quote> service type is used when user or group names
285 are looked up. This config line specifies which implementations
286 of that service should be tried and in what order. If the passwd
287 config line is:</para>
290 passwd: files example
293 <para>then the C library will first load a module called
294 <filename>/lib/libnss_files.so</filename> followed by
295 the module <filename>/lib/libnss_example.so</filename>. The
296 C library will dynamically load each of these modules in turn
297 and call resolver functions within the modules to try to resolve
298 the request. Once the request is resolved, the C library returns the
299 result to the application.</para>
301 <para>This NSS interface provides an easy way for Winbind
302 to hook into the operating system. All that needs to be done
303 is to put <filename>libnss_winbind.so</filename> in <filename>/lib/</filename>
304 then add <quote>winbind</quote> into <filename>/etc/nsswitch.conf</filename> at
305 the appropriate place. The C library will then call Winbind to
306 resolve user and group names.</para>
310 <title>Pluggable Authentication Modules</title>
312 <para>Pluggable Authentication Modules, also known as PAM,
313 is a system for abstracting authentication and authorization
314 technologies. With a PAM module it is possible to specify different
315 authentication methods for different system applications without
316 having to recompile these applications. PAM is also useful
317 for implementing a particular policy for authorization. For example,
318 a system administrator may only allow console logins from users
319 stored in the local password file but only allow users resolved from
320 a NIS database to log in over the network.</para>
322 <para>Winbind uses the authentication management and password
323 management PAM interface to integrate Windows NT users into a
324 UNIX system. This allows Windows NT users to log in to a UNIX
325 machine and be authenticated against a suitable Primary Domain
326 Controller. These users can also change their passwords and have
327 this change take effect directly on the Primary Domain Controller.
330 <para>PAM is configured by providing control files in the directory
331 <filename>/etc/pam.d/</filename> for each of the services that
332 require authentication. When an authentication request is made
333 by an application, the PAM code in the C library looks up this
334 control file to determine what modules to load to do the
335 authentication check and in what order. This interface makes adding
336 a new authentication service for Winbind very easy. All that needs
337 to be done is that the <filename>pam_winbind.so</filename> module
338 is copied to <filename>/lib/security/</filename> and the PAM
339 control files for relevant services are updated to allow
340 authentication via Winbind. See the PAM documentation
341 in <link linkend="pam">PAM-Based Distributed Authentication</link> for more information.</para>
346 <title>User and Group ID Allocation</title>
348 <para>When a user or group is created under Windows NT/200x
349 it is allocated a numerical relative identifier (RID). This is
350 slightly different from UNIX which has a range of numbers that are
351 used to identify users, and the same range in which to identify
352 groups. It is Winbind's job to convert RIDs to UNIX ID numbers and
353 vice versa. When Winbind is configured, it is given part of the UNIX
354 user ID space and a part of the UNIX group ID space in which to
355 store Windows NT users and groups. If a Windows NT user is
356 resolved for the first time, it is allocated the next UNIX ID from
357 the range. The same process applies for Windows NT groups. Over
358 time, Winbind will have mapped all Windows NT users and groups
359 to UNIX user IDs and group IDs.</para>
361 <para>The results of this mapping are stored persistently in
362 an ID mapping database held in a tdb database). This ensures that
363 RIDs are mapped to UNIX IDs in a consistent way.</para>
368 <title>Result Caching</title>
371 <indexterm><primary>SAM</primary></indexterm>
372 An active system can generate a lot of user and group
373 name lookups. To reduce the network cost of these lookups, Winbind
374 uses a caching scheme based on the SAM sequence number supplied
375 by NT Domain Controllers. User or group information returned
376 by a PDC is cached by Winbind along with a sequence number also
377 returned by the PDC. This sequence number is incremented by
378 Windows NT whenever any user or group information is modified. If
379 a cached entry has expired, the sequence number is requested from
380 the PDC and compared against the sequence number of the cached entry.
381 If the sequence numbers do not match, then the cached information
382 is discarded and up-to-date information is requested directly
389 <title>Installation and Configuration</title>
392 <title>Introduction</title>
395 This section describes the procedures used to get Winbind up and
396 running. Winbind is capable of providing access
397 and authentication control for Windows Domain users through an NT
398 or Windows 200x PDC for regular services, such as telnet and ftp, as
399 well for Samba services.
405 <emphasis>Why should I do this?</emphasis>
408 <para>This allows the Samba administrator to rely on the
409 authentication mechanisms on the Windows NT/200x PDC for the authentication
410 of Domain Members. Windows NT/200x users no longer need to have separate
411 accounts on the Samba server.
417 <emphasis>Who should be reading this document?</emphasis>
421 This document is designed for system administrators. If you are
422 implementing Samba on a file server and wish to (fairly easily)
423 integrate existing Windows NT/200x users from your PDC onto the
424 Samba server, this document is for you.
432 <title>Requirements</title>
435 If you have a Samba configuration file that you are currently using, <emphasis>BACK IT UP!</emphasis>
436 If your system already uses PAM, <emphasis>back up the <filename>/etc/pam.d</filename> directory
437 contents!</emphasis> If you haven't already made a boot disk, <emphasis>MAKE ONE NOW!</emphasis>
441 Messing with the PAM configuration files can make it nearly impossible to log in to your machine. That's
442 why you want to be able to boot back into your machine in single user mode and restore your
443 <filename>/etc/pam.d</filename> back to the original state they were in if you get frustrated with the
444 way things are going.
448 The latest version of Samba-3 includes a functioning winbindd daemon. Please refer to the <ulink
449 url="http://samba.org/">main Samba Web page</ulink> or, better yet, your closest Samba mirror site for
450 instructions on downloading the source code.
454 To allow domain users the ability to access Samba shares and files, as well as potentially other services
455 provided by your Samba machine, PAM must be set up properly on your
456 machine. In order to compile the Winbind modules, you should have at least the PAM development libraries installed
457 on your system. Please refer the PAM web site <ulink url="http://www.kernel.org/pub/linux/libs/pam/"/>.
462 <title>Testing Things Out</title>
465 Before starting, it is probably best to kill off all the Samba-related daemons running on your server.
466 Kill off all &smbd;, &nmbd;, and &winbindd; processes that may be running. To use PAM,
467 make sure that you have the standard PAM package that supplies the <filename>/etc/pam.d</filename>
468 directory structure, including the PAM modules that are used by PAM-aware services, several pam libraries,
469 and the <filename>/usr/doc</filename> and <filename>/usr/man</filename> entries for pam. Winbind built
470 better in Samba if the pam-devel package is also installed. This package includes the header files
471 needed to compile PAM-aware applications.
475 <title>Configure <filename>nsswitch.conf</filename> and the Winbind Libraries on Linux and Solaris</title>
478 PAM is a standard component of most current generation UNIX/Linux systems. Unfortunately, few systems install
479 the <filename>pam-devel</filename> libraries that are needed to build PAM-enabled Samba. Additionally, Samba-3
480 may auto-install the Winbind files into their correct locations on your system, so before you get too far down
481 the track be sure to check if the following configuration is really
482 necessary. You may only need to configure
483 <filename>/etc/nsswitch.conf</filename>.
487 The libraries needed to run the &winbindd; daemon through nsswitch need to be copied to their proper locations:
492 &rootprompt;<userinput>cp ../samba/source/nsswitch/libnss_winbind.so /lib</userinput>
497 I also found it necessary to make the following symbolic link:
501 &rootprompt; <userinput>ln -s /lib/libnss_winbind.so /lib/libnss_winbind.so.2</userinput>
504 <para>And, in the case of Sun Solaris:</para>
506 &rootprompt;<userinput>ln -s /usr/lib/libnss_winbind.so /usr/lib/libnss_winbind.so.1</userinput>
507 &rootprompt;<userinput>ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.1</userinput>
508 &rootprompt;<userinput>ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.2</userinput>
512 Now, as root you need to edit <filename>/etc/nsswitch.conf</filename> to
513 allow user and group entries to be visible from the &winbindd;
514 daemon. My <filename>/etc/nsswitch.conf</filename> file look like
518 <para><programlisting>
519 passwd: files winbind
522 </programlisting></para>
525 The libraries needed by the <command>winbindd</command> daemon will be automatically
526 entered into the <command>ldconfig</command> cache the next time
527 your system reboots, but it is faster (and you do not need to reboot) if you do it manually:
531 &rootprompt;<userinput>/sbin/ldconfig -v | grep winbind</userinput>
535 This makes <filename>libnss_winbind</filename> available to winbindd
536 and echos back a check to you.
542 <title>NSS Winbind on AIX</title>
544 <para>(This section is only for those running AIX.)</para>
547 The Winbind AIX identification module gets built as <filename>libnss_winbind.so</filename> in the
548 nsswitch directory of the Samba source. This file can be copied to <filename>/usr/lib/security</filename>,
549 and the AIX naming convention would indicate that it should be named WINBIND. A stanza like the following:
552 <para><programlisting>
554 program = /usr/lib/security/WINBIND
556 </programlisting></para>
559 can then be added to <filename>/usr/lib/security/methods.cfg</filename>. This module only supports
560 identification, but there have been success reports using the standard Winbind PAM module for
561 authentication. Use caution configuring loadable authentication
562 modules since you can make
563 it impossible to logon to the system. More information about the AIX authentication module API can
564 be found at <quote>Kernel Extensions and Device Support Programming Concepts for AIX</quote><ulink
565 url="http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/kernextc/sec_load_mod.htm">
566 in Chapter 18(John, there is no section like this in 18). Loadable Authentication Module Programming
567 Interface</ulink> and more information on administering the modules
568 can be found at <ulink
569 url="http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixbman/baseadmn/iandaadmin.htm"> <quote>System
570 Management Guide: Operating System and Devices.</quote></ulink>
575 <title>Configure smb.conf</title>
578 Several parameters are needed in the &smb.conf; file to control the behavior of &winbindd;. These
579 are described in more detail in the <citerefentry><refentrytitle>winbindd</refentrytitle>
580 <manvolnum>8</manvolnum></citerefentry> man page. My &smb.conf; file, as shown in <link
581 linkend="winbindcfg">the next example</link>, was modified to include the necessary entries in the [global] section.
584 <para><smbconfexample id="winbindcfg">
585 <title>smb.conf for Winbind set-up</title>
586 <smbconfsection>[global]</smbconfsection>
588 <smbconfcomment> separate domain and username with '+', like DOMAIN+username</smbconfcomment>
589 <smbconfoption><name>winbind separator</name><value>+</value></smbconfoption>
590 <smbconfcomment> use uids from 10000 to 20000 for domain users</smbconfcomment>
591 <smbconfoption><name>idmap uid</name><value>10000-20000</value></smbconfoption>
592 <smbconfcomment> use gids from 10000 to 20000 for domain groups</smbconfcomment>
593 <smbconfoption><name>idmap gid</name><value>10000-20000</value></smbconfoption>
594 <smbconfcomment> allow enumeration of winbind users and groups</smbconfcomment>
595 <smbconfoption><name>winbind enum users</name><value>yes</value></smbconfoption>
596 <smbconfoption><name>winbind enum groups</name><value>yes</value></smbconfoption>
597 <smbconfcomment> give winbind users a real shell (only needed if they have telnet access)</smbconfcomment>
598 <smbconfoption><name>template homedir</name><value>/home/winnt/%D/%U</value></smbconfoption>
599 <smbconfoption><name>template shell</name><value>/bin/bash</value></smbconfoption>
600 </smbconfexample></para>
606 <title>Join the Samba Server to the PDC Domain</title>
609 Enter the following command to make the Samba server join the
610 PDC domain, where <replaceable>PDC</replaceable> is the name of
611 your PDC and <replaceable>Administrator</replaceable> is
612 a domain user who has administrative privileges in the domain.
617 &rootprompt;<userinput>/usr/local/samba/bin/net rpc join -S PDC -U Administrator</userinput>
621 The proper response to the command should be: <quote>Joined the domain
622 <replaceable>DOMAIN</replaceable></quote> where <replaceable>DOMAIN</replaceable>
629 <title>Starting and Testing the <command>winbindd</command> Daemon</title>
632 Eventually, you will want to modify your Samba startup script to
633 automatically invoke the winbindd daemon when the other parts of
634 Samba start, but it is possible to test out just the Winbind
635 portion first. To start up Winbind services, enter the following
640 &rootprompt;<userinput>/usr/local/samba/sbin/winbindd</userinput>
644 The above assumes that Samba has been installed in the <filename>/usr/local/samba</filename>
645 directory tree. You may need to search for the location of Samba files if this is not the
646 location of <command>winbindd</command> on your system.
650 Winbindd can now also run in <quote>dual daemon mode</quote>. This will make it
651 run as two processes. The first will answer all requests from the cache,
652 thus making responses to clients faster. The other will
653 update the cache for the query that the first has just responded.
654 The advantage of this is that responses stay accurate and are faster.
655 You can enable dual daemon mode by adding <option>-B</option> to the command-line:
659 &rootprompt;<userinput>/usr/local/samba/sbin/winbindd -B</userinput>
663 I'm always paranoid and like to make sure the daemon is really running.
667 &rootprompt;<userinput>ps -ae | grep winbindd</userinput>
670 This command should produce output like this, if the daemon is running you would expect
671 to see a report something like this:
674 3025 ? 00:00:00 winbindd
678 Now, for the real test, try to get some information about the users on your PDC:
682 &rootprompt;<userinput>/usr/local/samba/bin/wbinfo -u</userinput>
686 This should echo back a list of users on your Windows users on
687 your PDC. For example, I get the following response:
700 Obviously, I have named my domain <quote>CEO</quote> and my <smbconfoption><name>winbind separator</name></smbconfoption> is <quote>+</quote>.
704 You can do the same sort of thing to get group information from the PDC:
708 &rootprompt;<userinput>/usr/local/samba/bin/wbinfo -g</userinput>
713 CEO+Domain Controllers
716 CEO+Enterprise Admins
717 CEO+Group Policy Creator Owners
721 The function <command>getent</command> can now be used to get unified
722 lists of both local and PDC users and groups. Try the following command:
726 &rootprompt;<userinput>getent passwd</userinput>
730 You should get a list that looks like your <filename>/etc/passwd</filename>
731 list followed by the domain users with their new UIDs, GIDs, home
732 directories and default shells.
736 The same thing can be done for groups with the command:
740 &rootprompt;<userinput>getent group</userinput>
747 <title>Fix the init.d Startup Scripts</title>
753 The &winbindd; daemon needs to start up after the &smbd; and &nmbd; daemons are running.
754 To accomplish this task, you need to modify the startup scripts of your system.
755 They are located at <filename>/etc/init.d/smb</filename> in Red Hat Linux and they are located in
756 <filename>/etc/init.d/samba</filename> in Debian Linux. Edit your
757 script to add commands to invoke this daemon in the proper sequence. My
758 startup script starts up &smbd;, &nmbd;, and &winbindd; from the
759 <filename>/usr/local/samba/bin</filename> directory directly. The <command>start</command>
760 function in the script looks like this:
763 <para><programlisting>
766 echo -n $"Starting $KIND services: "
767 daemon /usr/local/samba/bin/smbd $SMBDOPTIONS
771 echo -n $"Starting $KIND services: "
772 daemon /usr/local/samba/bin/nmbd $NMBDOPTIONS
776 echo -n $"Starting $KIND services: "
777 daemon /usr/local/samba/sbin/winbindd
780 [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] && \
781 touch /var/lock/subsys/smb || RETVAL=1
784 </programlisting></para>
786 <para>If you would like to run winbindd in dual daemon mode, replace
789 daemon /usr/local/samba/sbin/winbindd
792 in the example above with:
795 daemon /usr/local/samba/sbin/winbindd -B
800 The <command>stop</command> function has a corresponding entry to shut down the
801 services and looks like this:
804 <para><programlisting>
807 echo -n $"Shutting down $KIND services: "
812 echo -n $"Shutting down $KIND services: "
817 echo -n $"Shutting down $KIND services: "
820 [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] && \
821 rm -f /var/lock/subsys/smb
825 </programlisting></para>
829 <title>Solaris</title>
832 Winbind does not work on Solaris 9, see <link linkend="winbind-solaris9">Winbind on Solaris 9</link> section for details.
836 On Solaris, you need to modify the <filename>/etc/init.d/samba.server</filename> startup script. It
837 usually only starts smbd and nmbd but should now start winbindd, too. If you have Samba installed in
838 <filename>/usr/local/samba/bin</filename>, the file could contains something like this:
842 <smbfile name="samba.server.sh">
849 then # /usr not mounted
853 killproc() { # kill the named process(es)
854 pid=`/usr/bin/ps -e |
855 /usr/bin/grep -w $1 |
856 /usr/bin/sed -e 's/^ *//' -e 's/ .*//'`
857 [ "$pid" != "" ] && kill $pid
860 # Start/stop processes required for Samba server
866 # Edit these lines to suit your installation (paths, workgroup, host)
869 /usr/local/samba/bin/smbd -D -s \
870 /usr/local/samba/smb.conf
873 /usr/local/samba/bin/nmbd -D -l \
874 /usr/local/samba/var/log -s /usr/local/samba/smb.conf
876 echo Starting Winbind Daemon
877 /usr/local/samba/sbin/winbindd
887 echo "Usage: /etc/init.d/samba.server { start | stop }"
890 </programlisting></smbfile></para>
893 Again, if you would like to run Samba in dual daemon mode, replace:
895 /usr/local/samba/sbin/winbindd
897 in the script above with:
899 /usr/local/samba/sbin/winbindd -B
906 <title>Restarting</title>
908 If you restart the &smbd;, &nmbd;, and &winbindd; daemons at this point, you
909 should be able to connect to the Samba server as a Domain Member just as
910 if you were a local user.
916 <title>Configure Winbind and PAM</title>
919 If you have made it this far, you know that <command>winbindd</command> and Samba are working
920 together. If you want to use Winbind to provide authentication for other
921 services, keep reading. The PAM configuration files need to be altered in
922 this step. (Did you remember to make backups of your original
923 <filename>/etc/pam.d</filename> files? If not, do it now.)
927 You will need a PAM module to use winbindd with these other services. This
928 module will be compiled in the <filename>../source/nsswitch</filename> directory
929 by invoking the command:
933 &rootprompt;<userinput>make nsswitch/pam_winbind.so</userinput>
937 from the <filename>../source</filename> directory. The
938 <filename>pam_winbind.so</filename> file should be copied to the location of
939 your other PAM security modules. On my Red Hat system, this was the
940 <filename>/lib/security</filename> directory. On Solaris, the PAM security
941 modules reside in <filename>/usr/lib/security</filename>.
945 &rootprompt;<userinput>cp ../samba/source/nsswitch/pam_winbind.so /lib/security</userinput>
949 <title>Linux/FreeBSD-specific PAM configuration</title>
952 The <filename>/etc/pam.d/samba</filename> file does not need to be changed. I
953 just left this file as it was:
957 <para><programlisting>
958 auth required /lib/security/pam_stack.so service=system-auth
959 account required /lib/security/pam_stack.so service=system-auth
960 </programlisting></para>
963 The other services that I modified to allow the use of Winbind
964 as an authentication service were the normal login on the console (or a terminal
965 session), telnet logins, and ftp service. In order to enable these
966 services, you may first need to change the entries in
967 <filename>/etc/xinetd.d</filename> (or <filename>/etc/inetd.conf</filename>).
968 Red Hat Linux 7.1 and later uses the new xinetd.d structure, in this case you need
969 to change the lines in <filename>/etc/xinetd.d/telnet</filename>
970 and <filename>/etc/xinetd.d/wu-ftp</filename> from
973 <para><programlisting>
979 </programlisting></para>
982 For ftp services to work properly, you will also need to either
983 have individual directories for the domain users already present on
984 the server, or change the home directory template to a general
985 directory for all domain users. These can be easily set using
986 the &smb.conf; global entry
987 <smbconfoption><name>template homedir</name></smbconfoption>.
991 <para>The directory in <smbconfoption><name>template homedir</name></smbconfoption> is not created automatically! Use pam_mkhomedir or pre-create
992 the directories of users to make sure users can log in on UNIX with
993 their own home directory.
998 The <filename>/etc/pam.d/ftp</filename> file can be changed
999 to allow Winbind ftp access in a manner similar to the
1000 samba file. My <filename>/etc/pam.d/ftp</filename> file was
1001 changed to look like this:
1004 <para><smbfile name="pam.ftp.winbind"><programlisting>
1005 auth required /lib/security/pam_listfile.so item=user sense=deny \
1006 file=/etc/ftpusers onerr=succeed
1007 auth sufficient /lib/security/pam_winbind.so
1008 auth required /lib/security/pam_stack.so service=system-auth
1009 auth required /lib/security/pam_shells.so
1010 account sufficient /lib/security/pam_winbind.so
1011 account required /lib/security/pam_stack.so service=system-auth
1012 session required /lib/security/pam_stack.so service=system-auth
1013 </programlisting></smbfile></para>
1016 The <filename>/etc/pam.d/login</filename> file can be changed nearly the
1017 same way. It now looks like this:
1020 <para><smbfile name="pam.login.winbind"><programlisting>
1021 auth required /lib/security/pam_securetty.so
1022 auth sufficient /lib/security/pam_winbind.so
1023 auth sufficient /lib/security/pam_unix.so use_first_pass
1024 auth required /lib/security/pam_stack.so service=system-auth
1025 auth required /lib/security/pam_nologin.so
1026 account sufficient /lib/security/pam_winbind.so
1027 account required /lib/security/pam_stack.so service=system-auth
1028 password required /lib/security/pam_stack.so service=system-auth
1029 session required /lib/security/pam_stack.so service=system-auth
1030 session optional /lib/security/pam_console.so
1031 </programlisting></smbfile></para>
1034 In this case, I added the <programlisting>auth sufficient /lib/security/pam_winbind.so</programlisting>
1035 lines as before, but also added the <programlisting>required pam_securetty.so</programlisting>
1036 above it, to disallow root logins over the network. I also added a
1037 <programlisting>sufficient /lib/security/pam_unix.so use_first_pass</programlisting>
1038 line after the <command>winbind.so</command> line to get rid of annoying
1039 double prompts for passwords.
1045 <title>Solaris-specific configuration</title>
1048 The <filename>/etc/pam.conf</filename> needs to be changed. I changed this file so my Domain
1049 users can logon both locally as well as telnet. The following are the changes
1050 that I made. You can customize the <filename>pam.conf</filename> file as per your requirements, but
1051 be sure of those changes because in the worst case it will leave your system
1052 nearly impossible to boot.
1055 <para><programlisting>
1057 #ident "@(#)pam.conf 1.14 99/09/16 SMI"
1059 # Copyright (c) 1996-1999, Sun Microsystems, Inc.
1060 # All Rights Reserved.
1064 # Authentication management
1066 login auth required /usr/lib/security/pam_winbind.so
1067 login auth required /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
1068 login auth required /usr/lib/security/$ISA/pam_dial_auth.so.1 try_first_pass
1070 rlogin auth sufficient /usr/lib/security/pam_winbind.so
1071 rlogin auth sufficient /usr/lib/security/$ISA/pam_rhosts_auth.so.1
1072 rlogin auth required /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
1074 dtlogin auth sufficient /usr/lib/security/pam_winbind.so
1075 dtlogin auth required /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
1077 rsh auth required /usr/lib/security/$ISA/pam_rhosts_auth.so.1
1078 other auth sufficient /usr/lib/security/pam_winbind.so
1079 other auth required /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
1081 # Account management
1083 login account sufficient /usr/lib/security/pam_winbind.so
1084 login account requisite /usr/lib/security/$ISA/pam_roles.so.1
1085 login account required /usr/lib/security/$ISA/pam_unix.so.1
1087 dtlogin account sufficient /usr/lib/security/pam_winbind.so
1088 dtlogin account requisite /usr/lib/security/$ISA/pam_roles.so.1
1089 dtlogin account required /usr/lib/security/$ISA/pam_unix.so.1
1091 other account sufficient /usr/lib/security/pam_winbind.so
1092 other account requisite /usr/lib/security/$ISA/pam_roles.so.1
1093 other account required /usr/lib/security/$ISA/pam_unix.so.1
1095 # Session management
1097 other session required /usr/lib/security/$ISA/pam_unix.so.1
1099 # Password management
1101 #other password sufficient /usr/lib/security/pam_winbind.so
1102 other password required /usr/lib/security/$ISA/pam_unix.so.1
1103 dtsession auth required /usr/lib/security/$ISA/pam_unix.so.1
1105 # Support for Kerberos V5 authentication (uncomment to use Kerberos)
1107 #rlogin auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
1108 #login auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
1109 #dtlogin auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
1110 #other auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
1111 #dtlogin account optional /usr/lib/security/$ISA/pam_krb5.so.1
1112 #other account optional /usr/lib/security/$ISA/pam_krb5.so.1
1113 #other session optional /usr/lib/security/$ISA/pam_krb5.so.1
1114 #other password optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
1115 </programlisting></para>
1118 I also added a <parameter>try_first_pass</parameter> line after the <filename>winbind.so</filename>
1119 line to get rid of annoying double prompts for passwords.
1123 Now restart your Samba and try connecting through your application that you
1124 configured in the pam.conf.
1136 <title>Conclusion</title>
1138 <para>The Winbind system, through the use of the Name Service
1139 Switch, Pluggable Authentication Modules, and appropriate
1140 Microsoft RPC calls have allowed us to provide seamless
1141 integration of Microsoft Windows NT domain users on a
1142 UNIX system. The result is a great reduction in the administrative
1143 cost of running a mixed UNIX and NT network.</para>
1148 <title>Common Errors</title>
1150 <para>Winbind has a number of limitations in its current
1151 released version that we hope to overcome in future
1155 <listitem><para>Winbind is currently only available for
1156 the Linux, Solaris, AIX, and IRIX operating systems, although ports to other operating
1157 systems are certainly possible. For such ports to be feasible,
1158 we require the C library of the target operating system to
1159 support the Name Service Switch and Pluggable Authentication
1160 Modules systems. This is becoming more common as NSS and
1161 PAM gain support among UNIX vendors.</para></listitem>
1163 <listitem><para>The mappings of Windows NT RIDs to UNIX IDs
1164 is not made algorithmically and depends on the order in which
1165 unmapped users or groups are seen by Winbind. It may be difficult
1166 to recover the mappings of RID to UNIX ID mapping if the file
1167 containing this information is corrupted or destroyed.</para>
1170 <listitem><para>Currently the Winbind PAM module does not take
1171 into account possible workstation and logon time restrictions
1172 that may be set for Windows NT users, this is
1173 instead up to the PDC to enforce.</para></listitem>
1177 <title>NSCD Problem Warning</title>
1179 <?latex \nopagebreak ?>
1182 Do not under any circumstances run <command>nscd</command> on any system
1183 on which <command>winbindd</command> is running.
1187 If <command>nscd</command> is running on the UNIX/Linux system, then
1188 even though NSSWITCH is correctly configured it will not be possible to resolve
1189 domain users and groups for file and directory controls.
1195 <title>Winbind Is Not Resolving Users and Groups</title>
1198 My &smb.conf; file is correctly configured. I have specified
1199 <smbconfoption><name>idmap uid</name><value>12000</value></smbconfoption>,
1200 and <smbconfoption><name>idmap gid</name><value>3000-3500</value></smbconfoption>
1201 and <command>winbind</command> is running. When I do the following it all works fine.
1205 &rootprompt;<userinput>wbinfo -u</userinput>
1212 &rootprompt;<userinput>wbinfo -g</userinput>
1213 MIDEARTH+Domain Users
1214 MIDEARTH+Domain Admins
1215 MIDEARTH+Domain Guests
1219 &rootprompt;<userinput>getent passwd</userinput>
1220 root:x:0:0:root:/root:/bin/bash
1221 bin:x:1:1:bin:/bin:/bin/bash
1223 maryo:x:15000:15003:Mary Orville:/home/MIDEARTH/maryo:/bin/false
1227 But the following command just fails:
1229 &rootprompt;<userinput>chown maryo a_file</userinput>
1230 chown: `maryo': invalid user
1232 This is driving me nuts! What can be wrong?
1236 Same problem as the one above.
1237 Your system is likely running <command>nscd</command>, the name service
1238 caching daemon. Shut it down, do not restart it! You will find your problem resolved.