This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.
[samba.git] / docs / htmldocs / winbind.html
1 <HTML
2 ><HEAD
3 ><TITLE
4 >Unified Logons between Windows NT and UNIX using Winbind</TITLE
5 ><META
6 NAME="GENERATOR"
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.57"></HEAD
8 ><BODY
9 CLASS="ARTICLE"
10 BGCOLOR="#FFFFFF"
11 TEXT="#000000"
12 LINK="#0000FF"
13 VLINK="#840084"
14 ALINK="#0000FF"
15 ><DIV
16 CLASS="ARTICLE"
17 ><DIV
18 CLASS="TITLEPAGE"
19 ><H1
20 CLASS="TITLE"
21 ><A
22 NAME="WINBIND"
23 >Unified Logons between Windows NT and UNIX using Winbind</A
24 ></H1
25 ><HR></DIV
26 ><DIV
27 CLASS="SECT1"
28 ><H1
29 CLASS="SECT1"
30 ><A
31 NAME="AEN3"
32 >Abstract</A
33 ></H1
34 ><P
35 >Integration of UNIX and Microsoft Windows NT through 
36         a unified logon has been considered a "holy grail" in heterogeneous 
37         computing environments for a long time. We present 
38         <I
39 CLASS="EMPHASIS"
40 >winbind</I
41 >, a component of the Samba suite 
42         of programs as a solution to the unified logon problem. Winbind 
43         uses a UNIX implementation 
44         of Microsoft RPC calls, Pluggable Authentication Modules, and the Name 
45         Service Switch to allow Windows NT domain users to appear and operate 
46         as UNIX users on a UNIX machine. This paper describes the winbind 
47         system, explaining the functionality it provides, how it is configured, 
48         and how it works internally.</P
49 ></DIV
50 ><DIV
51 CLASS="SECT1"
52 ><HR><H1
53 CLASS="SECT1"
54 ><A
55 NAME="AEN7"
56 >Introduction</A
57 ></H1
58 ><P
59 >It is well known that UNIX and Microsoft Windows NT have 
60         different models for representing user and group information and 
61         use different technologies for implementing them. This fact has 
62         made it difficult to integrate the two systems in a satisfactory 
63         manner.</P
64 ><P
65 >One common solution in use today has been to create 
66         identically named user accounts on both the UNIX and Windows systems 
67         and use the Samba suite of programs to provide file and print services 
68         between the two. This solution is far from perfect however, as 
69         adding and deleting users on both sets of machines becomes a chore 
70         and two sets of passwords are required both of which
71         can lead to synchronization problems between the UNIX and Windows 
72         systems and confusion for users.</P
73 ><P
74 >We divide the unified logon problem for UNIX machines into 
75         three smaller problems:</P
76 ><P
77 ></P
78 ><UL
79 ><LI
80 ><P
81 >Obtaining Windows NT user and group information
82                 </P
83 ></LI
84 ><LI
85 ><P
86 >Authenticating Windows NT users
87                 </P
88 ></LI
89 ><LI
90 ><P
91 >Password changing for Windows NT users
92                 </P
93 ></LI
94 ></UL
95 ><P
96 >Ideally, a prospective solution to the unified logon problem 
97         would satisfy all the above components without duplication of 
98         information on the UNIX machines and without creating additional 
99         tasks for the system administrator when maintaining users and 
100         groups on either system. The winbind system provides a simple 
101         and elegant solution to all three components of the unified logon 
102         problem.</P
103 ></DIV
104 ><DIV
105 CLASS="SECT1"
106 ><HR><H1
107 CLASS="SECT1"
108 ><A
109 NAME="AEN20"
110 >What Winbind Provides</A
111 ></H1
112 ><P
113 >Winbind unifies UNIX and Windows NT account management by 
114         allowing a UNIX box to become a full member of a NT domain. Once 
115         this is done the UNIX box will see NT users and groups as if 
116         they were native UNIX users and groups, allowing the NT domain 
117         to be used in much the same manner that NIS+ is used within 
118         UNIX-only environments.</P
119 ><P
120 >The end result is that whenever any 
121         program on the UNIX machine asks the operating system to lookup 
122         a user or group name, the query will be resolved by asking the 
123         NT domain controller for the specified domain to do the lookup.
124         Because Winbind hooks into the operating system at a low level 
125         (via the NSS name resolution modules in the C library) this 
126         redirection to the NT domain controller is completely 
127         transparent.</P
128 ><P
129 >Users on the UNIX machine can then use NT user and group 
130         names as they would use "native" UNIX names. They can chown files 
131         so that they are owned by NT domain users or even login to the 
132         UNIX machine and run a UNIX X-Window session as a domain user.</P
133 ><P
134 >The only obvious indication that Winbind is being used is 
135         that user and group names take the form DOMAIN\user and 
136         DOMAIN\group. This is necessary as it allows Winbind to determine 
137         that redirection to a domain controller is wanted for a particular 
138         lookup and which trusted domain is being referenced.</P
139 ><P
140 >Additionally, Winbind provides an authentication service 
141         that hooks into the Pluggable Authentication Modules (PAM) system 
142         to provide authentication via a NT domain to any PAM enabled 
143         applications. This capability solves the problem of synchronizing 
144         passwords between systems since all passwords are stored in a single 
145         location (on the domain controller).</P
146 ><DIV
147 CLASS="SECT2"
148 ><HR><H2
149 CLASS="SECT2"
150 ><A
151 NAME="AEN27"
152 >Target Uses</A
153 ></H2
154 ><P
155 >Winbind is targeted at organizations that have an 
156                 existing NT based domain infrastructure into which they wish 
157                 to put UNIX workstations or servers. Winbind will allow these 
158                 organizations to deploy UNIX workstations without having to 
159                 maintain a separate account infrastructure. This greatly 
160                 simplifies the administrative overhead of deploying UNIX 
161                 workstations into a NT based organization.</P
162 ><P
163 >Another interesting way in which we expect Winbind to 
164                 be used is as a central part of UNIX based appliances. Appliances 
165                 that provide file and print services to Microsoft based networks 
166                 will be able to use Winbind to provide seamless integration of 
167                 the appliance into the domain.</P
168 ></DIV
169 ></DIV
170 ><DIV
171 CLASS="SECT1"
172 ><HR><H1
173 CLASS="SECT1"
174 ><A
175 NAME="AEN31"
176 >How Winbind Works</A
177 ></H1
178 ><P
179 >The winbind system is designed around a client/server 
180         architecture. A long running <B
181 CLASS="COMMAND"
182 >winbindd</B
183 > daemon 
184         listens on a UNIX domain socket waiting for requests
185         to arrive. These requests are generated by the NSS and PAM 
186         clients and processed sequentially.</P
187 ><P
188 >The technologies used to implement winbind are described 
189         in detail below.</P
190 ><DIV
191 CLASS="SECT2"
192 ><HR><H2
193 CLASS="SECT2"
194 ><A
195 NAME="AEN36"
196 >Microsoft Remote Procedure Calls</A
197 ></H2
198 ><P
199 >Over the last two years, efforts have been underway 
200                 by various Samba Team members to decode various aspects of 
201                 the Microsoft Remote Procedure Call (MSRPC) system. This 
202                 system is used for most network related operations between 
203                 Windows NT machines including remote management, user authentication
204                 and print spooling. Although initially this work was done 
205                 to aid the implementation of Primary Domain Controller (PDC) 
206                 functionality in Samba, it has also yielded a body of code which 
207                 can be used for other purposes.</P
208 ><P
209 >Winbind uses various MSRPC calls to enumerate domain users 
210                 and groups and to obtain detailed information about individual 
211                 users or groups. Other MSRPC calls can be used to authenticate 
212                 NT domain users and to change user passwords. By directly querying 
213                 a Windows PDC for user and group information, winbind maps the 
214                 NT account information onto UNIX user and group names.</P
215 ></DIV
216 ><DIV
217 CLASS="SECT2"
218 ><HR><H2
219 CLASS="SECT2"
220 ><A
221 NAME="AEN40"
222 >Name Service Switch</A
223 ></H2
224 ><P
225 >The Name Service Switch, or NSS, is a feature that is 
226                 present in many UNIX operating systems. It allows system 
227                 information such as hostnames, mail aliases and user information 
228                 to be resolved from different sources. For example, a standalone 
229                 UNIX workstation may resolve system information from a series of 
230                 flat files stored on the local filesystem. A networked workstation 
231                 may first attempt to resolve system information from local files, 
232                 and then consult a NIS database for user information or a DNS server 
233                 for hostname information.</P
234 ><P
235 >The NSS application programming interface allows winbind 
236                 to present itself as a source of system information when 
237                 resolving UNIX usernames and groups.  Winbind uses this interface, 
238                 and information obtained from a Windows NT server using MSRPC 
239                 calls to provide a new source of account enumeration.  Using standard 
240                 UNIX library calls, one can enumerate the users and groups on
241                 a UNIX machine running winbind and see all users and groups in 
242                 a NT domain plus any trusted domain as though they were local 
243                 users and groups.</P
244 ><P
245 >The primary control file for NSS is 
246                 <TT
247 CLASS="FILENAME"
248 >/etc/nsswitch.conf</TT
249 >. 
250                 When a UNIX application makes a request to do a lookup 
251                 the C library looks in <TT
252 CLASS="FILENAME"
253 >/etc/nsswitch.conf</TT
254
255                 for a line which matches the service type being requested, for 
256                 example the "passwd" service type is used when user or group names 
257                 are looked up. This     config line species which implementations 
258                 of that service should be tried and in what order. If the passwd 
259                 config line is:</P
260 ><P
261 ><B
262 CLASS="COMMAND"
263 >passwd: files example</B
264 ></P
265 ><P
266 >then the C library will first load a module called 
267                 <TT
268 CLASS="FILENAME"
269 >/lib/libnss_files.so</TT
270 > followed by
271                 the module <TT
272 CLASS="FILENAME"
273 >/lib/libnss_example.so</TT
274 >. The 
275                 C library will dynamically load each of these modules in turn 
276                 and call resolver functions within the modules to try to resolve 
277                 the request. Once the request is resolved the C library returns the
278                 result to the application.</P
279 ><P
280 >This NSS interface provides a very easy way for Winbind 
281                 to hook into the operating system. All that needs to be done 
282                 is to put <TT
283 CLASS="FILENAME"
284 >libnss_winbind.so</TT
285 > in <TT
286 CLASS="FILENAME"
287 >/lib/</TT
288
289                 then add "winbind" into <TT
290 CLASS="FILENAME"
291 >/etc/nsswitch.conf</TT
292 > at 
293                 the appropriate place. The C library will then call Winbind to 
294                 resolve user and group names.</P
295 ></DIV
296 ><DIV
297 CLASS="SECT2"
298 ><HR><H2
299 CLASS="SECT2"
300 ><A
301 NAME="AEN56"
302 >Pluggable Authentication Modules</A
303 ></H2
304 ><P
305 >Pluggable Authentication Modules, also known as PAM, 
306                 is a system for abstracting authentication and authorization 
307                 technologies. With a PAM module it is possible to specify different 
308                 authentication methods for different system applications without 
309                 having to recompile these applications. PAM is also useful
310                 for implementing a particular policy for authorization. For example, 
311                 a system administrator may only allow console logins from users 
312                 stored in the local password file but only allow users resolved from 
313                 a NIS database to log in over the network.</P
314 ><P
315 >Winbind uses the authentication management and password 
316                 management PAM interface to integrate Windows NT users into a 
317                 UNIX system. This allows Windows NT users to log in to a UNIX 
318                 machine and be authenticated against a suitable Primary Domain 
319                 Controller. These users can also change their passwords and have 
320                 this change take effect directly on the Primary Domain Controller.
321                 </P
322 ><P
323 >PAM is configured by providing control files in the directory 
324                 <TT
325 CLASS="FILENAME"
326 >/etc/pam.d/</TT
327 > for each of the services that 
328                 require authentication. When an authentication request is made 
329                 by an application the PAM code in the C library looks up this
330                 control file to determine what modules to load to do the 
331                 authentication check and in what order. This interface makes adding 
332                 a new authentication service for Winbind very easy, all that needs 
333                 to be done is that the <TT
334 CLASS="FILENAME"
335 >pam_winbind.so</TT
336 > module 
337                 is copied to <TT
338 CLASS="FILENAME"
339 >/lib/security/</TT
340 > and the PAM 
341                 control files for relevant services are updated to allow 
342                 authentication via winbind. See the PAM documentation
343                 for more details.</P
344 ></DIV
345 ><DIV
346 CLASS="SECT2"
347 ><HR><H2
348 CLASS="SECT2"
349 ><A
350 NAME="AEN64"
351 >User and Group ID Allocation</A
352 ></H2
353 ><P
354 >When a user or group is created under Windows NT 
355                 is it allocated a numerical relative identifier (RID). This is 
356                 slightly different to UNIX which has a range of numbers that are 
357                 used to identify users, and the same range in which to identify 
358                 groups. It is winbind's job to convert RIDs to UNIX id numbers and
359                 vice versa.  When winbind is configured it is given part of the UNIX 
360                 user id space and a part of the UNIX group id space in which to 
361                 store Windows NT users and groups. If a Windows NT user is 
362                 resolved for the first time, it is allocated the next UNIX id from 
363                 the range. The same process applies for Windows NT groups. Over 
364                 time, winbind will have mapped all Windows NT users and groups
365                 to UNIX user ids and group ids.</P
366 ><P
367 >The results of this mapping are stored persistently in 
368                 an ID mapping database held in a tdb database). This ensures that 
369                 RIDs are mapped to UNIX IDs in a consistent way.</P
370 ></DIV
371 ><DIV
372 CLASS="SECT2"
373 ><HR><H2
374 CLASS="SECT2"
375 ><A
376 NAME="AEN68"
377 >Result Caching</A
378 ></H2
379 ><P
380 >An active system can generate a lot of user and group 
381                 name lookups. To reduce the network cost of these lookups winbind 
382                 uses a caching scheme based on the SAM sequence number supplied 
383                 by NT domain controllers.  User or group information returned 
384                 by a PDC is cached by winbind along with a sequence number also 
385                 returned by the PDC. This sequence number is incremented by 
386                 Windows NT whenever any user or group information is modified. If 
387                 a cached entry has expired, the sequence number is requested from 
388                 the PDC and compared against the sequence number of the cached entry. 
389                 If the sequence numbers do not match, then the cached information 
390                 is discarded and up to date information is requested directly 
391                 from the PDC.</P
392 ></DIV
393 ></DIV
394 ><DIV
395 CLASS="SECT1"
396 ><HR><H1
397 CLASS="SECT1"
398 ><A
399 NAME="AEN71"
400 >Installation and Configuration</A
401 ></H1
402 ><P
403 >Many thanks to John Trostel <A
404 HREF="mailto:jtrostel@snapserver.com"
405 TARGET="_top"
406 >jtrostel@snapserver.com</A
407 >
408 for providing the HOWTO for this section.</P
409 ><P
410 >This HOWTO describes how to get winbind services up and running 
411 to control access and authenticate users on your Linux box using 
412 the winbind services which come with SAMBA 2.2.2.</P
413 ><DIV
414 CLASS="SECT2"
415 ><HR><H2
416 CLASS="SECT2"
417 ><A
418 NAME="AEN76"
419 >Introduction</A
420 ></H2
421 ><P
422 >This HOWTO describes the procedures used to get winbind up and 
423 running on my RedHat 7.1 system.  Winbind is capable of providing access 
424 and authentication control for Windows Domain users through an NT 
425 or Win2K PDC for 'regular' services, such as telnet a nd ftp, as
426 well for SAMBA services.</P
427 ><P
428 >This HOWTO has been written from a 'RedHat-centric' perspective, so if 
429 you are using another distribution, you may have to modify the instructions 
430 somewhat to fit the way your distribution works.</P
431 ><P
432 ></P
433 ><UL
434 ><LI
435 ><P
436 >       <I
437 CLASS="EMPHASIS"
438 >Why should I to this?</I
439 >
440         </P
441 ><P
442 >This allows the SAMBA administrator to rely on the 
443         authentication mechanisms on the NT/Win2K PDC for the authentication 
444         of domain members.  NT/Win2K users no longer need to have separate 
445         accounts on the SAMBA server.
446         </P
447 ></LI
448 ><LI
449 ><P
450 >       <I
451 CLASS="EMPHASIS"
452 >Who should be reading this document?</I
453 >
454         </P
455 ><P
456 >       This HOWTO is designed for system administrators.  If you are 
457         implementing SAMBA on a file server and wish to (fairly easily) 
458         integrate existing NT/Win2K users from your PDC onto the
459         SAMBA server, this HOWTO is for you.  That said, I am no NT or PAM 
460         expert, so you may find a better or easier way to accomplish 
461         these tasks.
462         </P
463 ></LI
464 ></UL
465 ></DIV
466 ><DIV
467 CLASS="SECT2"
468 ><HR><H2
469 CLASS="SECT2"
470 ><A
471 NAME="AEN89"
472 >Requirements</A
473 ></H2
474 ><P
475 >If you have a samba configuration file that you are currently 
476 using... <I
477 CLASS="EMPHASIS"
478 >BACK IT UP!</I
479 >  If your system already uses PAM, 
480 <I
481 CLASS="EMPHASIS"
482 >back up the <TT
483 CLASS="FILENAME"
484 >/etc/pam.d</TT
485 > directory 
486 contents!</I
487 > If you haven't already made a boot disk, 
488 <I
489 CLASS="EMPHASIS"
490 >MAKE ONE NOW!</I
491 ></P
492 ><P
493 >Messing with the pam configuration files can make it nearly impossible 
494 to log in to yourmachine. That's why you want to be able to boot back 
495 into your machine in single user mode and restore your 
496 <TT
497 CLASS="FILENAME"
498 >/etc/pam.d</TT
499 > back to the original state they were in if 
500 you get frustrated with the way things are going.  ;-)</P
501 ><P
502 >The latest version of SAMBA (version 2.2.2 as of this writing), now 
503 includes a functioning winbindd daemon.  Please refer to the 
504 <A
505 HREF="http://samba.org/"
506 TARGET="_top"
507 >main SAMBA web page</A
508 > or, 
509 better yet, your closest SAMBA mirror site for instructions on 
510 downloading the source code.</P
511 ><P
512 >To allow Domain users the ability to access SAMBA shares and 
513 files, as well as potentially other services provided by your 
514 SAMBA machine, PAM (pluggable authentication modules) must
515 be setup properly on your machine.  In order to compile the 
516 winbind modules, you should have at least the pam libraries resident 
517 on your system.  For recent RedHat systems (7.1, for instance), that 
518 means <TT
519 CLASS="FILENAME"
520 >pam-0.74-22</TT
521 >.  For best results, it is helpful to also
522 install the development packages in <TT
523 CLASS="FILENAME"
524 >pam-devel-0.74-22</TT
525 >.</P
526 ></DIV
527 ><DIV
528 CLASS="SECT2"
529 ><HR><H2
530 CLASS="SECT2"
531 ><A
532 NAME="AEN103"
533 >Testing Things Out</A
534 ></H2
535 ><P
536 >Before starting, it is probably best to kill off all the SAMBA 
537 related daemons running on your server.  Kill off all <B
538 CLASS="COMMAND"
539 >smbd</B
540 >, 
541 <B
542 CLASS="COMMAND"
543 >nmbd</B
544 >, and <B
545 CLASS="COMMAND"
546 >winbindd</B
547 > processes that may 
548 be running.  To use PAM, you will want to make sure that you have the 
549 standard PAM package (for RedHat) which supplies the <TT
550 CLASS="FILENAME"
551 >/etc/pam.d</TT
552
553 directory structure, including the pam modules are used by pam-aware 
554 services, several pam libraries, and the <TT
555 CLASS="FILENAME"
556 >/usr/doc</TT
557
558 and <TT
559 CLASS="FILENAME"
560 >/usr/man</TT
561 > entries for pam.  Winbind built better 
562 in SAMBA if the pam-devel package was also installed.  This package includes 
563 the header files needed to compile pam-aware applications. For instance, 
564 my RedHat system has both <TT
565 CLASS="FILENAME"
566 >pam-0.74-22</TT
567 > and
568 <TT
569 CLASS="FILENAME"
570 >pam-devel-0.74-22</TT
571 > RPMs installed.</P
572 ><DIV
573 CLASS="SECT3"
574 ><HR><H3
575 CLASS="SECT3"
576 ><A
577 NAME="AEN114"
578 >Configure and compile SAMBA</A
579 ></H3
580 ><P
581 >The configuration and compilation of SAMBA is pretty straightforward.
582 The first three steps may not be necessary depending upon
583 whether or not you have previously built the Samba binaries.</P
584 ><P
585 ><PRE
586 CLASS="PROGRAMLISTING"
587 ><TT
588 CLASS="PROMPT"
589 >root#</TT
590 > <B
591 CLASS="COMMAND"
592 >autoconf</B
593 >
594 <TT
595 CLASS="PROMPT"
596 >root#</TT
597 > <B
598 CLASS="COMMAND"
599 >make clean</B
600 >
601 <TT
602 CLASS="PROMPT"
603 >root#</TT
604 > <B
605 CLASS="COMMAND"
606 >rm config.cache</B
607 >
608 <TT
609 CLASS="PROMPT"
610 >root#</TT
611 > <B
612 CLASS="COMMAND"
613 >./configure --with-winbind</B
614 >
615 <TT
616 CLASS="PROMPT"
617 >root#</TT
618 > <B
619 CLASS="COMMAND"
620 >make</B
621 >
622 <TT
623 CLASS="PROMPT"
624 >root#</TT
625 > <B
626 CLASS="COMMAND"
627 >make install</B
628 ></PRE
629 ></P
630 ><P
631 >This will, by default, install SAMBA in <TT
632 CLASS="FILENAME"
633 >/usr/local/samba</TT
634 >.
635 See the main SAMBA documentation if you want to install SAMBA somewhere else.
636 It will also build the winbindd executable and libraries. </P
637 ></DIV
638 ><DIV
639 CLASS="SECT3"
640 ><HR><H3
641 CLASS="SECT3"
642 ><A
643 NAME="AEN133"
644 >Configure <TT
645 CLASS="FILENAME"
646 >nsswitch.conf</TT
647 > and the 
648 winbind libraries</A
649 ></H3
650 ><P
651 >The libraries needed to run the <B
652 CLASS="COMMAND"
653 >winbindd</B
654 > daemon 
655 through nsswitch need to be copied to their proper locations, so</P
656 ><P
657 ><TT
658 CLASS="PROMPT"
659 >root#</TT
660 > <B
661 CLASS="COMMAND"
662 >cp ../samba/source/nsswitch/libnss_winbind.so /lib</B
663 ></P
664 ><P
665 >I also found it necessary to make the following symbolic link:</P
666 ><P
667 ><TT
668 CLASS="PROMPT"
669 >root#</TT
670 > <B
671 CLASS="COMMAND"
672 >ln -s /lib/libnss_winbind.so /lib/libnss_winbind.so.2</B
673 ></P
674 ><P
675 >Now, as root you need to edit <TT
676 CLASS="FILENAME"
677 >/etc/nsswitch.conf</TT
678 > to 
679 allow user and group entries to be visible from the <B
680 CLASS="COMMAND"
681 >winbindd</B
682
683 daemon.  My <TT
684 CLASS="FILENAME"
685 >/etc/nsswitch.conf</TT
686 > file look like 
687 this after editing:</P
688 ><P
689 ><PRE
690 CLASS="PROGRAMLISTING"
691 >       passwd:     files winbind
692         shadow:     files 
693         group:      files winbind</PRE
694 ></P
695 ><P
696 >       
697 The libraries needed by the winbind daemon will be automatically 
698 entered into the <B
699 CLASS="COMMAND"
700 >ldconfig</B
701 > cache the next time 
702 your system reboots, but it 
703 is faster (and you don't need to reboot) if you do it manually:</P
704 ><P
705 ><TT
706 CLASS="PROMPT"
707 >root#</TT
708 > <B
709 CLASS="COMMAND"
710 >/sbin/ldconfig -v | grep winbind</B
711 ></P
712 ><P
713 >This makes <TT
714 CLASS="FILENAME"
715 >libnss_winbind</TT
716 > available to winbindd 
717 and echos back a check to you.</P
718 ></DIV
719 ><DIV
720 CLASS="SECT3"
721 ><HR><H3
722 CLASS="SECT3"
723 ><A
724 NAME="AEN158"
725 >Configure smb.conf</A
726 ></H3
727 ><P
728 >Several parameters are needed in the smb.conf file to control 
729 the behavior of <B
730 CLASS="COMMAND"
731 >winbindd</B
732 >. Configure 
733 <TT
734 CLASS="FILENAME"
735 >smb.conf</TT
736 > These are described in more detail in 
737 the <A
738 HREF="winbindd.8.html"
739 TARGET="_top"
740 >winbindd(8)</A
741 > man page.  My 
742 <TT
743 CLASS="FILENAME"
744 >smb.conf</TT
745 > file was modified to
746 include the following entries in the [global] section:</P
747 ><P
748 ><PRE
749 CLASS="PROGRAMLISTING"
750 >[global]
751      &#60;...&#62;
752      # separate domain and username with '+', like DOMAIN+username
753      <A
754 HREF="winbindd.8.html#WINBINDSEPARATOR"
755 TARGET="_top"
756 >winbind separator</A
757 > = +
758      # use uids from 10000 to 20000 for domain users
759      <A
760 HREF="winbindd.8.html#WINBINDUID"
761 TARGET="_top"
762 >winbind uid</A
763 > = 10000-20000
764      # use gids from 10000 to 20000 for domain groups
765      <A
766 HREF="winbindd.8.html#WINBINDGID"
767 TARGET="_top"
768 >winbind gid</A
769 > = 10000-20000
770      # allow enumeration of winbind users and groups
771      <A
772 HREF="winbindd.8.html#WINBINDENUMUSERS"
773 TARGET="_top"
774 >winbind enum users</A
775 > = yes
776      <A
777 HREF="winbindd.8.html#WINBINDENUMGROUP"
778 TARGET="_top"
779 >winbind enum groups</A
780 > = yes
781      # give winbind users a real shell (only needed if they have telnet access)
782      <A
783 HREF="winbindd.8.html#TEMPLATEHOMEDIR"
784 TARGET="_top"
785 >template homedir</A
786 > = /home/winnt/%D/%U
787      <A
788 HREF="winbindd.8.html#TEMPLATESHELL"
789 TARGET="_top"
790 >template shell</A
791 > = /bin/bash</PRE
792 ></P
793 ></DIV
794 ><DIV
795 CLASS="SECT3"
796 ><HR><H3
797 CLASS="SECT3"
798 ><A
799 NAME="AEN174"
800 >Join the SAMBA server to the PDC domain</A
801 ></H3
802 ><P
803 >Enter the following command to make the SAMBA server join the 
804 PDC domain, where <TT
805 CLASS="REPLACEABLE"
806 ><I
807 >DOMAIN</I
808 ></TT
809 > is the name of 
810 your Windows domain and <TT
811 CLASS="REPLACEABLE"
812 ><I
813 >Administrator</I
814 ></TT
815 > is 
816 a domain user who has administrative privileges in the domain.</P
817 ><P
818 ><TT
819 CLASS="PROMPT"
820 >root#</TT
821 > <B
822 CLASS="COMMAND"
823 >/usr/local/samba/bin/net rpc join -s PDC -U Administrator</B
824 ></P
825 ><P
826 >The proper response to the command should be: "Joined the domain 
827 <TT
828 CLASS="REPLACEABLE"
829 ><I
830 >DOMAIN</I
831 ></TT
832 >" where <TT
833 CLASS="REPLACEABLE"
834 ><I
835 >DOMAIN</I
836 ></TT
837
838 is your DOMAIN name.</P
839 ></DIV
840 ><DIV
841 CLASS="SECT3"
842 ><HR><H3
843 CLASS="SECT3"
844 ><A
845 NAME="AEN185"
846 >Start up the winbindd daemon and test it!</A
847 ></H3
848 ><P
849 >Eventually, you will want to modify your smb startup script to 
850 automatically invoke the winbindd daemon when the other parts of 
851 SAMBA start, but it is possible to test out just the winbind
852 portion first.  To start up winbind services, enter the following 
853 command as root:</P
854 ><P
855 ><TT
856 CLASS="PROMPT"
857 >root#</TT
858 > <B
859 CLASS="COMMAND"
860 >/usr/local/samba/bin/winbindd</B
861 ></P
862 ><P
863 >I'm always paranoid and like to make sure the daemon 
864 is really running...</P
865 ><P
866 ><TT
867 CLASS="PROMPT"
868 >root#</TT
869 > <B
870 CLASS="COMMAND"
871 >ps -ae | grep winbindd</B
872 ></P
873 ><P
874 >This command should produce output like this, if the daemon is running</P
875 ><P
876 >3025 ?        00:00:00 winbindd</P
877 ><P
878 >Now... for the real test, try to get some information about the 
879 users on your PDC</P
880 ><P
881 ><TT
882 CLASS="PROMPT"
883 >root#</TT
884 > <B
885 CLASS="COMMAND"
886 >/usr/local/samba/bin/wbinfo -u</B
887 ></P
888 ><P
889 >       
890 This should echo back a list of users on your Windows users on 
891 your PDC.  For example, I get the following response:</P
892 ><P
893 ><PRE
894 CLASS="PROGRAMLISTING"
895 >CEO+Administrator
896 CEO+burdell
897 CEO+Guest
898 CEO+jt-ad
899 CEO+krbtgt
900 CEO+TsInternetUser</PRE
901 ></P
902 ><P
903 >Obviously, I have named my domain 'CEO' and my <TT
904 CLASS="PARAMETER"
905 ><I
906 >winbind
907 separator</I
908 ></TT
909 > is '+'.</P
910 ><P
911 >You can do the same sort of thing to get group information from 
912 the PDC:</P
913 ><P
914 ><PRE
915 CLASS="PROGRAMLISTING"
916 ><TT
917 CLASS="PROMPT"
918 >root#</TT
919 > <B
920 CLASS="COMMAND"
921 >/usr/local/samba/bin/wbinfo -g</B
922 >
923 CEO+Domain Admins
924 CEO+Domain Users
925 CEO+Domain Guests
926 CEO+Domain Computers
927 CEO+Domain Controllers
928 CEO+Cert Publishers
929 CEO+Schema Admins
930 CEO+Enterprise Admins
931 CEO+Group Policy Creator Owners</PRE
932 ></P
933 ><P
934 >The function 'getent' can now be used to get unified 
935 lists of both local and PDC users and groups.
936 Try the following command:</P
937 ><P
938 ><TT
939 CLASS="PROMPT"
940 >root#</TT
941 > <B
942 CLASS="COMMAND"
943 >getent passwd</B
944 ></P
945 ><P
946 >You should get a list that looks like your <TT
947 CLASS="FILENAME"
948 >/etc/passwd</TT
949
950 list followed by the domain users with their new uids, gids, home 
951 directories and default shells.</P
952 ><P
953 >The same thing can be done for groups with the command</P
954 ><P
955 ><TT
956 CLASS="PROMPT"
957 >root#</TT
958 > <B
959 CLASS="COMMAND"
960 >getent group</B
961 ></P
962 ></DIV
963 ><DIV
964 CLASS="SECT3"
965 ><HR><H3
966 CLASS="SECT3"
967 ><A
968 NAME="AEN221"
969 >Fix the <TT
970 CLASS="FILENAME"
971 >/etc/rc.d/init.d/smb</TT
972 > startup files</A
973 ></H3
974 ><P
975 >The <B
976 CLASS="COMMAND"
977 >winbindd</B
978 > daemon needs to start up after the 
979 <B
980 CLASS="COMMAND"
981 >smbd</B
982 > and <B
983 CLASS="COMMAND"
984 >nmbd</B
985 > daemons are running.  
986 To accomplish this task, you need to modify the <TT
987 CLASS="FILENAME"
988 >/etc/init.d/smb</TT
989 >
990 script to add commands to invoke this daemon in the proper sequence.  My 
991 <TT
992 CLASS="FILENAME"
993 >/etc/init.d/smb</TT
994 > file starts up <B
995 CLASS="COMMAND"
996 >smbd</B
997 >, 
998 <B
999 CLASS="COMMAND"
1000 >nmbd</B
1001 >, and <B
1002 CLASS="COMMAND"
1003 >winbindd</B
1004 > from the 
1005 <TT
1006 CLASS="FILENAME"
1007 >/usr/local/samba/bin</TT
1008 > directory directly.  The 'start' 
1009 function in the script looks like this:</P
1010 ><P
1011 ><PRE
1012 CLASS="PROGRAMLISTING"
1013 >start() {
1014         KIND="SMB"
1015         echo -n $"Starting $KIND services: "
1016         daemon /usr/local/samba/bin/smbd $SMBDOPTIONS
1017         RETVAL=$?
1018         echo
1019         KIND="NMB"
1020         echo -n $"Starting $KIND services: "
1021         daemon /usr/local/samba/bin/nmbd $NMBDOPTIONS
1022         RETVAL2=$?
1023         echo
1024         KIND="Winbind"
1025         echo -n $"Starting $KIND services: "
1026         daemon /usr/local/samba/bin/winbindd
1027         RETVAL3=$?
1028         echo
1029         [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] &#38;&#38; touch /var/lock/subsys/smb || \
1030            RETVAL=1
1031         return $RETVAL
1032 }</PRE
1033 ></P
1034 ><P
1035 >The 'stop' function has a corresponding entry to shut down the 
1036 services and look s like this:</P
1037 ><P
1038 ><PRE
1039 CLASS="PROGRAMLISTING"
1040 >stop() {
1041         KIND="SMB"
1042         echo -n $"Shutting down $KIND services: "
1043         killproc smbd
1044         RETVAL=$?
1045         echo
1046         KIND="NMB"
1047         echo -n $"Shutting down $KIND services: "
1048         killproc nmbd
1049         RETVAL2=$?
1050         echo
1051         KIND="Winbind"
1052         echo -n $"Shutting down $KIND services: "
1053         killproc winbindd
1054         RETVAL3=$?
1055         [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] &#38;&#38; rm -f /var/lock/subsys/smb
1056         echo ""
1057         return $RETVAL
1058 }</PRE
1059 ></P
1060 ><P
1061 >If you restart the <B
1062 CLASS="COMMAND"
1063 >smbd</B
1064 >, <B
1065 CLASS="COMMAND"
1066 >nmbd</B
1067 >, 
1068 and <B
1069 CLASS="COMMAND"
1070 >winbindd</B
1071 > daemons at this point, you
1072 should be able to connect to the samba server as a domain member just as
1073 if you were a local user.</P
1074 ></DIV
1075 ><DIV
1076 CLASS="SECT3"
1077 ><HR><H3
1078 CLASS="SECT3"
1079 ><A
1080 NAME="AEN243"
1081 >Configure Winbind and PAM</A
1082 ></H3
1083 ><P
1084 >If you have made it this far, you know that winbindd and samba are working
1085 together.  If you want to use winbind to provide authentication for other 
1086 services, keep reading.  The pam configuration files need to be altered in
1087 this step.  (Did you remember to make backups of your original 
1088 <TT
1089 CLASS="FILENAME"
1090 >/etc/pam.d</TT
1091 > files? If not, do it now.)</P
1092 ><P
1093 >You will need a pam module to use winbindd with these other services.  This 
1094 module will be compiled in the <TT
1095 CLASS="FILENAME"
1096 >../source/nsswitch</TT
1097 > directory
1098 by invoking the command</P
1099 ><P
1100 ><TT
1101 CLASS="PROMPT"
1102 >root#</TT
1103 > <B
1104 CLASS="COMMAND"
1105 >make nsswitch/pam_winbind.so</B
1106 ></P
1107 ><P
1108 >from the <TT
1109 CLASS="FILENAME"
1110 >../source</TT
1111 > directory.  The
1112 <TT
1113 CLASS="FILENAME"
1114 >pam_winbind.so</TT
1115 > file should be copied to the location of
1116 your other pam security modules.  On my RedHat system, this was the
1117 <TT
1118 CLASS="FILENAME"
1119 >/lib/security</TT
1120 > directory.</P
1121 ><P
1122 ><TT
1123 CLASS="PROMPT"
1124 >root#</TT
1125 > <B
1126 CLASS="COMMAND"
1127 >cp ../samba/source/nsswitch/pam_winbind.so /lib/security</B
1128 ></P
1129 ><P
1130 >The <TT
1131 CLASS="FILENAME"
1132 >/etc/pam.d/samba</TT
1133 > file does not need to be changed. I 
1134 just left this fileas it was:</P
1135 ><P
1136 ><PRE
1137 CLASS="PROGRAMLISTING"
1138 >auth    required        /lib/security/pam_stack.so service=system-auth
1139 account required        /lib/security/pam_stack.so service=system-auth</PRE
1140 ></P
1141 ><P
1142 >The other services that I modified to allow the use of winbind 
1143 as an authentication service were the normal login on the console (or a terminal 
1144 session), telnet logins, and ftp service.  In order to enable these 
1145 services, you may first need to change the entries in 
1146 <TT
1147 CLASS="FILENAME"
1148 >/etc/xinetd.d</TT
1149 > (or <TT
1150 CLASS="FILENAME"
1151 >/etc/inetd.conf</TT
1152 >).  
1153 RedHat 7.1 uses the new xinetd.d structure, in this case you need 
1154 to change the lines in <TT
1155 CLASS="FILENAME"
1156 >/etc/xinetd.d/telnet</TT
1157
1158 and <TT
1159 CLASS="FILENAME"
1160 >/etc/xinetd.d/wu-ftp</TT
1161 > from </P
1162 ><P
1163 ><PRE
1164 CLASS="PROGRAMLISTING"
1165 >enable = no</PRE
1166 ></P
1167 ><P
1168 >to</P
1169 ><P
1170 ><PRE
1171 CLASS="PROGRAMLISTING"
1172 >enable = yes</PRE
1173 ></P
1174 ><P
1175 >       
1176 For ftp services to work properly, you will also need to either 
1177 have individual directories for the domain users already present on 
1178 the server, or change the home directory template to a general
1179 directory for all domain users.  These can be easily set using 
1180 the <TT
1181 CLASS="FILENAME"
1182 >smb.conf</TT
1183 > global entry 
1184 <B
1185 CLASS="COMMAND"
1186 >template homedir</B
1187 >.</P
1188 ><P
1189 >The <TT
1190 CLASS="FILENAME"
1191 >/etc/pam.d/ftp</TT
1192 > file can be changed 
1193 to allow winbind ftp access in a manner similar to the
1194 samba file.  My <TT
1195 CLASS="FILENAME"
1196 >/etc/pam.d/ftp</TT
1197 > file was 
1198 changed to look like this:</P
1199 ><P
1200 ><PRE
1201 CLASS="PROGRAMLISTING"
1202 >auth       required     /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
1203 auth       sufficient   /lib/security/pam_winbind.so
1204 auth       required     /lib/security/pam_stack.so service=system-auth
1205 auth       required     /lib/security/pam_shells.so
1206 account    sufficient   /lib/security/pam_winbind.so
1207 account    required     /lib/security/pam_stack.so service=system-auth
1208 session    required     /lib/security/pam_stack.so service=system-auth</PRE
1209 ></P
1210 ><P
1211 >The <TT
1212 CLASS="FILENAME"
1213 >/etc/pam.d/login</TT
1214 > file can be changed nearly the 
1215 same way.  It now looks like this:</P
1216 ><P
1217 ><PRE
1218 CLASS="PROGRAMLISTING"
1219 >auth       required     /lib/security/pam_securetty.so
1220 auth       sufficient   /lib/security/pam_winbind.so
1221 auth       sufficient   /lib/security/pam_unix.so use_first_pass
1222 auth       required     /lib/security/pam_stack.so service=system-auth
1223 auth       required     /lib/security/pam_nologin.so
1224 account    sufficient   /lib/security/pam_winbind.so
1225 account    required     /lib/security/pam_stack.so service=system-auth
1226 password   required     /lib/security/pam_stack.so service=system-auth
1227 session    required     /lib/security/pam_stack.so service=system-auth
1228 session    optional     /lib/security/pam_console.so</PRE
1229 ></P
1230 ><P
1231 >In this case, I added the <B
1232 CLASS="COMMAND"
1233 >auth sufficient /lib/security/pam_winbind.so</B
1234
1235 lines as before, but also added the <B
1236 CLASS="COMMAND"
1237 >required pam_securetty.so</B
1238
1239 above it, to disallow root logins over the network.  I also added a 
1240 <B
1241 CLASS="COMMAND"
1242 >sufficient /lib/security/pam_unix.so use_first_pass</B
1243 >
1244 line after the <B
1245 CLASS="COMMAND"
1246 >winbind.so</B
1247 > line to get rid of annoying 
1248 double prompts for passwords.</P
1249 ></DIV
1250 ></DIV
1251 ></DIV
1252 ><DIV
1253 CLASS="SECT1"
1254 ><HR><H1
1255 CLASS="SECT1"
1256 ><A
1257 NAME="AEN290"
1258 >Limitations</A
1259 ></H1
1260 ><P
1261 >Winbind has a number of limitations in its current 
1262         released version that we hope to overcome in future 
1263         releases:</P
1264 ><P
1265 ></P
1266 ><UL
1267 ><LI
1268 ><P
1269 >Winbind is currently only available for 
1270                 the Linux operating system, although ports to other operating 
1271                 systems are certainly possible. For such ports to be feasible, 
1272                 we require the C library of the target operating system to 
1273                 support the Name Service Switch and Pluggable Authentication
1274                 Modules systems. This is becoming more common as NSS and 
1275                 PAM gain        support among UNIX vendors.</P
1276 ></LI
1277 ><LI
1278 ><P
1279 >The mappings of Windows NT RIDs to UNIX ids 
1280                 is not made algorithmically and depends on the order in which 
1281                 unmapped users or groups are seen by winbind. It may be difficult 
1282                 to recover the mappings of rid to UNIX id mapping if the file 
1283                 containing this information is corrupted or destroyed.</P
1284 ></LI
1285 ><LI
1286 ><P
1287 >Currently the winbind PAM module does not take 
1288                 into account possible workstation and logon time restrictions 
1289                 that may be been set for Windows NT users.</P
1290 ></LI
1291 ></UL
1292 ></DIV
1293 ><DIV
1294 CLASS="SECT1"
1295 ><HR><H1
1296 CLASS="SECT1"
1297 ><A
1298 NAME="AEN300"
1299 >Conclusion</A
1300 ></H1
1301 ><P
1302 >The winbind system, through the use of the Name Service 
1303         Switch, Pluggable Authentication Modules, and appropriate 
1304         Microsoft RPC calls have allowed us to provide seamless 
1305         integration of Microsoft Windows NT domain users on a
1306         UNIX system. The result is a great reduction in the administrative 
1307         cost of running a mixed UNIX and NT network.</P
1308 ></DIV
1309 ></DIV
1310 ></BODY
1311 ></HTML
1312 >