4 >SAMBA Project Documentation</TITLE
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.57"></HEAD
18 NAME="SAMBA-PROJECT-DOCUMENTATION"
25 NAME="SAMBA-PROJECT-DOCUMENTATION"
26 >SAMBA Project Documentation</A
41 >This book is a collection of HOWTOs added to Samba documentation over the years.
42 I try to ensure that all are current, but sometimes the is a larger job
43 than one person can maintain. The most recent version of this document
45 HREF="http://www.samba.org/"
47 >http://www.samba.org/</A
49 on the "Documentation" page. Please send updates to <A
50 HREF="mailto:jerry@samba.org"
66 >How to Install and Test SAMBA</A
73 >Step 0: Read the man pages</A
78 >Step 1: Building the Binaries</A
83 >Step 2: The all important step</A
88 >Step 3: Create the smb configuration file.</A
93 >Step 4: Test your config file with
102 >Step 5: Starting the smbd and nmbd</A
109 >Step 5a: Starting from inetd.conf</A
114 >Step 5b. Alternative: starting it as a daemon</A
121 >Step 6: Try listing the shares available on your
127 >Step 7: Try connecting with the unix client</A
132 >Step 8: Try connecting from a DOS, WfWg, Win9x, WinNT,
133 Win2k, OS/2, etc... client</A
138 >What If Things Don't Work?</A
145 >Diagnosing Problems</A
155 >Choosing the Protocol Level</A
160 >Printing from UNIX to a Client PC</A
170 >Mapping Usernames</A
175 >Other Character Sets</A
184 >Integrating MS Windows networks with Samba</A
196 >Name Resolution in a pure Unix/Linux world</A
213 >/etc/resolv.conf</TT
229 >/etc/nsswitch.conf</TT
237 >Name resolution as used within MS Windows networking</A
244 >The NetBIOS Name Cache</A
271 >How browsing functions and how to deploy stable and
272 dependable browsing using Samba</A
277 >MS Windows security options and how to configure
278 Samba for seemless integration</A
285 >Use MS Windows NT as an authentication server</A
290 >Make Samba a member of an MS Windows NT security domain</A
295 >Configure Samba as an authentication server</A
307 >MS Windows NT Machine Accounts</A
316 >Configuration of Samba as ...</A
323 >LanMan and NT Password Encryption in Samba 2.x</A
335 >How does it work?</A
340 >Important Notes About Security</A
347 >Advantages of SMB Encryption</A
352 >Advantages of non-encrypted passwords</A
360 NAME="SMBPASSWDFILEFORMAT"
362 >The smbpasswd file</A
367 >The smbpasswd Command</A
372 >Setting up Samba to support LanManager Encryption</A
379 >Hosting a Microsoft Distributed File System tree on Samba</A
402 >Printing Support in Samba 2.2.x</A
421 >Creating [print$]</A
426 >Setting Drivers for Existing Printers</A
431 >Support a large number of printers</A
436 >Adding New Printers via the Windows NT APW</A
441 >Samba and Printer Ports</A
448 >The Imprints Toolset</A
455 >What is Imprints?</A
460 >Creating Printer Driver Packages</A
465 >The Imprints server</A
470 >The Installation Client</A
480 >Migration to from Samba 2.0.x to 2.2.x</A
487 >security = domain in Samba 2.x</A
494 >Joining an NT Domain with Samba 2.2</A
499 >Samba and Windows 2000 Domains</A
504 >Why is this better than security = server?</A
511 >How to Configure Samba 2.2 as a Primary Domain Controller</A
518 >Prerequisite Reading</A
528 >Configuring the Samba Domain Controller</A
533 >Creating Machine Trust Accounts and Joining Clients
541 >Manually creating machine trust accounts</A
546 >Creating machine trust accounts "on the fly"</A
553 >Common Problems and Errors</A
558 >System Policies and Profiles</A
563 >What other help can I get ?</A
568 >Domain Control for Windows 9x/ME</A
575 >Configuration Instructions: Network Logons</A
580 >Configuration Instructions: Setting up Roaming User Profiles</A
587 >Windows NT Configuration</A
592 >Windows 9X Configuration</A
597 >Win9X and WinNT Configuration</A
602 >Windows 9X Profile Setup</A
607 >Windows NT Workstation 4.0</A
612 >Windows NT Server</A
617 >Sharing Profiles between W95 and NT Workstation 4.0</A
626 >DOMAIN_CONTROL.txt : Windows NT Domain Control & Samba</A
633 >Unifed Logons between Windows NT and UNIX using Winbind</A
650 >What Winbind Provides</A
664 >How Winbind Works</A
671 >Microsoft Remote Procedure Calls</A
676 >Name Service Switch</A
681 >Pluggable Authentication Modules</A
686 >User and Group ID Allocation</A
698 >Installation and Configuration</A
715 >UNIX Permission Bits and WIndows NT Access Control Lists</A
722 >Viewing and changing UNIX permissions using the NT
728 >How to view file security on a Samba share</A
733 >Viewing file ownership</A
738 >Viewing file or directory permissions</A
750 >Directory Permissions</A
757 >Modifying file or directory permissions</A
762 >Interaction with the standard Samba create mask
768 >Interaction with the standard Samba file attribute
790 >How can I configure OS/2 Warp Connect or
791 OS/2 Warp 4 as a client for Samba?</A
796 >How can I configure OS/2 Warp 3 (not Connect),
797 OS/2 1.2, 1.3 or 2.x for Samba?</A
802 >Are there any other issues when OS/2 (any version)
803 is used as a client?</A
808 >How do I get printer driver download working
818 >HOWTO Access Samba source code via CVS</A
830 >CVS Access to samba.org</A
837 >Access via CVSweb</A
855 >Chapter 1. How to Install and Test SAMBA</A
863 >1.1. Step 0: Read the man pages</A
866 >The man pages distributed with SAMBA contain
867 lots of useful info that will help to get you started.
868 If you don't know how to read man pages then try
877 >nroff -man smbd.8 | more
882 >Other sources of information are pointed to
883 by the Samba web site,<A
884 HREF="http://www.samba.org/"
886 > http://www.samba.org</A
895 >1.2. Step 1: Building the Binaries</A
898 >To do this, first run the program <B
902 > in the source directory. This should automatically
903 configure Samba for your operating system. If you have unusual
904 needs then you may wish to run</P
917 >first to see what special options you can enable.
930 >will create the binaries. Once it's successfully
931 compiled you can use </P
943 >to install the binaries and manual pages. You can
944 separately install the binaries and/or man pages using</P
970 >Note that if you are upgrading for a previous version
971 of Samba you might like to know that the old versions of
972 the binaries will be renamed with a ".old" extension. You
973 can go back to the previous version with</P
986 >if you find this version a disaster!</P
994 >1.3. Step 2: The all important step</A
997 >At this stage you must fetch yourself a
998 coffee or other drink you find stimulating. Getting the rest
999 of the install right can sometimes be tricky, so you will
1000 probably need it.</P
1002 >If you have installed samba before then you can skip
1011 >1.4. Step 3: Create the smb configuration file.</A
1014 >There are sample configuration files in the examples
1015 subdirectory in the distribution. I suggest you read them
1016 carefully so you can see how the options go together in
1017 practice. See the man page for all the options.</P
1019 >The simplest useful configuration file would be
1020 something like this:</P
1029 CLASS="PROGRAMLISTING"
1042 >which would allow connections by anyone with an
1043 account on the server, using either their login name or
1044 "homes" as the service name. (Note that I also set the
1045 workgroup that Samba is part of. See BROWSING.txt for defails)</P
1054 > file. You need to create it
1057 >Make sure you put the smb.conf file in the same place
1058 you specified in the<TT
1061 > (the default is to
1064 >/usr/local/samba/lib/</TT
1067 >For more information about security settings for the
1068 [homes] share please refer to the document UNIX_SECURITY.txt.</P
1076 >1.5. Step 4: Test your config file with
1083 >It's important that you test the validity of your
1087 > file using the testparm program.
1088 If testparm runs OK then it will list the loaded services. If
1089 not it will give an error message.</P
1091 >Make sure it runs OK and that the services look
1092 resonable before proceeding. </P
1100 >1.6. Step 5: Starting the smbd and nmbd</A
1103 >You must choose to start smbd and nmbd either
1104 as daemons or from <B
1108 to do both! Either you can put them in <TT
1111 > and have them started on demand
1115 >, or you can start them as
1116 daemons either from the command line or in <TT
1119 >. See the man pages for details
1120 on the command line options. Take particular care to read
1121 the bit about what user you need to be in order to start
1122 Samba. In many cases you must be root.</P
1124 >The main advantage of starting <B
1131 > as a daemon is that they will
1132 respond slightly more quickly to an initial connection
1133 request. This is, however, unlikely to be a problem.</P
1140 >1.6.1. Step 5a: Starting from inetd.conf</A
1143 >NOTE; The following will be different if
1144 you use NIS or NIS+ to distributed services maps.</P
1150 What is defined at port 139/tcp. If nothing is defined
1151 then add a line like this:</P
1156 >netbios-ssn 139/tcp</B
1160 >similarly for 137/udp you should have an entry like:</P
1165 >netbios-ns 137/udp</B
1171 >/etc/inetd.conf</TT
1173 and add two lines something like this:</P
1182 CLASS="PROGRAMLISTING"
1183 > netbios-ssn stream tcp nowait root /usr/local/samba/bin/smbd smbd
1184 netbios-ns dgram udp wait root /usr/local/samba/bin/nmbd nmbd
1191 >The exact syntax of <TT
1193 >/etc/inetd.conf</TT
1195 varies between unixes. Look at the other entries in inetd.conf
1198 >NOTE: Some unixes already have entries like netbios_ns
1199 (note the underscore) in <TT
1203 You must either edit <TT
1209 >/etc/inetd.conf</TT
1210 > to make them consistant.</P
1212 >NOTE: On many systems you may need to use the
1213 "interfaces" option in smb.conf to specify the IP address
1214 and netmask of your interfaces. Run <B
1218 as root if you don't know what the broadcast is for your
1222 > tries to determine it at run
1223 time, but fails on somunixes. See the section on "testing nmbd"
1224 for a method of finding if you need to do this.</P
1226 >!!!WARNING!!! Many unixes only accept around 5
1227 parameters on the command line in <TT
1231 This means you shouldn't use spaces between the options and
1232 arguments, or you should use a script, and start the script
1241 >, perhaps just send
1242 it a HUP. If you have installed an earlier version of <B
1245 > then you may need to kill nmbd as well.</P
1253 >1.6.2. Step 5b. Alternative: starting it as a daemon</A
1256 >To start the server as a daemon you should create
1257 a script something like this one, perhaps calling
1270 CLASS="PROGRAMLISTING"
1272 /usr/local/samba/bin/smbd -D
1273 /usr/local/samba/bin/nmbd -D
1280 >then make it executable with <B
1286 >You can then run <B
1290 hand or execute it from <TT
1296 >To kill it send a kill signal to the processes
1305 >NOTE: If you use the SVR4 style init system then
1306 you may like to look at the <TT
1308 >examples/svr4-startup</TT
1310 script to make Samba fit into that system.</P
1319 >1.7. Step 6: Try listing the shares available on your
1339 >Your should get back a list of shares available on
1340 your server. If you don't then something is incorrectly setup.
1341 Note that this method can also be used to see what shares
1342 are available on other LanManager clients (such as WfWg).</P
1344 >If you choose user level security then you may find
1345 that Samba requests a password before it will list the shares.
1349 > man page for details. (you
1350 can force it to list the shares without a password by
1351 adding the option -U% to the command line. This will not work
1352 with non-Samba servers)</P
1360 >1.8. Step 7: Try connecting with the unix client</A
1372 > //yourhostname/aservice</I
1384 would be the name of the host where you installed <B
1393 any service you have defined in the <TT
1397 file. Try your user name if you just have a [homes] section
1403 >For example if your unix host is bambi and your login
1404 name is fred you would type:</P
1412 >smbclient //bambi/fred
1423 >1.9. Step 8: Try connecting from a DOS, WfWg, Win9x, WinNT,
1424 Win2k, OS/2, etc... client</A
1427 >Try mounting disks. eg:</P
1431 >C:\WINDOWS\> </TT
1435 >net use d: \\servername\service
1440 >Try printing. eg:</P
1444 >C:\WINDOWS\> </TT
1449 \\servername\spoolservice</B
1455 >C:\WINDOWS\> </TT
1464 >Celebrate, or send me a bug report!</P
1472 >1.10. What If Things Don't Work?</A
1475 >If nothing works and you start to think "who wrote
1476 this pile of trash" then I suggest you do step 2 again (and
1477 again) till you calm down.</P
1479 >Then you might read the file DIAGNOSIS.txt and the
1480 FAQ. If you are still stuck then try the mailing list or
1481 newsgroup (look in the README for details). Samba has been
1482 successfully installed at thousands of sites worldwide, so maybe
1483 someone else has hit your problem and has overcome it. You could
1484 also use the WWW site to scan back issues of the samba-digest.</P
1486 >When you fix the problem PLEASE send me some updates to the
1487 documentation (or source code) so that the next person will find it
1495 >1.10.1. Diagnosing Problems</A
1498 >If you have instalation problems then go to
1502 > to try to find the
1511 >1.10.2. Scope IDs</A
1514 >By default Samba uses a blank scope ID. This means
1515 all your windows boxes must also have a blank scope ID.
1516 If you really want to use a non-blank scope ID then you will
1517 need to use the -i <scope> option to nmbd, smbd, and
1518 smbclient. All your PCs will need to have the same setting for
1519 this to work. I do not recommend scope IDs.</P
1527 >1.10.3. Choosing the Protocol Level</A
1530 >The SMB protocol has many dialects. Currently
1531 Samba supports 5, called CORE, COREPLUS, LANMAN1,
1534 >You can choose what maximum protocol to support
1538 > file. The default is
1539 NT1 and that is the best for the vast majority of sites.</P
1541 >In older versions of Samba you may have found it
1542 necessary to use COREPLUS. The limitations that led to
1543 this have mostly been fixed. It is now less likely that you
1544 will want to use less than LANMAN1. The only remaining advantage
1545 of COREPLUS is that for some obscure reason WfWg preserves
1546 the case of passwords in this protocol, whereas under LANMAN1,
1547 LANMAN2 or NT1 it uppercases all passwords before sending them,
1548 forcing you to use the "password level=" option in some cases.</P
1550 >The main advantage of LANMAN2 and NT1 is support for
1551 long filenames with some clients (eg: smbclient, Windows NT
1554 >See the smb.conf(5) manual page for more details.</P
1556 >Note: To support print queue reporting you may find
1557 that you have to use TCP/IP as the default protocol under
1558 WfWg. For some reason if you leave Netbeui as the default
1559 it may break the print queue reporting on some systems.
1560 It is presumably a WfWg bug.</P
1568 >1.10.4. Printing from UNIX to a Client PC</A
1571 >To use a printer that is available via a smb-based
1572 server from a unix host you will need to compile the
1573 smbclient program. You then need to install the script
1574 "smbprint". Read the instruction in smbprint for more details.
1577 >There is also a SYSV style script that does much
1578 the same thing called smbprint.sysv. It contains instructions.</P
1589 >One area which sometimes causes trouble is locking.</P
1591 >There are two types of locking which need to be
1592 performed by a SMB server. The first is "record locking"
1593 which allows a client to lock a range of bytes in a open file.
1594 The second is the "deny modes" that are specified when a file
1597 >Samba supports "record locking" using the fcntl() unix system
1598 call. This is often implemented using rpc calls to a rpc.lockd process
1599 running on the system that owns the filesystem. Unfortunately many
1600 rpc.lockd implementations are very buggy, particularly when made to
1601 talk to versions from other vendors. It is not uncommon for the
1602 rpc.lockd to crash.</P
1604 >There is also a problem translating the 32 bit lock
1605 requests generated by PC clients to 31 bit requests supported
1606 by most unixes. Unfortunately many PC applications (typically
1607 OLE2 applications) use byte ranges with the top bit set
1608 as semaphore sets. Samba attempts translation to support
1609 these types of applications, and the translation has proved
1610 to be quite successful.</P
1612 >Strictly a SMB server should check for locks before
1613 every read and write call on a file. Unfortunately with the
1614 way fcntl() works this can be slow and may overstress the
1615 rpc.lockd. It is also almost always unnecessary as clients
1616 are supposed to independently make locking calls before reads
1617 and writes anyway if locking is important to them. By default
1618 Samba only makes locking calls when explicitly asked
1619 to by a client, but if you set "strict locking = yes" then it will
1620 make lock checking calls on every read and write. </P
1622 >You can also disable by range locking completely
1623 using "locking = no". This is useful for those shares that
1624 don't support locking or don't need it (such as cdroms). In
1625 this case Samba fakes the return codes of locking calls to
1626 tell clients that everything is OK.</P
1628 >The second class of locking is the "deny modes". These
1629 are set by an application when it opens a file to determine
1630 what types of access should be allowed simultaneously with
1631 its open. A client may ask for DENY_NONE, DENY_READ, DENY_WRITE
1632 or DENY_ALL. There are also special compatability modes called
1633 DENY_FCB and DENY_DOS.</P
1635 >You can disable share modes using "share modes = no".
1636 This may be useful on a heavily loaded server as the share
1637 modes code is very slow. See also the FAST_SHARE_MODES
1638 option in the Makefile for a way to do full share modes
1639 very fast using shared memory (if your OS supports it).</P
1647 >1.10.6. Mapping Usernames</A
1650 >If you have different usernames on the PCs and
1651 the unix server then take a look at the "username map" option.
1652 See the smb.conf man page for details.</P
1660 >1.10.7. Other Character Sets</A
1663 >If you have problems using filenames with accented
1664 characters in them (like the German, French or Scandinavian
1665 character sets) then I recommmend you look at the "valid chars"
1666 option in smb.conf and also take a look at the validchars
1667 package in the examples directory.</P
1676 >Chapter 2. Integrating MS Windows networks with Samba</A
1687 >To identify the key functional mechanisms of MS Windows networking
1688 to enable the deployment of Samba as a means of extending and/or
1689 replacing MS Windows NT/2000 technology.</P
1691 >We will examine:</P
1698 >Name resolution in a pure Unix/Linux TCP/IP
1704 >Name resolution as used within MS Windows
1710 >How browsing functions and how to deploy stable
1711 and dependable browsing using Samba
1716 >MS Windows security options and how to
1717 configure Samba for seemless integration
1722 >Configuration of Samba as:</P
1729 >A stand-alone server</P
1733 >An MS Windows NT 3.x/4.0 security domain member
1738 >An alternative to an MS Windows NT 3.x/4.0 Domain Controller
1751 >2.2. Name Resolution in a pure Unix/Linux world</A
1754 >The key configuration files : </P
1767 >Contains a static list of IP Addresses and names.
1777 CLASS="PROGRAMLISTING"
1778 > 127.0.0.1 localhost localhost.localdomain
1779 192.168.1.1 bigbox.caldera.com bigbox alias4box</PRE
1789 name resolution mechanism so that uses do not need to remember
1792 >Network packets that are sent over the physical network transport
1793 layer communicate not via IP addresses but rather using the Media
1794 Access Control address, or MAC address. IP Addresses are currently
1795 32 bits in length and are typically presented as four (4) decimal
1796 numbers that are separated by a dot (or period). eg: 168.192.1.1</P
1798 >MAC Addresses use 48 bits (or 6 bytes) and are typically represented
1799 as two digit hexadecimal numbers separated by colons. eg:
1800 40:8e:0a:12:34:56</P
1802 >Every network interfrace must have an MAC address. Associated with
1803 a MAC address there may be one or more IP addresses. There is NO
1804 relationship between an IP address and a MAC address, all such assignments
1805 are arbitary or discretionary in nature. At the most basic level all
1806 network communications takes place using MAC addressing. Since MAC
1807 addresses must be globally unique, and generally remains fixed for
1808 any particular interface, the assignment of an IP address makes sense
1809 from a network management perspective. More than one IP address can
1810 be assigned per MAC address. One address must be the primary IP address,
1811 this is the address that will be returned in the ARP reply.</P
1813 >When a user or a process wants to communicate with another machine
1814 the protocol implementation ensures that the "machine name" or "host
1815 name" is resolved to an IP address in a manner that is controlled
1816 by the TCP/IP configuration control files. The file
1820 > is one such file.</P
1822 >When the IP address of the destination interface has been
1823 determined a protocol called ARP/RARP isused to identify
1824 the MAC address of the target interface. ARP stands for Address
1825 Resolution Protocol, and is a broadcast oriented method that
1826 uses UDP (User Datagram Protocol) to send a request to all
1827 interfaces on the local network segment using the all 1's MAC
1828 address. Network interfaces are programmed to respond to two
1829 MAC addresses only; their own unique address and the address
1830 ff:ff:ff:ff:ff:ff. The reply packet from an ARP request will
1831 contain the MAC address and the primary IP address for each
1837 > file is foundational to all
1838 Unix/Linux TCP/IP installations and as a minumum will contain
1839 the localhost and local network interface IP addresses and the
1840 primary names by which they are known within the local machine.
1841 This file helps to prime the pump so that a basic level of name
1842 resolution can exist before any other method of name resolution
1843 becomes available.</P
1853 >/etc/resolv.conf</TT
1857 >This file tells the name resolution libraries:</P
1863 >The name of the domain to which the machine
1869 >The name(s) of any domains that should be
1870 automatically searched when trying to resolve unqualified
1871 host names to their IP address
1876 >The name or IP address of available Domain
1877 Name Servers that may be asked to perform name to address
1898 > is the primary means by
1899 which the setting in /etc/resolv.conf may be affected. It is a
1900 critical configuration file. This file controls the order by
1901 which name resolution may procede. The typical structure is:</P
1910 CLASS="PROGRAMLISTING"
1918 >then both addresses should be returned. Please refer to the
1919 man page for host.conf for further details.</P
1929 >/etc/nsswitch.conf</TT
1933 >This file controls the actual name resolution targets. The
1934 file typically has resolver object specifications as follows:</P
1943 CLASS="PROGRAMLISTING"
1944 > # /etc/nsswitch.conf
1946 # Name Service Switch configuration file.
1950 # Alternative entries for password authentication are:
1951 # passwd: compat files nis ldap winbind
1955 hosts: files nis dns
1956 # Alternative entries for host name resolution are:
1957 # hosts: files dns nis nis+ hesoid db compat ldap wins
1958 networks: nis files dns
1961 protocols: nis files
1963 services: nis files</PRE
1969 >Of course, each of these mechanisms requires that the appropriate
1970 facilities and/or services are correctly configured.</P
1972 >It should be noted that unless a network request/message must be
1973 sent, TCP/IP networks are silent. All TCP/IP communications assumes a
1974 principal of speaking only when necessary.</P
1976 >Samba version 2.2.0 will add Linux support for extensions to
1977 the name service switch infrastructure so that linux clients will
1978 be able to obtain resolution of MS Windows NetBIOS names to IP
1979 Addresses. To gain this functionality Samba needs to be compiled
1980 with appropriate arguments to the make command (ie: <B
1983 nsswitch/libnss_wins.so</B
1984 >). The resulting library should
1985 then be installed in the <TT
1989 the "wins" parameter needs to be added to the "hosts:" line in
1992 >/etc/nsswitch.conf</TT
1993 > file. At this point it
1994 will be possible to ping any MS Windows machine by it's NetBIOS
1995 machine name, so long as that machine is within the workgroup to
1996 which both the samba machine and the MS Windows machine belong.</P
2005 >2.3. Name resolution as used within MS Windows networking</A
2008 >MS Windows networking is predicated about the name each machine
2009 is given. This name is known variously (and inconsistently) as
2010 the "computer name", "machine name", "networking name", "netbios name",
2011 "SMB name". All terms mean the same thing with the exception of
2012 "netbios name" which can apply also to the name of the workgroup or the
2013 domain name. The terms "workgroup" and "domain" are really just a
2014 simply name with which the machine is associated. All NetBIOS names
2015 are exactly 16 characters in length. The 16th character is reserved.
2016 It is used to store a one byte value that indicates service level
2017 information for the NetBIOS name that is registered. A NetBIOS machine
2018 name is therefore registered for each service type that is provided by
2019 the client/server.</P
2021 >The following are typical NetBIOS name/service type registrations:</P
2030 CLASS="PROGRAMLISTING"
2031 > Unique NetBIOS Names:
2032 MACHINENAME<00> = Server Service is running on MACHINENAME
2033 MACHINENAME<03> = Generic Machine Name (NetBIOS name)
2034 MACHINENAME<20> = LanMan Server service is running on MACHINENAME
2035 WORKGROUP<1b> = Domain Master Browser
2038 WORKGROUP<03> = Generic Name registered by all members of WORKGROUP
2039 WORKGROUP<1c> = Domain Controllers / Netlogon Servers
2040 WORKGROUP<1d> = Local Master Browsers
2041 WORKGROUP<1e> = Internet Name Resolvers</PRE
2047 >It should be noted that all NetBIOS machines register their own
2048 names as per the above. This is in vast contrast to TCP/IP
2049 installations where traditionally the system administrator will
2050 determine in the /etc/hosts or in the DNS database what names
2051 are associated with each IP address.</P
2053 >One further point of clarification should be noted, the <TT
2057 file and the DNS records do not provide the NetBIOS name type information
2058 that MS Windows clients depend on to locate the type of service that may
2059 be needed. An example of this is what happens when an MS Windows client
2060 wants to locate a domain logon server. It find this service and the IP
2061 address of a server that provides it by performing a lookup (via a
2062 NetBIOS broadcast) for enumeration of all machines that have
2063 registered the name type *<1c>. A logon request is then sent to each
2064 IP address that is returned in the enumerated list of IP addresses. Which
2065 ever machine first replies then ends up providing the logon services.</P
2067 >The name "workgroup" or "domain" really can be confusing since these
2068 have the added significance of indicating what is the security
2069 architecture of the MS Windows network. The term "workgroup" indicates
2070 that the primary nature of the network environment is that of a
2071 peer-to-peer design. In a WORKGROUP all machines are responsible for
2072 their own security, and generally such security is limited to use of
2073 just a password (known as SHARE MORE security). In most situations
2074 with peer-to-peer networking the users who control their own machines
2075 will simply opt to have no security at all. It is possible to have
2076 USER MODE security in a WORKGROUP environment, thus requiring use
2077 of a user name and a matching password.</P
2079 >MS Windows networking is thus predetermined to use machine names
2080 for all local and remote machine message passing. The protocol used is
2081 called Server Message Block (SMB) and this is implemented using
2082 the NetBIOS protocol (Network Basic Input Output System). NetBIOS can
2083 be encapsulated using LLC (Logical Link Control) protocol - in which case
2084 the resulting protocol is called NetBEUI (Network Basic Extended User
2085 Interface). NetBIOS can also be run over IPX (Internetworking Packet
2086 Exchange) protocol as used by Novell NetWare, and it can be run
2087 over TCP/IP protocols - in which case the resulting protocol is called
2088 NBT or NetBT, the NetBIOS over TCP/IP.</P
2090 >MS Windows machines use a complex array of name resolution mechanisms.
2091 Since we are primarily concerned with TCP/IP this demonstration is
2092 limited to this area.</P
2099 >2.3.1. The NetBIOS Name Cache</A
2102 >All MS Windows machines employ an in memory buffer in which is
2103 stored the NetBIOS names and their IP addresses for all external
2104 machines that that the local machine has communicated with over the
2105 past 10-15 minutes. It is more efficient to obtain an IP address
2106 for a machine from the local cache than it is to go through all the
2107 configured name resolution mechanisms.</P
2109 >If a machine whose name is in the local name cache has been shut
2110 down before the name had been expired and flushed from the cache, then
2111 an attempt to exchange a message with that machine will be subject
2112 to time-out delays. ie: It's name is in the cache, so a name resolution
2113 lookup will succeed, but the machine can not respond. This can be
2114 frustrating for users - but it is a characteristic of the protocol.</P
2116 >The MS Windows utility that allows examination of the NetBIOS
2117 name cache is called "nbtstat". The Samba equivalent of this
2118 is called "nmblookup".</P
2126 >2.3.2. The LMHOSTS file</A
2129 >This file is usually located in MS Windows NT 4.0 or
2132 >C:\WINNT\SYSTEM32\DRIVERS\ETC</TT
2134 the IP Address and the machine name in matched pairs. The
2138 > file performs NetBIOS name
2139 to IP address mapping oriented.</P
2141 >It typically looks like:</P
2150 CLASS="PROGRAMLISTING"
2151 > # Copyright (c) 1998 Microsoft Corp.
2153 # This is a sample LMHOSTS file used by the Microsoft Wins Client (NetBIOS
2154 # over TCP/IP) stack for Windows98
2156 # This file contains the mappings of IP addresses to NT computernames
2157 # (NetBIOS) names. Each entry should be kept on an individual line.
2158 # The IP address should be placed in the first column followed by the
2159 # corresponding computername. The address and the comptername
2160 # should be separated by at least one space or tab. The "#" character
2161 # is generally used to denote the start of a comment (see the exceptions
2164 # This file is compatible with Microsoft LAN Manager 2.x TCP/IP lmhosts
2165 # files and offers the following extensions:
2168 # #DOM:<domain>
2169 # #INCLUDE <filename>
2172 # \0xnn (non-printing character support)
2174 # Following any entry in the file with the characters "#PRE" will cause
2175 # the entry to be preloaded into the name cache. By default, entries are
2176 # not preloaded, but are parsed only after dynamic name resolution fails.
2178 # Following an entry with the "#DOM:<domain>" tag will associate the
2179 # entry with the domain specified by <domain>. This affects how the
2180 # browser and logon services behave in TCP/IP environments. To preload
2181 # the host name associated with #DOM entry, it is necessary to also add a
2182 # #PRE to the line. The <domain> is always preloaded although it will not
2183 # be shown when the name cache is viewed.
2185 # Specifying "#INCLUDE <filename>" will force the RFC NetBIOS (NBT)
2186 # software to seek the specified <filename> and parse it as if it were
2187 # local. <filename> is generally a UNC-based name, allowing a
2188 # centralized lmhosts file to be maintained on a server.
2189 # It is ALWAYS necessary to provide a mapping for the IP address of the
2190 # server prior to the #INCLUDE. This mapping must use the #PRE directive.
2191 # In addtion the share "public" in the example below must be in the
2192 # LanManServer list of "NullSessionShares" in order for client machines to
2193 # be able to read the lmhosts file successfully. This key is under
2194 # \machine\system\currentcontrolset\services\lanmanserver\parameters\nullsessionshares
2195 # in the registry. Simply add "public" to the list found there.
2197 # The #BEGIN_ and #END_ALTERNATE keywords allow multiple #INCLUDE
2198 # statements to be grouped together. Any single successful include
2199 # will cause the group to succeed.
2201 # Finally, non-printing characters can be embedded in mappings by
2202 # first surrounding the NetBIOS name in quotations, then using the
2203 # \0xnn notation to specify a hex value for a non-printing character.
2205 # The following example illustrates all of these extensions:
2207 # 102.54.94.97 rhino #PRE #DOM:networking #net group's DC
2208 # 102.54.94.102 "appname \0x14" #special app server
2209 # 102.54.94.123 popular #PRE #source server
2210 # 102.54.94.117 localsrv #PRE #needed for the include
2213 # #INCLUDE \\localsrv\public\lmhosts
2214 # #INCLUDE \\rhino\public\lmhosts
2217 # In the above example, the "appname" server contains a special
2218 # character in its name, the "popular" and "localsrv" server names are
2219 # preloaded, and the "rhino" server name is specified so it can be used
2220 # to later #INCLUDE a centrally maintained lmhosts file if the "localsrv"
2221 # system is unavailable.
2223 # Note that the whole file is parsed including comments on each lookup,
2224 # so keeping the number of comments to a minimum will improve performance.
2225 # Therefore it is not advisable to simply add lmhosts file entries onto the
2226 # end of this file.</PRE
2238 >2.3.3. HOSTS file</A
2241 >This file is usually located in MS Windows NT 4.0 or 2000 in
2244 >C:\WINNT\SYSTEM32\DRIVERS\ETC</TT
2246 the IP Address and the IP hostname in matched pairs. It can be
2247 used by the name resolution infrastructure in MS Windows, depending
2248 on how the TCP/IP environment is configured. This file is in
2249 every way the equivalent of the Unix/Linux <TT
2260 >2.3.4. DNS Lookup</A
2263 >This capability is configured in the TCP/IP setup area in the network
2264 configuration facility. If enabled an elaborate name resolution sequence
2265 is followed the precise nature of which isdependant on what the NetBIOS
2266 Node Type parameter is configured to. A Node Type of 0 means use
2267 NetBIOS broadcast (over UDP broadcast) is first used if the name
2268 that is the subject of a name lookup is not found in the NetBIOS name
2269 cache. If that fails then DNS, HOSTS and LMHOSTS are checked. If set to
2270 Node Type 8, then a NetBIOS Unicast (over UDP Unicast) is sent to the
2271 WINS Server to obtain a lookup before DNS, HOSTS, LMHOSTS, or broadcast
2280 >2.3.5. WINS Lookup</A
2283 >Refer to above details for section <EM
2286 WINS (Windows Internet Name Server) service is the equivaent of the
2287 rfc1001/1002 specified NBNS (NetBIOS Name Server). A WINS server stores
2288 the names and IP addresses that are registered by a Windows client
2289 if the TCP/IP setup has been given at least one WINS Server IP Address.</P
2291 >To configure Samba to be a WINS server the following parameter needs
2292 to be added to the <TT
2304 CLASS="PROGRAMLISTING"
2305 > wins support = Yes</PRE
2311 >To configure Samba to use a WINS server the following parameters are
2312 needed in the smb.conf file:</P
2321 CLASS="PROGRAMLISTING"
2340 of the WINS server.</P
2349 >2.4. How browsing functions and how to deploy stable and
2350 dependable browsing using Samba</A
2353 >As stated above, MS Windows machines register their NetBIOS names
2354 (ie: the machine name for each service type in operation) on start
2355 up. Also, as stated above, the exact method by which this name registration
2356 takes place is determined by whether or not the MS Windows client/server
2357 has been given a WINS server address, whether or not LMHOSTS lookup
2358 is enabled, or if DNS for NetBIOS name resolution is enabled, etc.</P
2360 >In the case where there is no WINS server all name registrations as
2361 well as name lookups are done by UDP broadcast. This isolates name
2362 resolution to the local subnet, unless LMHOSTS is used to list all
2363 names and IP addresses. In such situations Samba provides a means by
2364 which the samba server name may be forcibly injected into the browse
2365 list of a remote MS Windows network (using the "remote announce" parameter).</P
2367 >Where a WINS server is used, the MS Windows client will use UDP
2368 unicast to register with the WINS server. Such packets can be routed
2369 and thus WINS allows name resolution to function across routed networks.</P
2371 >During the startup process an election will take place to create a
2372 local master browser if one does not already exist. On each NetBIOS network
2373 one machine will be elected to function as the domain master browser. This
2374 domain browsing has nothing to do with MS security domain control.
2375 Instead, the domain master browser serves the role of contacting each local
2376 master browser (found by asking WINS or from LMHOSTS) and exchanging browse
2377 list contents. This way every master browser will eventually obtain a complete
2378 list of all machines that are on the network. Every 11-15 minutes an election
2379 is held to determine which machine will be the master browser. By nature of
2380 the election criteria used, the machine with the highest uptime, or the
2381 most senior protocol version, or other criteria, will win the election
2382 as domain master browser.</P
2384 >Clients wishing to browse the network make use of this list, but also depend
2385 on the availability of correct name resolution to the respective IP
2386 address/addresses. </P
2388 >Any configuration that breaks name resolution and/or browsing intrinsics
2389 will annoy users because they will have to put up with protracted
2390 inability to use the network services.</P
2392 >Samba supports a feature that allows forced synchonisation
2393 of browse lists across routed networks using the "remote
2394 browse sync" parameter in the smb.conf file. This causes Samba
2395 to contact the local master browser on a remote network and
2396 to request browse list synchronisation. This effectively bridges
2397 two networks that are separated by routers. The two remote
2398 networks may use either broadcast based name resolution or WINS
2399 based name resolution, but it should be noted that the "remote
2400 browse sync" parameter provides browse list synchronisation - and
2401 that is distinct from name to address resolution, in other
2402 words, for cross subnet browsing to function correctly it is
2403 essential that a name to address resolution mechanism be provided.
2404 This mechanism could be via DNS, <TT
2416 >2.5. MS Windows security options and how to configure
2417 Samba for seemless integration</A
2420 >MS Windows clients may use encrypted passwords alone, or encrypted
2421 as well as plain text passwords in the authentication process. It
2422 should be realized that with the SMB protocol the password is passed
2423 over the network either in plain text or encrypted. When encrypted
2424 passwords are used a password that has been entered by the user is
2425 encrypted in two ways:</P
2431 >The case preserved password is encrypted
2432 using an MD5/DES one way hash
2437 >The case is converted to upper case and then
2438 encrypted using an MD5/DES one way hash</P
2442 >Both of these enrypted passwords are sent over the network
2443 in the one authentication datagram.</P
2445 >MS Windows 95 pre-service pack 1, MS Windows NT versions 3.x
2446 and version 4.0 pre-service pack 3 will use either mode of
2447 password authentication. All versions of MS Windows that follow
2448 these versions no longer support plain text passwords by default.</P
2450 >MS Windows clients have a habit of dropping network mappings that
2451 have been idle for 10 minutes or longer. When the user attempts to
2452 use the mapped drive connection that has been dropped the SMB protocol
2453 has a mechanism by which the connection can be re-established using
2454 a cached copy of the password.</P
2456 >When Microsoft changed the default password mode, they dropped support for
2457 caching of the plain text password. This means that when the registry
2458 parameter is changed to re-enable use of plain text passwords it appears to
2459 work, but when a dropped mapping attempts to revalidate it will fail if
2460 the remote authentication server does not support encrypted passwords.
2461 This means that it is definitely not a good idea to re-enable plain text
2462 password support in such clients.</P
2464 >It is recommended that the following parameters be added to the
2474 CLASS="PROGRAMLISTING"
2475 > passsword level = 8
2476 username level = 8</PRE
2482 >these configuration parameters will compensate for the fact that
2483 in some circumstances MS Windows and MS DOS clients may twiddle the
2484 password that has been supplied by the user by converting characters to
2485 upper case. The above entries will try every combination of upper and
2486 lower case for the first 8 characters. Please refer to the man page
2487 for smb.conf for more information on use of these parameters.</P
2489 >The best option to adopt is to enable support for encrypted passwords
2490 where ever Samba is used. There are three configuration possibilities
2491 for support of encrypted passwords:</P
2498 >2.5.1. Use MS Windows NT as an authentication server</A
2501 >This method involves the additions of the following parameters
2502 in the smb.conf file:</P
2511 CLASS="PROGRAMLISTING"
2512 > encrypt passwords = Yes
2514 password server = "NetBIOS_name_of_PDC"</PRE
2520 >There are two ways of identifying whether or not a username and
2521 password pair was valid or not. One uses the reply information provided
2522 as part of the authentication messaging process, the other uses
2523 just and error code.</P
2525 >The down-side of this mode of configuration is the fact that
2526 for security reasons Samba will send the password server a bogus
2527 username and a bogus password and if the remote server fails to
2528 reject the username and password pair then an alternative mode
2529 of identification of validation is used. Where a site uses password
2530 lock out after a certain number of failed authentication attempts
2531 this will result in user lockouts.</P
2533 >Use of this mode of authentication does require there to be
2534 a standard Unix account for the user, this account can be blocked
2535 to prevent logons by other than MS Windows clients.</P
2543 >2.5.2. Make Samba a member of an MS Windows NT security domain</A
2546 >This method involves additon of the following paramters in the smb.conf file:</P
2555 CLASS="PROGRAMLISTING"
2556 > encrypt passwords = Yes
2558 workgroup = "name of NT domain"
2559 password server = *</PRE
2565 >The use of the "*" argument to "password server" will cause samba
2566 to locate the domain controller in a way analogous to the way
2567 this is done within MS Windows NT.</P
2569 >In order for this method to work the Samba server needs to join the
2570 MS Windows NT security domain. This is done as follows:</P
2576 >On the MS Windows NT domain controller using
2577 the Server Manager add a machine account for the Samba server.
2582 >Next, on the Linux system execute:
2585 >smbpasswd -r PDC_NAME -j DOMAIN_NAME</B
2591 >Use of this mode of authentication does require there to be
2592 a standard Unix account for the user, this account can be
2593 blocked to prevent logons by other than MS Windows clients.</P
2601 >2.5.3. Configure Samba as an authentication server</A
2604 >This mode of authentication demands that there be on the
2605 Unix/Linux system both a Unix style account as well as and
2606 smbpasswd entry for the user. The Unix system account can be
2607 locked if required as only the encrypted password will be
2608 used for SMB client authentication.</P
2610 >This method involves addition of the following parameters to
2611 the smb.conf file:</P
2620 CLASS="PROGRAMLISTING"
2621 > encrypt passwords = Yes
2622 security = user</PRE
2628 >in order for this method to work a Unix system account needs
2629 to be created for each user, as well as for each MS Windows NT/2000
2630 machine. The following structure is required.</P
2640 >A user account that may provide a home directory should be
2641 created. The following Linux system commands are typical of
2642 the procedure for creating an account.</P
2651 CLASS="PROGRAMLISTING"
2652 > # useradd -s /bin/bash -d /home/"userid" -m
2661 # smbpasswd -a "userid"
2679 >2.5.3.2. MS Windows NT Machine Accounts</A
2682 >These are required only when Samba is used as a domain
2683 controller. Refer to the Samba-PDC-HOWTO for more details.</P
2692 CLASS="PROGRAMLISTING"
2693 > # useradd -a /bin/false -d /dev/null "machine_name"\$
2694 # passwd -l "machine_name"\$
2695 # smbpasswd -a -m "machine_name"</PRE
2709 >2.6. Configuration of Samba as ...</A
2716 >A Stand-alone server - No special action is needed
2717 other than to create user accounts. Stand-alone servers do NOT
2718 provide network logon services, meaning that machines that use this
2719 server do NOT perform a domain logon but instead make use only of
2720 the MS Windows logon which is local to the MS Windows
2726 >An MS Windows NT 3.x/4.0 security domain member -
2727 Refer to the previous section(s) above.
2732 >An alternative to an MS Windows NT 3.x/4.0
2733 Domain Controller - In the smb.conf file the following parameters
2745 CLASS="PROGRAMLISTING"
2746 >## please refer to the Samba PDC HOWTO chapter later in
2747 ## this collection for more details
2750 ; an OS level of 33 or more is recommended
2754 path = /somewhare/in/file/system
2756 available = yes</PRE
2768 >Chapter 3. LanMan and NT Password Encryption in Samba 2.x</A
2776 >3.1. Introduction</A
2779 >With the development of LanManager and Windows NT
2780 compatible password encryption for Samba, it is now able
2781 to validate user connections in exactly the same way as
2782 a LanManager or Windows NT server.</P
2784 >This document describes how the SMB password encryption
2785 algorithm works and what issues there are in choosing whether
2786 you want to use it. You should read it carefully, especially
2787 the part about security and the "PROS and CONS" section.</P
2795 >3.2. How does it work?</A
2798 >LanManager encryption is somewhat similar to UNIX
2799 password encryption. The server uses a file containing a
2800 hashed value of a user's password. This is created by taking
2801 the user's plaintext password, capitalising it, and either
2802 truncating to 14 bytes or padding to 14 bytes with null bytes.
2803 This 14 byte value is used as two 56 bit DES keys to encrypt
2804 a 'magic' eight byte value, forming a 16 byte value which is
2805 stored by the server and client. Let this value be known as
2806 the "hashed password".</P
2808 >Windows NT encryption is a higher quality mechanism,
2809 consisting of doing an MD4 hash on a Unicode version of the user's
2810 password. This also produces a 16 byte hash value that is
2813 >When a client (LanManager, Windows for WorkGroups, Windows
2814 95 or Windows NT) wishes to mount a Samba drive (or use a Samba
2815 resource), it first requests a connection and negotiates the
2816 protocol that the client and server will use. In the reply to this
2817 request the Samba server generates and appends an 8 byte, random
2818 value - this is stored in the Samba server after the reply is sent
2819 and is known as the "challenge". The challenge is different for
2820 every client connection.</P
2822 >The client then uses the hashed password (16 byte values
2823 described above), appended with 5 null bytes, as three 56 bit
2824 DES keys, each of which is used to encrypt the challenge 8 byte
2825 value, forming a 24 byte value known as the "response".</P
2827 >In the SMB call SMBsessionsetupX (when user level security
2828 is selected) or the call SMBtconX (when share level security is
2829 selected), the 24 byte response is returned by the client to the
2830 Samba server. For Windows NT protocol levels the above calculation
2831 is done on both hashes of the user's password and both responses are
2832 returned in the SMB call, giving two 24 byte values.</P
2834 >The Samba server then reproduces the above calculation, using
2835 its own stored value of the 16 byte hashed password (read from the
2839 > file - described later) and the challenge
2840 value that it kept from the negotiate protocol reply. It then checks
2841 to see if the 24 byte value it calculates matches the 24 byte value
2842 returned to it from the client.</P
2844 >If these values match exactly, then the client knew the
2845 correct password (or the 16 byte hashed value - see security note
2846 below) and is thus allowed access. If not, then the client did not
2847 know the correct password and is denied access.</P
2849 >Note that the Samba server never knows or stores the cleartext
2850 of the user's password - just the 16 byte hashed values derived from
2851 it. Also note that the cleartext password or 16 byte hashed values
2852 are never transmitted over the network - thus increasing security.</P
2860 >3.3. Important Notes About Security</A
2863 >The unix and SMB password encryption techniques seem similar
2864 on the surface. This similarity is, however, only skin deep. The unix
2865 scheme typically sends clear text passwords over the nextwork when
2866 logging in. This is bad. The SMB encryption scheme never sends the
2867 cleartext password over the network but it does store the 16 byte
2868 hashed values on disk. This is also bad. Why? Because the 16 byte hashed
2869 values are a "password equivalent". You cannot derive the user's
2870 password from them, but they could potentially be used in a modified
2871 client to gain access to a server. This would require considerable
2872 technical knowledge on behalf of the attacker but is perfectly possible.
2873 You should thus treat the smbpasswd file as though it contained the
2874 cleartext passwords of all your users. Its contents must be kept
2875 secret, and the file should be protected accordingly.</P
2877 >Ideally we would like a password scheme which neither requires
2878 plain text passwords on the net or on disk. Unfortunately this
2879 is not available as Samba is stuck with being compatible with
2880 other SMB systems (WinNT, WfWg, Win95 etc). </P
2900 >Note that Windows NT 4.0 Service pack 3 changed the
2901 default for permissible authentication so that plaintext
2904 > sent over the wire.
2905 The solution to this is either to switch to encrypted passwords
2906 with Samba or edit the Windows NT registry to re-enable plaintext
2907 passwords. See the document WinNT.txt for details on how to do
2910 >Other Microsoft operating systems which also exhibit
2911 this behavior includes</P
2917 >MS DOS Network client 3.0 with
2918 the basic network redirector installed</P
2922 >Windows 95 with the network redirector
2937 >All current release of
2938 Microsoft SMB/CIFS clients support authentication via the
2939 SMB Challenge/Response mechanism described here. Enabling
2940 clear text authentication does not disable the ability
2941 of the client to particpate in encrypted authentication.</P
2952 >3.3.1. Advantages of SMB Encryption</A
2959 >plain text passwords are not passed across
2960 the network. Someone using a network sniffer cannot just
2961 record passwords going to the SMB server.</P
2965 >WinNT doesn't like talking to a server
2966 that isn't using SMB encrypted passwords. It will refuse
2967 to browse the server if the server is also in user level
2968 security mode. It will insist on prompting the user for the
2969 password on each connection, which is very annoying. The
2970 only things you can do to stop this is to use SMB encryption.
2981 >3.3.2. Advantages of non-encrypted passwords</A
2988 >plain text passwords are not kept
2993 >uses same password file as other unix
2994 services such as login and ftp</P
2998 >you are probably already using other
2999 services (such as telnet and ftp) which send plain text
3000 passwords over the net, so sending them for SMB isn't
3013 NAME="SMBPASSWDFILEFORMAT"
3015 >The smbpasswd file</A
3018 >In order for Samba to participate in the above protocol
3019 it must be able to look up the 16 byte hashed values given a user name.
3020 Unfortunately, as the UNIX password value is also a one way hash
3021 function (ie. it is impossible to retrieve the cleartext of the user's
3022 password given the UNIX hash of it), a separate password file
3023 containing this 16 byte value must be kept. To minimise problems with
3024 these two password files, getting out of sync, the UNIX <TT
3034 >, is provided to generate
3035 a smbpasswd file from a UNIX <TT
3041 >To generate the smbpasswd file from your <TT
3045 > file use the following command :</P
3053 >cat /etc/passwd | mksmbpasswd.sh
3054 > /usr/local/samba/private/smbpasswd</B
3058 >If you are running on a system that uses NIS, use</P
3066 >ypcat passwd | mksmbpasswd.sh
3067 > /usr/local/samba/private/smbpasswd</B
3074 > program is found in
3075 the Samba source directory. By default, the smbpasswd file is
3080 >/usr/local/samba/private/smbpasswd</TT
3083 >The owner of the <TT
3085 >/usr/local/samba/private/</TT
3087 directory should be set to root, and the permissions on it should
3090 >chmod 500 /usr/local/samba/private</B
3094 >Likewise, the smbpasswd file inside the private directory should
3095 be owned by root and the permissions on is should be set to 0600
3098 >chmod 600 smbpasswd</B
3101 >The format of the smbpasswd file is (The line has been
3102 wrapped here. It should appear as one entry per line in
3103 your smbpasswd file.)</P
3112 CLASS="PROGRAMLISTING"
3113 >username:uid:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:
3114 [Account type]:LCT-<last-change-time>:Long name
3121 >Although only the <TT
3135 > XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</I
3146 > last-change-time</I
3148 > sections are significant
3149 and are looked at in the Samba code.</P
3153 > important that there by 32
3154 'X' characters between the two ':' characters in the XXX sections -
3155 the smbpasswd and Samba code will fail to validate any entries that
3156 do not have 32 characters between ':' characters. The first XXX
3157 section is for the Lanman password hash, the second is for the
3158 Windows NT version.</P
3160 >When the password file is created all users have password entries
3161 consisting of 32 'X' characters. By default this disallows any access
3162 as this user. When a user has a password set, the 'X' characters change
3163 to 32 ascii hexadecimal digits (0-9, A-F). These are an ascii
3164 representation of the 16 byte hashed value of a user's password.</P
3166 >To set a user to have no password (not recommended), edit the file
3167 using vi, and replace the first 11 characters with the ascii text
3171 > (minus the quotes).</P
3173 >For example, to clear the password for user bob, his smbpasswd file
3174 entry would look like :</P
3183 CLASS="PROGRAMLISTING"
3184 > bob:100:NO PASSWORDXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[U ]:LCT-00000000:Bob's full name:/bobhome:/bobshell
3191 >If you are allowing users to use the smbpasswd command to set
3192 their own passwords, you may want to give users NO PASSWORD initially
3193 so they do not have to enter a previous password when changing to their
3194 new password (not recommended). In order for you to allow this the
3198 > program must be able to connect to the
3202 > daemon as that user with no password. Enable this
3203 by adding the line :</P
3207 >null passwords = yes</B
3210 >to the [global] section of the smb.conf file (this is why
3211 the above scenario is not recommended). Preferably, allocate your
3212 users a default password to begin with, so you do not have
3213 to enable this on your server.</P
3217 >This file should be protected very
3218 carefully. Anyone with access to this file can (with enough knowledge of
3219 the protocols) gain access to your SMB server. The file is thus more
3220 sensitive than a normal unix <TT
3231 >3.5. The smbpasswd Command</A
3234 >The smbpasswd command maintains the two 32 byte password fields
3235 in the smbpasswd file. If you wish to make it similar to the unix
3245 >/usr/local/samba/bin/</TT
3247 main Samba binary directory).</P
3249 >Note that as of Samba 1.9.18p4 this program <EM
3252 > setuid root (the new <B
3256 code enforces this restriction so it cannot be run this way by
3262 > now works in a client-server mode
3263 where it contacts the local smbd to change the user's password on its
3264 behalf. This has enormous benefits - as follows.</P
3270 >smbpasswd no longer has to be setuid root -
3271 an enormous range of potential security problems is
3279 > now has the capability
3280 to change passwords on Windows NT servers (this only works when
3281 the request is sent to the NT Primary Domain Controller if you
3282 are changing an NT Domain user's password).</P
3286 >To run smbpasswd as a normal user just type :</P
3300 >Old SMB password: </TT
3304 ><type old value here -
3305 or hit return if there was no old password></B
3311 >New SMB Password: </TT
3315 ><type new value>
3322 >Repeat New SMB Password: </TT
3326 ><re-type new value
3331 >If the old value does not match the current value stored for
3332 that user, or the two new values do not match each other, then the
3333 password will not be changed.</P
3335 >If invoked by an ordinary user it will only allow the user
3336 to change his or her own Samba password.</P
3338 >If run by the root user smbpasswd may take an optional
3339 argument, specifying the user name whose SMB password you wish to
3340 change. Note that when run as root smbpasswd does not prompt for
3341 or check the old password value, thus allowing root to set passwords
3342 for users who have forgotten their passwords.</P
3347 > is designed to work in the same way
3348 and be familiar to UNIX users who use the <B
3357 >For more details on using <B
3361 to the man page which will always be the definitive reference.</P
3369 >3.6. Setting up Samba to support LanManager Encryption</A
3372 >This is a very brief description on how to setup samba to
3373 support password encryption. </P
3380 >compile and install samba as usual</P
3384 >enable encrypted passwords in <TT
3387 > by adding the line <B
3391 > in the [global] section</P
3395 >create the initial <TT
3399 password file in the place you specified in the Makefile
3400 (--prefix=<dir>). See the notes under the <A
3401 HREF="#SMBPASSWDFILEFORMAT"
3402 >The smbpasswd File</A
3404 section earlier in the document for details.</P
3408 >Note that you can test things using smbclient.</P
3416 >Chapter 4. Hosting a Microsoft Distributed File System tree on Samba</A
3424 >4.1. Instructions</A
3427 >The Distributed File System (or Dfs) provides a means of
3428 separating the logical view of files and directories that users
3429 see from the actual physical locations of these resources on the
3430 network. It allows for higher availability, smoother storage expansion,
3431 load balancing etc. For more information about Dfs, refer to <A
3432 HREF="http://www.microsoft.com/NTServer/nts/downloads/winfeatures/NTSDistrFile/AdminGuide.asp"
3434 > Microsoft documentation</A
3437 >This document explains how to host a Dfs tree on a Unix
3438 machine (for Dfs-aware clients to browse) using Samba.</P
3440 >To enable SMB-based DFS for Samba, configure it with the
3446 > option. Once built, a
3447 Samba server can be made a Dfs server by setting the global
3449 HREF="smb.conf.5.html#HOSTMSDFS"
3457 > parameter in the <TT
3461 > file. You designate a share as a Dfs root using the share
3463 HREF="smb.conf.5.html#MSDFSROOT"
3471 > parameter. A Dfs root directory on
3472 Samba hosts Dfs links in the form of symbolic links that point
3473 to other servers. For example, a symbolic link
3476 >junction->msdfs:storage1\share1</TT
3478 the share directory acts as the Dfs junction. When Dfs-aware
3479 clients attempt to access the junction link, they are redirected
3480 to the storage location (in this case, \\storage1\share1).</P
3482 >Dfs trees on Samba work with all Dfs-aware clients ranging
3483 from Windows 95 to 2000.</P
3485 >Here's an example of setting up a Dfs tree on a Samba
3495 CLASS="PROGRAMLISTING"
3496 ># The smb.conf file:
3498 netbios name = SAMBA
3502 path = /export/dfsroot
3510 >In the /export/dfsroot directory we set up our dfs links to
3511 other servers on the network.</P
3519 >cd /export/dfsroot</B
3529 >chown root /export/dfsroot</B
3539 >chmod 755 /export/dfsroot</B
3549 >ln -s msdfs:storageA\\shareA linka</B
3559 >ln -s msdfs:serverB\\share,serverC\\share linkb</B
3563 >You should set up the permissions and ownership of
3564 the directory acting as the Dfs root such that only designated
3565 users can create, delete or modify the msdfs links. Also note
3566 that symlink names should be all lowercase. This limitation exists
3567 to have Samba avoid trying all the case combinations to get at
3568 the link name. Finally set up the symbolic links to point to the
3569 network shares you want, and start Samba.</P
3571 >Users on Dfs-aware clients can now browse the Dfs tree
3572 on the Samba server at \\samba\dfs. Accessing
3573 links linka or linkb (which appear as directories to the client)
3574 takes users directly to the appropriate shares on the network.</P
3588 >Windows clients need to be rebooted
3589 if a previously mounted non-dfs share is made a dfs
3590 root or vice versa. A better way is to introduce a
3591 new share and make it the dfs root.</P
3595 >Currently there's a restriction that msdfs
3596 symlink names should all be lowercase.</P
3600 >For security purposes, the directory
3601 acting as the root of the Dfs tree should have ownership
3602 and permissions set so that only designated users can
3603 modify the symbolic links in the directory.</P
3614 >Chapter 5. Printing Support in Samba 2.2.x</A
3622 >5.1. Introduction</A
3625 >Beginning with the 2.2.0 release, Samba supports
3626 the native Windows NT printing mechanisms implemented via
3627 MS-RPC (i.e. the SPOOLSS named pipe). Previous versions of
3628 Samba only supported LanMan printing calls.</P
3630 >The additional functionality provided by the new
3631 SPOOLSS support includes:</P
3637 >Support for downloading printer driver
3638 files to Windows 95/98/NT/2000 clients upon demand.
3643 >Uploading of printer drivers via the
3644 Windows NT Add Printer Wizard (APW) or the
3645 Imprints tool set (refer to <A
3646 HREF="http://imprints.sourceforge.net"
3648 >http://imprints.sourceforge.net</A
3654 >Support for the native MS-RPC printing
3655 calls such as StartDocPrinter, EnumJobs(), etc... (See
3656 the MSDN documentation at <A
3657 HREF="http://msdn.microsoft.com/"
3659 >http://msdn.microsoft.com/</A
3661 for more information on the Win32 printing API)
3666 >Support for NT Access Control Lists (ACL)
3667 on printer objects</P
3671 >Improved support for printer queue manipulation
3672 through the use of an internal databases for spooled job
3677 >There has been some initial confusion about what all this means
3678 and whether or not it is a requirement for printer drivers to be
3679 installed on a Samba host in order to support printing from Windows
3680 clients. A bug existed in Samba 2.2.0 which made Windows NT/2000 clients
3681 require that the Samba server possess a valid driver for the printer.
3682 This is fixed in Samba 2.2.1 and once again, Windows NT/2000 clients
3683 can use the local APW for installing drivers to be used with a Samba
3684 served printer. This is the same behavior exhibited by Windows 9x clients.
3685 As a side note, Samba does not use these drivers in any way to process
3686 spooled files. They are utilized entirely by the clients.</P
3688 >The following MS KB article, may be of some help if you are dealing with
3689 Windows 2000 clients: <EM
3690 >How to Add Printers with No User
3691 Interaction in Windows 2000</EM
3695 HREF="http://support.microsoft.com/support/kb/articles/Q189/1/05.ASP"
3697 >http://support.microsoft.com/support/kb/articles/Q189/1/05.ASP</A
3706 >5.2. Configuration</A
3720 >[print$] vs. [printer$]</B
3727 >Previous versions of Samba recommended using a share named [printer$].
3728 This name was taken from the printer$ service created by Windows 9x
3729 clients when a printer was shared. Windows 9x printer servers always have
3730 a printer$ service which provides read-only access via no
3731 password in order to support printer driver downloads.</P
3733 >However, the initial implementation allowed for a
3737 >printer driver location</I
3740 to be used on a per share basis to specify the location of
3741 the driver files associated with that printer. Another
3748 a means of defining the printer driver name to be sent to
3751 >These parameters, including <TT
3757 > parameter, are being depreciated and should not
3758 be used in new installations. For more information on this change,
3759 you should refer to the <A
3761 >Migration section</A
3763 of this document.</P
3774 >5.2.1. Creating [print$]</A
3777 >In order to support the uploading of printer driver
3778 files, you must first configure a file share named [print$].
3779 The name of this share is hard coded in Samba's internals so
3780 the name is very important (print$ is the service used by