1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
5 >SAMBA Project Documentation</TITLE
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.77"></HEAD
19 NAME="SAMBA-HOWTO-COLLECTION"
26 NAME="SAMBA-HOWTO-COLLECTION"
28 >SAMBA Project Documentation</H1
48 > : Thu Aug 15 12:48:45 CDT 2002</P
50 >This book is a collection of HOWTOs added to Samba documentation over the years.
51 I try to ensure that all are current, but sometimes the is a larger job
52 than one person can maintain. The most recent version of this document
54 HREF="http://www.samba.org/"
56 >http://www.samba.org/</A
58 on the "Documentation" page. Please send updates to <A
59 HREF="mailto:jerry@samba.org"
64 >This documentation is distributed under the GNU General Public License (GPL)
65 version 2. A copy of the license is included with the Samba source
66 distribution. A copy can be found on-line at <A
67 HREF="http://www.fsf.org/licenses/gpl.txt"
69 >http://www.fsf.org/licenses/gpl.txt</A
83 >General installation</A
90 >How to Install and Test SAMBA</A
97 >Read the man pages</A
102 >Building the Binaries</A
107 >The all important step</A
112 >Create the smb configuration file.</A
117 >Test your config file with
126 >Starting the smbd and nmbd</A
131 >Try listing the shares available on your
137 >Try connecting with the unix client</A
142 >Try connecting from a DOS, WfWg, Win9x, WinNT,
143 Win2k, OS/2, etc... client</A
148 >What If Things Don't Work?</A
154 HREF="#IMPROVED-BROWSING"
155 >Improved browsing in samba</A
162 >Overview of browsing</A
167 >Browsing support in samba</A
172 >Problem resolution</A
177 >Browsing across subnets</A
182 >Setting up a WINS server</A
187 >Setting up Browsing in a WORKGROUP</A
192 >Setting up Browsing in a DOMAIN</A
197 >Forcing samba to be the master</A
202 >Making samba the domain master</A
207 >Note about broadcast addresses</A
212 >Multiple interfaces</A
226 >What are oplocks?</A
232 HREF="#BROWSING-QUICK"
233 >Quick Cross Subnet Browsing / Cross Workgroup Browsing guide</A
245 >Use of the "Remote Announce" parameter</A
250 >Use of the "Remote Browse Sync" parameter</A
260 >Do NOT use more than one (1) protocol on MS Windows machines</A
265 >Name Resolution Order</A
272 >LanMan and NT Password Encryption in Samba</A
284 >Important Notes About Security</A
289 >The smbpasswd Command</A
298 >Type of installation</A
305 >How to Configure Samba as a NT4 Primary Domain Controller</A
312 >Prerequisite Reading</A
322 >Configuring the Samba Domain Controller</A
327 >Creating Machine Trust Accounts and Joining Clients to the
333 >Common Problems and Errors</A
338 >System Policies and Profiles</A
343 >What other help can I get?</A
348 >Domain Control for Windows 9x/ME</A
353 >DOMAIN_CONTROL.txt : Windows NT Domain Control & Samba</A
360 >How to Act as a Backup Domain Controller in a Purely Samba Controlled Domain</A
367 >Prerequisite Reading</A
377 >What qualifies a Domain Controller on the network?</A
382 >Can Samba be a Backup Domain Controller?</A
387 >How do I set up a Samba BDC?</A
394 >Samba as a ADS domain member</A
401 >Installing the required packages for Debian</A
406 >Installing the required packages for RedHat</A
416 >Setup your /etc/krb5.conf</A
421 >Create the computer account</A
426 >Test your server setup</A
431 >Testing with smbclient</A
442 HREF="#DOMAIN-SECURITY"
443 >Samba as a NT4 domain member</A
450 >Joining an NT Domain with Samba 2.2</A
455 >Samba and Windows 2000 Domains</A
460 >Why is this better than security = server?</A
469 >Optional configuration</A
475 HREF="#INTEGRATE-MS-NETWORKS"
476 >Integrating MS Windows networks with Samba</A
488 >Name Resolution in a pure Unix/Linux world</A
493 >Name resolution as used within MS Windows networking</A
498 >How browsing functions and how to deploy stable and
499 dependable browsing using Samba</A
504 >MS Windows security options and how to configure
505 Samba for seemless integration</A
516 HREF="#UNIX-PERMISSIONS"
517 >UNIX Permission Bits and Windows NT Access Control Lists</A
524 >Viewing and changing UNIX permissions using the NT
530 >How to view file security on a Samba share</A
535 >Viewing file ownership</A
540 >Viewing file or directory permissions</A
545 >Modifying file or directory permissions</A
550 >Interaction with the standard Samba create mask
556 >Interaction with the standard Samba file attribute
564 >Configuring PAM for distributed but centrally
565 managed authentication</A
577 >Distributed Authentication</A
582 >PAM Configuration in smb.conf</A
589 >Hosting a Microsoft Distributed File System tree on Samba</A
620 >The Imprints Toolset</A
631 HREF="#SECURITYLEVELS"
644 >More complete description of security levels</A
651 >Unified Logons between Windows NT and UNIX using Winbind</A
668 >What Winbind Provides</A
673 >How Winbind Works</A
678 >Installation and Configuration</A
695 >Passdb MySQL plugin</A
712 >Using plaintext passwords or encrypted password</A
717 >Getting non-column data from the table</A
724 >Passdb XML plugin</A
742 HREF="#SAMBA-LDAP-HOWTO"
743 >Storing Samba's User/Machine Account information in an LDAP Directory</A
760 >Supported LDAP Servers</A
765 >Schema and Relationship to the RFC 2307 posixAccount</A
770 >Configuring Samba with LDAP</A
775 >Accounts and Groups management</A
780 >Security and sambaAccount</A
785 >LDAP specials attributes for sambaAccounts</A
790 >Example LDIF Entries for a sambaAccount</A
802 >HOWTO Access Samba source code via CVS</A
814 >CVS Access to samba.org</A
821 >Group mapping HOWTO</A
826 >Samba performance issues</A
951 >RedHat Linux Rembrandt-II</A
957 HREF="#OTHER-CLIENTS"
958 >Samba and other CIFS clients</A
965 >Macintosh clients?</A
975 >Windows for Workgroups</A
985 >Windows 2000 Service Pack 2</A
1019 >Attaching to a running process</A
1031 >Diagnosing your samba server</A
1053 >Still having troubles?</A
1070 >I. General installation</H1
1079 >This part contains general info on how to install samba
1080 and how to configure the parts of samba you will most likely need.
1081 PLEASE read this.</P
1088 >Table of Contents</B
1093 >How to Install and Test SAMBA</A
1100 >Read the man pages</A
1105 >Building the Binaries</A
1110 >The all important step</A
1115 >Create the smb configuration file.</A
1120 >Test your config file with
1129 >Starting the smbd and nmbd</A
1136 >Starting from inetd.conf</A
1141 >Alternative: starting it as a daemon</A
1148 >Try listing the shares available on your
1154 >Try connecting with the unix client</A
1159 >Try connecting from a DOS, WfWg, Win9x, WinNT,
1160 Win2k, OS/2, etc... client</A
1165 >What If Things Don't Work?</A
1172 >Diagnosing Problems</A
1182 >Choosing the Protocol Level</A
1187 >Printing from UNIX to a Client PC</A
1197 >Mapping Usernames</A
1205 HREF="#IMPROVED-BROWSING"
1206 >Improved browsing in samba</A
1213 >Overview of browsing</A
1218 >Browsing support in samba</A
1223 >Problem resolution</A
1228 >Browsing across subnets</A
1235 >How does cross subnet browsing work ?</A
1242 >Setting up a WINS server</A
1247 >Setting up Browsing in a WORKGROUP</A
1252 >Setting up Browsing in a DOMAIN</A
1257 >Forcing samba to be the master</A
1262 >Making samba the domain master</A
1267 >Note about broadcast addresses</A
1272 >Multiple interfaces</A
1286 >What are oplocks?</A
1292 HREF="#BROWSING-QUICK"
1293 >Quick Cross Subnet Browsing / Cross Workgroup Browsing guide</A
1305 >Use of the "Remote Announce" parameter</A
1310 >Use of the "Remote Browse Sync" parameter</A
1320 >Do NOT use more than one (1) protocol on MS Windows machines</A
1325 >Name Resolution Order</A
1332 >LanMan and NT Password Encryption in Samba</A
1344 >Important Notes About Security</A
1351 >Advantages of SMB Encryption</A
1356 >Advantages of non-encrypted passwords</A
1363 >The smbpasswd Command</A
1376 >Chapter 1. How to Install and Test SAMBA</H1
1384 >1.1. Read the man pages</H2
1386 >The man pages distributed with SAMBA contain
1387 lots of useful info that will help to get you started.
1388 If you don't know how to read man pages then try
1407 >nroff -man smbd.8 | more
1410 > on older unixes.</P
1412 >Other sources of information are pointed to
1413 by the Samba web site,<A
1414 HREF="http://www.samba.org/"
1416 > http://www.samba.org</A
1426 >1.2. Building the Binaries</H2
1428 >To do this, first run the program <B
1432 > in the source directory. This should automatically
1433 configure Samba for your operating system. If you have unusual
1434 needs then you may wish to run</P
1447 >first to see what special options you can enable.
1460 >will create the binaries. Once it's successfully
1461 compiled you can use </P
1473 >to install the binaries and manual pages. You can
1474 separately install the binaries and/or man pages using</P
1500 >Note that if you are upgrading for a previous version
1501 of Samba you might like to know that the old versions of
1502 the binaries will be renamed with a ".old" extension. You
1503 can go back to the previous version with</P
1516 >if you find this version a disaster!</P
1525 >1.3. The all important step</H2
1527 >At this stage you must fetch yourself a
1528 coffee or other drink you find stimulating. Getting the rest
1529 of the install right can sometimes be tricky, so you will
1530 probably need it.</P
1532 >If you have installed samba before then you can skip
1542 >1.4. Create the smb configuration file.</H2
1544 >There are sample configuration files in the examples
1545 subdirectory in the distribution. I suggest you read them
1546 carefully so you can see how the options go together in
1547 practice. See the man page for all the options.</P
1549 >The simplest useful configuration file would be
1550 something like this:</P
1553 CLASS="PROGRAMLISTING"
1563 >which would allow connections by anyone with an
1564 account on the server, using either their login name or
1565 "homes" as the service name. (Note that I also set the
1566 workgroup that Samba is part of. See BROWSING.txt for details)</P
1575 > file. You need to create it
1578 >Make sure you put the smb.conf file in the same place
1579 you specified in the<TT
1582 > (the default is to
1585 >/usr/local/samba/lib/</TT
1588 >For more information about security settings for the
1589 [homes] share please refer to the document UNIX_SECURITY.txt.</P
1598 >1.5. Test your config file with
1604 >It's important that you test the validity of your
1608 > file using the testparm program.
1609 If testparm runs OK then it will list the loaded services. If
1610 not it will give an error message.</P
1612 >Make sure it runs OK and that the services look
1613 reasonable before proceeding. </P
1615 >Always run testparm again when you change
1628 >1.6. Starting the smbd and nmbd</H2
1630 >You must choose to start smbd and nmbd either
1631 as daemons or from <B
1635 to do both! Either you can put them in <TT
1638 > and have them started on demand
1642 >, or you can start them as
1643 daemons either from the command line or in <TT
1646 >. See the man pages for details
1647 on the command line options. Take particular care to read
1648 the bit about what user you need to be in order to start
1649 Samba. In many cases you must be root.</P
1651 >The main advantage of starting <B
1658 > using the recommended daemon method
1659 is that they will respond slightly more quickly to an initial connection
1668 >1.6.1. Starting from inetd.conf</H3
1670 >NOTE; The following will be different if
1671 you use NIS or NIS+ to distributed services maps.</P
1677 What is defined at port 139/tcp. If nothing is defined
1678 then add a line like this:</P
1683 >netbios-ssn 139/tcp</B
1687 >similarly for 137/udp you should have an entry like:</P
1692 >netbios-ns 137/udp</B
1698 >/etc/inetd.conf</TT
1700 and add two lines something like this:</P
1703 CLASS="PROGRAMLISTING"
1704 > netbios-ssn stream tcp nowait root /usr/local/samba/bin/smbd smbd
1705 netbios-ns dgram udp wait root /usr/local/samba/bin/nmbd nmbd
1709 >The exact syntax of <TT
1711 >/etc/inetd.conf</TT
1713 varies between unixes. Look at the other entries in inetd.conf
1716 >NOTE: Some unixes already have entries like netbios_ns
1717 (note the underscore) in <TT
1721 You must either edit <TT
1727 >/etc/inetd.conf</TT
1728 > to make them consistent.</P
1730 >NOTE: On many systems you may need to use the
1731 "interfaces" option in smb.conf to specify the IP address
1732 and netmask of your interfaces. Run <B
1736 as root if you don't know what the broadcast is for your
1740 > tries to determine it at run
1741 time, but fails on some unixes. See the section on "testing nmbd"
1742 for a method of finding if you need to do this.</P
1744 >!!!WARNING!!! Many unixes only accept around 5
1745 parameters on the command line in <TT
1749 This means you shouldn't use spaces between the options and
1750 arguments, or you should use a script, and start the script
1759 >, perhaps just send
1760 it a HUP. If you have installed an earlier version of <B
1763 > then you may need to kill nmbd as well.</P
1772 >1.6.2. Alternative: starting it as a daemon</H3
1774 >To start the server as a daemon you should create
1775 a script something like this one, perhaps calling
1782 CLASS="PROGRAMLISTING"
1784 /usr/local/samba/bin/smbd -D
1785 /usr/local/samba/bin/nmbd -D
1789 >then make it executable with <B
1795 >You can then run <B
1799 hand or execute it from <TT
1805 >To kill it send a kill signal to the processes
1814 >NOTE: If you use the SVR4 style init system then
1815 you may like to look at the <TT
1817 >examples/svr4-startup</TT
1819 script to make Samba fit into that system.</P
1829 >1.7. Try listing the shares available on your
1848 >You should get back a list of shares available on
1849 your server. If you don't then something is incorrectly setup.
1850 Note that this method can also be used to see what shares
1851 are available on other LanManager clients (such as WfWg).</P
1853 >If you choose user level security then you may find
1854 that Samba requests a password before it will list the shares.
1858 > man page for details. (you
1859 can force it to list the shares without a password by
1860 adding the option -U% to the command line. This will not work
1861 with non-Samba servers)</P
1870 >1.8. Try connecting with the unix client</H2
1881 > //yourhostname/aservice</I
1893 would be the name of the host where you installed <B
1902 any service you have defined in the <TT
1906 file. Try your user name if you just have a [homes] section
1912 >For example if your unix host is bambi and your login
1913 name is fred you would type:</P
1921 >smbclient //bambi/fred
1933 >1.9. Try connecting from a DOS, WfWg, Win9x, WinNT,
1934 Win2k, OS/2, etc... client</H2
1936 >Try mounting disks. eg:</P
1940 >C:\WINDOWS\> </TT
1944 >net use d: \\servername\service
1949 >Try printing. eg:</P
1953 >C:\WINDOWS\> </TT
1958 \\servername\spoolservice</B
1964 >C:\WINDOWS\> </TT
1973 >Celebrate, or send me a bug report!</P
1982 >1.10. What If Things Don't Work?</H2
1984 >If nothing works and you start to think "who wrote
1985 this pile of trash" then I suggest you do step 2 again (and
1986 again) till you calm down.</P
1988 >Then you might read the file DIAGNOSIS.txt and the
1989 FAQ. If you are still stuck then try the mailing list or
1990 newsgroup (look in the README for details). Samba has been
1991 successfully installed at thousands of sites worldwide, so maybe
1992 someone else has hit your problem and has overcome it. You could
1993 also use the WWW site to scan back issues of the samba-digest.</P
1995 >When you fix the problem PLEASE send me some updates to the
1996 documentation (or source code) so that the next person will find it
2005 >1.10.1. Diagnosing Problems</H3
2007 >If you have installation problems then go to the
2009 HREF="Diagnosis.html"
2012 > chapter to try to find the
2022 >1.10.2. Scope IDs</H3
2024 >By default Samba uses a blank scope ID. This means
2025 all your windows boxes must also have a blank scope ID.
2026 If you really want to use a non-blank scope ID then you will
2027 need to use the 'netbios scope' smb.conf option.
2028 All your PCs will need to have the same setting for
2029 this to work. I do not recommend scope IDs.</P
2038 >1.10.3. Choosing the Protocol Level</H3
2040 >The SMB protocol has many dialects. Currently
2041 Samba supports 5, called CORE, COREPLUS, LANMAN1,
2044 >You can choose what maximum protocol to support
2048 > file. The default is
2049 NT1 and that is the best for the vast majority of sites.</P
2051 >In older versions of Samba you may have found it
2052 necessary to use COREPLUS. The limitations that led to
2053 this have mostly been fixed. It is now less likely that you
2054 will want to use less than LANMAN1. The only remaining advantage
2055 of COREPLUS is that for some obscure reason WfWg preserves
2056 the case of passwords in this protocol, whereas under LANMAN1,
2057 LANMAN2 or NT1 it uppercases all passwords before sending them,
2058 forcing you to use the "password level=" option in some cases.</P
2060 >The main advantage of LANMAN2 and NT1 is support for
2061 long filenames with some clients (eg: smbclient, Windows NT
2064 >See the smb.conf(5) manual page for more details.</P
2066 >Note: To support print queue reporting you may find
2067 that you have to use TCP/IP as the default protocol under
2068 WfWg. For some reason if you leave Netbeui as the default
2069 it may break the print queue reporting on some systems.
2070 It is presumably a WfWg bug.</P
2079 >1.10.4. Printing from UNIX to a Client PC</H3
2081 >To use a printer that is available via a smb-based
2082 server from a unix host with LPR you will need to compile the
2083 smbclient program. You then need to install the script
2084 "smbprint". Read the instruction in smbprint for more details.
2087 >There is also a SYSV style script that does much
2088 the same thing called smbprint.sysv. It contains instructions.</P
2090 >See the CUPS manual for information about setting up
2091 printing from a unix host with CUPS to a smb-based server. </P
2100 >1.10.5. Locking</H3
2102 >One area which sometimes causes trouble is locking.</P
2104 >There are two types of locking which need to be
2105 performed by a SMB server. The first is "record locking"
2106 which allows a client to lock a range of bytes in a open file.
2107 The second is the "deny modes" that are specified when a file
2110 >Record locking semantics under Unix is very
2111 different from record locking under Windows. Versions
2112 of Samba before 2.2 have tried to use the native
2113 fcntl() unix system call to implement proper record
2114 locking between different Samba clients. This can not
2115 be fully correct due to several reasons. The simplest
2116 is the fact that a Windows client is allowed to lock a
2117 byte range up to 2^32 or 2^64, depending on the client
2118 OS. The unix locking only supports byte ranges up to
2119 2^31. So it is not possible to correctly satisfy a
2120 lock request above 2^31. There are many more
2121 differences, too many to be listed here.</P
2123 >Samba 2.2 and above implements record locking
2124 completely independent of the underlying unix
2125 system. If a byte range lock that the client requests
2126 happens to fall into the range 0-2^31, Samba hands
2127 this request down to the Unix system. All other locks
2128 can not be seen by unix anyway.</P
2130 >Strictly a SMB server should check for locks before
2131 every read and write call on a file. Unfortunately with the
2132 way fcntl() works this can be slow and may overstress the
2133 rpc.lockd. It is also almost always unnecessary as clients
2134 are supposed to independently make locking calls before reads
2135 and writes anyway if locking is important to them. By default
2136 Samba only makes locking calls when explicitly asked
2137 to by a client, but if you set "strict locking = yes" then it will
2138 make lock checking calls on every read and write. </P
2140 >You can also disable by range locking completely
2141 using "locking = no". This is useful for those shares that
2142 don't support locking or don't need it (such as cdroms). In
2143 this case Samba fakes the return codes of locking calls to
2144 tell clients that everything is OK.</P
2146 >The second class of locking is the "deny modes". These
2147 are set by an application when it opens a file to determine
2148 what types of access should be allowed simultaneously with
2149 its open. A client may ask for DENY_NONE, DENY_READ, DENY_WRITE
2150 or DENY_ALL. There are also special compatibility modes called
2151 DENY_FCB and DENY_DOS.</P
2160 >1.10.6. Mapping Usernames</H3
2162 >If you have different usernames on the PCs and
2163 the unix server then take a look at the "username map" option.
2164 See the smb.conf man page for details.</P
2172 NAME="IMPROVED-BROWSING"
2174 >Chapter 2. Improved browsing in samba</H1
2182 >2.1. Overview of browsing</H2
2184 >SMB networking provides a mechanism by which clients can access a list
2185 of machines in a network, a so-called "browse list". This list
2186 contains machines that are ready to offer file and/or print services
2187 to other machines within the network. Thus it does not include
2188 machines which aren't currently able to do server tasks. The browse
2189 list is heavily used by all SMB clients. Configuration of SMB
2190 browsing has been problematic for some Samba users, hence this
2193 >Browsing will NOT work if name resolution from NetBIOS names to IP
2194 addresses does not function correctly. Use of a WINS server is highly
2195 recommended to aid the resolution of NetBIOS (SMB) names to IP addresses.
2196 WINS allows remote segment clients to obtain NetBIOS name_type information
2197 that can NOT be provided by any other means of name resolution.</P
2206 >2.2. Browsing support in samba</H2
2208 >Samba now fully supports browsing. The browsing is supported by nmbd
2209 and is also controlled by options in the smb.conf file (see smb.conf(5)).</P
2211 >Samba can act as a local browse master for a workgroup and the ability
2212 for samba to support domain logons and scripts is now available. See
2213 DOMAIN.txt for more information on domain logons.</P
2215 >Samba can also act as a domain master browser for a workgroup. This
2216 means that it will collate lists from local browse masters into a
2217 wide area network server list. In order for browse clients to
2218 resolve the names they may find in this list, it is recommended that
2219 both samba and your clients use a WINS server.</P
2221 >Note that you should NOT set Samba to be the domain master for a
2222 workgroup that has the same name as an NT Domain: on each wide area
2223 network, you must only ever have one domain master browser per workgroup,
2224 regardless of whether it is NT, Samba or any other type of domain master
2225 that is providing this service.</P
2227 >[Note that nmbd can be configured as a WINS server, but it is not
2228 necessary to specifically use samba as your WINS server. NTAS can
2229 be configured as your WINS server. In a mixed NT server and
2230 samba environment on a Wide Area Network, it is recommended that
2231 you use the NT server's WINS server capabilities. In a samba-only
2232 environment, it is recommended that you use one and only one nmbd
2233 as your WINS server].</P
2235 >To get browsing to work you need to run nmbd as usual, but will need
2236 to use the "workgroup" option in smb.conf to control what workgroup
2237 Samba becomes a part of.</P
2239 >Samba also has a useful option for a Samba server to offer itself for
2240 browsing on another subnet. It is recommended that this option is only
2241 used for 'unusual' purposes: announcements over the internet, for
2242 example. See "remote announce" in the smb.conf man page. </P
2251 >2.3. Problem resolution</H2
2253 >If something doesn't work then hopefully the log.nmb file will help
2254 you track down the problem. Try a debug level of 2 or 3 for finding
2255 problems. Also note that the current browse list usually gets stored
2256 in text form in a file called browse.dat.</P
2258 >Note that if it doesn't work for you, then you should still be able to
2259 type the server name as \\SERVER in filemanager then hit enter and
2260 filemanager should display the list of available shares.</P
2262 >Some people find browsing fails because they don't have the global
2263 "guest account" set to a valid account. Remember that the IPC$
2264 connection that lists the shares is done as guest, and thus you must
2265 have a valid guest account.</P
2267 >Also, a lot of people are getting bitten by the problem of too many
2268 parameters on the command line of nmbd in inetd.conf. This trick is to
2269 not use spaces between the option and the parameter (eg: -d2 instead
2270 of -d 2), and to not use the -B and -N options. New versions of nmbd
2271 are now far more likely to correctly find your broadcast and network
2272 address, so in most cases these aren't needed.</P
2274 >The other big problem people have is that their broadcast address,
2275 netmask or IP address is wrong (specified with the "interfaces" option
2285 >2.4. Browsing across subnets</H2
2287 >With the release of Samba 1.9.17(alpha1 and above) Samba has been
2288 updated to enable it to support the replication of browse lists
2289 across subnet boundaries. New code and options have been added to
2290 achieve this. This section describes how to set this feature up
2291 in different settings.</P
2293 >To see browse lists that span TCP/IP subnets (ie. networks separated
2294 by routers that don't pass broadcast traffic) you must set up at least
2295 one WINS server. The WINS server acts as a DNS for NetBIOS names, allowing
2296 NetBIOS name to IP address translation to be done by doing a direct
2297 query of the WINS server. This is done via a directed UDP packet on
2298 port 137 to the WINS server machine. The reason for a WINS server is
2299 that by default, all NetBIOS name to IP address translation is done
2300 by broadcasts from the querying machine. This means that machines
2301 on one subnet will not be able to resolve the names of machines on
2302 another subnet without using a WINS server.</P
2304 >Remember, for browsing across subnets to work correctly, all machines,
2305 be they Windows 95, Windows NT, or Samba servers must have the IP address
2306 of a WINS server given to them by a DHCP server, or by manual configuration
2307 (for Win95 and WinNT, this is in the TCP/IP Properties, under Network
2308 settings) for Samba this is in the smb.conf file.</P
2316 >2.4.1. How does cross subnet browsing work ?</H3
2318 >Cross subnet browsing is a complicated dance, containing multiple
2319 moving parts. It has taken Microsoft several years to get the code
2320 that achieves this correct, and Samba lags behind in some areas.
2321 However, with the 1.9.17 release, Samba is capable of cross subnet
2322 browsing when configured correctly.</P
2324 >Consider a network set up as follows :</P
2327 CLASS="PROGRAMLISTING"
2329 N1_A N1_B N1_C N1_D N1_E
2331 -------------------------------------------------------
2334 |R1 | Router 1 Router 2 |R2 |
2337 | subnet 2 subnet 3 |
2338 -------------------------- ------------------------------------
2340 N2_A N2_B N2_C N2_D N3_A N3_B N3_C N3_D
2344 >Consisting of 3 subnets (1, 2, 3) connected by two routers
2345 (R1, R2) - these do not pass broadcasts. Subnet 1 has 5 machines
2346 on it, subnet 2 has 4 machines, subnet 3 has 4 machines. Assume
2347 for the moment that all these machines are configured to be in the
2348 same workgroup (for simplicities sake). Machine N1_C on subnet 1
2349 is configured as Domain Master Browser (ie. it will collate the
2350 browse lists for the workgroup). Machine N2_D is configured as
2351 WINS server and all the other machines are configured to register
2352 their NetBIOS names with it.</P
2354 >As all these machines are booted up, elections for master browsers
2355 will take place on each of the three subnets. Assume that machine
2356 N1_C wins on subnet 1, N2_B wins on subnet 2, and N3_D wins on
2357 subnet 3 - these machines are known as local master browsers for
2358 their particular subnet. N1_C has an advantage in winning as the
2359 local master browser on subnet 1 as it is set up as Domain Master
2362 >On each of the three networks, machines that are configured to
2363 offer sharing services will broadcast that they are offering
2364 these services. The local master browser on each subnet will
2365 receive these broadcasts and keep a record of the fact that
2366 the machine is offering a service. This list of records is
2367 the basis of the browse list. For this case, assume that
2368 all the machines are configured to offer services so all machines
2369 will be on the browse list.</P
2371 >For each network, the local master browser on that network is
2372 considered 'authoritative' for all the names it receives via
2373 local broadcast. This is because a machine seen by the local
2374 master browser via a local broadcast must be on the same
2375 network as the local master browser and thus is a 'trusted'
2376 and 'verifiable' resource. Machines on other networks that
2377 the local master browsers learn about when collating their
2378 browse lists have not been directly seen - these records are
2379 called 'non-authoritative'.</P
2381 >At this point the browse lists look as follows (these are
2382 the machines you would see in your network neighborhood if
2383 you looked in it on a particular network right now).</P
2386 CLASS="PROGRAMLISTING"
2387 >Subnet Browse Master List
2388 ------ ------------- ----
2389 Subnet1 N1_C N1_A, N1_B, N1_C, N1_D, N1_E
2391 Subnet2 N2_B N2_A, N2_B, N2_C, N2_D
2393 Subnet3 N3_D N3_A, N3_B, N3_C, N3_D</PRE
2396 >Note that at this point all the subnets are separate, no
2397 machine is seen across any of the subnets.</P
2399 >Now examine subnet 2. As soon as N2_B has become the local
2400 master browser it looks for a Domain master browser to synchronize
2401 its browse list with. It does this by querying the WINS server
2402 (N2_D) for the IP address associated with the NetBIOS name
2403 WORKGROUP>1B<. This name was registerd by the Domain master
2404 browser (N1_C) with the WINS server as soon as it was booted.</P
2406 >Once N2_B knows the address of the Domain master browser it
2407 tells it that is the local master browser for subnet 2 by
2408 sending a MasterAnnouncement packet as a UDP port 138 packet.
2409 It then synchronizes with it by doing a NetServerEnum2 call. This
2410 tells the Domain Master Browser to send it all the server
2411 names it knows about. Once the domain master browser receives
2412 the MasterAnnouncement packet it schedules a synchronization
2413 request to the sender of that packet. After both synchronizations
2414 are done the browse lists look like :</P
2417 CLASS="PROGRAMLISTING"
2418 >Subnet Browse Master List
2419 ------ ------------- ----
2420 Subnet1 N1_C N1_A, N1_B, N1_C, N1_D, N1_E,
2421 N2_A(*), N2_B(*), N2_C(*), N2_D(*)
2423 Subnet2 N2_B N2_A, N2_B, N2_C, N2_D
2424 N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*)
2426 Subnet3 N3_D N3_A, N3_B, N3_C, N3_D
2428 Servers with a (*) after them are non-authoritative names.</PRE
2431 >At this point users looking in their network neighborhood on
2432 subnets 1 or 2 will see all the servers on both, users on
2433 subnet 3 will still only see the servers on their own subnet.</P
2435 >The same sequence of events that occured for N2_B now occurs
2436 for the local master browser on subnet 3 (N3_D). When it
2437 synchronizes browse lists with the domain master browser (N1_A)
2438 it gets both the server entries on subnet 1, and those on
2439 subnet 2. After N3_D has synchronized with N1_C and vica-versa
2440 the browse lists look like.</P
2443 CLASS="PROGRAMLISTING"
2444 >Subnet Browse Master List
2445 ------ ------------- ----
2446 Subnet1 N1_C N1_A, N1_B, N1_C, N1_D, N1_E,
2447 N2_A(*), N2_B(*), N2_C(*), N2_D(*),
2448 N3_A(*), N3_B(*), N3_C(*), N3_D(*)
2450 Subnet2 N2_B N2_A, N2_B, N2_C, N2_D
2451 N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*)
2453 Subnet3 N3_D N3_A, N3_B, N3_C, N3_D
2454 N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*),
2455 N2_A(*), N2_B(*), N2_C(*), N2_D(*)
2457 Servers with a (*) after them are non-authoritative names.</PRE
2460 >At this point users looking in their network neighborhood on
2461 subnets 1 or 3 will see all the servers on all sunbets, users on
2462 subnet 2 will still only see the servers on subnets 1 and 2, but not 3.</P
2464 >Finally, the local master browser for subnet 2 (N2_B) will sync again
2465 with the domain master browser (N1_C) and will recieve the missing
2466 server entries. Finally - and as a steady state (if no machines
2467 are removed or shut off) the browse lists will look like :</P
2470 CLASS="PROGRAMLISTING"
2471 >Subnet Browse Master List
2472 ------ ------------- ----
2473 Subnet1 N1_C N1_A, N1_B, N1_C, N1_D, N1_E,
2474 N2_A(*), N2_B(*), N2_C(*), N2_D(*),
2475 N3_A(*), N3_B(*), N3_C(*), N3_D(*)
2477 Subnet2 N2_B N2_A, N2_B, N2_C, N2_D
2478 N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*)
2479 N3_A(*), N3_B(*), N3_C(*), N3_D(*)
2481 Subnet3 N3_D N3_A, N3_B, N3_C, N3_D
2482 N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*),
2483 N2_A(*), N2_B(*), N2_C(*), N2_D(*)
2485 Servers with a (*) after them are non-authoritative names.</PRE
2488 >Synchronizations between the domain master browser and local
2489 master browsers will continue to occur, but this should be a
2490 steady state situation.</P
2492 >If either router R1 or R2 fails the following will occur:</P
2499 > Names of computers on each side of the inaccessible network fragments
2500 will be maintained for as long as 36 minutes, in the network neighbourhood
2506 > Attempts to connect to these inaccessible computers will fail, but the
2507 names will not be removed from the network neighbourhood lists.
2512 > If one of the fragments is cut off from the WINS server, it will only
2513 be able to access servers on its local subnet, by using subnet-isolated
2514 broadcast NetBIOS name resolution. The effects are similar to that of
2515 losing access to a DNS server.
2528 >2.5. Setting up a WINS server</H2
2530 >Either a Samba machine or a Windows NT Server machine may be set up
2531 as a WINS server. To set a Samba machine to be a WINS server you must
2532 add the following option to the smb.conf file on the selected machine :
2533 in the [globals] section add the line </P
2537 > wins support = yes</B
2540 >Versions of Samba previous to 1.9.17 had this parameter default to
2541 yes. If you have any older versions of Samba on your network it is
2542 strongly suggested you upgrade to 1.9.17 or above, or at the very
2543 least set the parameter to 'no' on all these machines.</P
2547 >wins support = yes</B
2548 >" will keep a list of
2549 all NetBIOS names registered with them, acting as a DNS for NetBIOS names.</P
2551 >You should set up only ONE wins server. Do NOT set the
2554 >wins support = yes</B
2555 >" option on more than one Samba
2558 >To set up a Windows NT Server as a WINS server you need to set up
2559 the WINS service - see your NT documentation for details. Note that
2560 Windows NT WINS Servers can replicate to each other, allowing more
2561 than one to be set up in a complex subnet environment. As Microsoft
2562 refuse to document these replication protocols Samba cannot currently
2563 participate in these replications. It is possible in the future that
2564 a Samba->Samba WINS replication protocol may be defined, in which
2565 case more than one Samba machine could be set up as a WINS server
2566 but currently only one Samba server should have the "wins support = yes"
2569 >After the WINS server has been configured you must ensure that all
2570 machines participating on the network are configured with the address
2571 of this WINS server. If your WINS server is a Samba machine, fill in
2572 the Samba machine IP address in the "Primary WINS Server" field of
2573 the "Control Panel->Network->Protocols->TCP->WINS Server" dialogs
2574 in Windows 95 or Windows NT. To tell a Samba server the IP address
2575 of the WINS server add the following line to the [global] section of
2576 all smb.conf files :</P
2580 >wins server = >name or IP address<</B
2583 >where >name or IP address< is either the DNS name of the WINS server
2584 machine or its IP address.</P
2586 >Note that this line MUST NOT BE SET in the smb.conf file of the Samba
2587 server acting as the WINS server itself. If you set both the
2590 >wins support = yes</B
2594 >wins server = >name<</B
2596 nmbd will fail to start.</P
2598 >There are two possible scenarios for setting up cross subnet browsing.
2599 The first details setting up cross subnet browsing on a network containing
2600 Windows 95, Samba and Windows NT machines that are not configured as
2601 part of a Windows NT Domain. The second details setting up cross subnet
2602 browsing on networks that contain NT Domains.</P
2611 >2.6. Setting up Browsing in a WORKGROUP</H2
2613 >To set up cross subnet browsing on a network containing machines
2614 in up to be in a WORKGROUP, not an NT Domain you need to set up one
2615 Samba server to be the Domain Master Browser (note that this is *NOT*
2616 the same as a Primary Domain Controller, although in an NT Domain the
2617 same machine plays both roles). The role of a Domain master browser is
2618 to collate the browse lists from local master browsers on all the
2619 subnets that have a machine participating in the workgroup. Without
2620 one machine configured as a domain master browser each subnet would
2621 be an isolated workgroup, unable to see any machines on any other
2622 subnet. It is the presense of a domain master browser that makes
2623 cross subnet browsing possible for a workgroup.</P
2625 >In an WORKGROUP environment the domain master browser must be a
2626 Samba server, and there must only be one domain master browser per
2627 workgroup name. To set up a Samba server as a domain master browser,
2628 set the following option in the [global] section of the smb.conf file :</P
2632 >domain master = yes</B
2635 >The domain master browser should also preferrably be the local master
2636 browser for its own subnet. In order to achieve this set the following
2637 options in the [global] section of the smb.conf file :</P
2640 CLASS="PROGRAMLISTING"
2641 > domain master = yes
2643 preferred master = yes
2647 >The domain master browser may be the same machine as the WINS
2648 server, if you require.</P
2650 >Next, you should ensure that each of the subnets contains a
2651 machine that can act as a local master browser for the
2652 workgroup. Any NT machine should be able to do this, as will
2653 Windows 95 machines (although these tend to get rebooted more
2654 often, so it's not such a good idea to use these). To make a
2655 Samba server a local master browser set the following
2656 options in the [global] section of the smb.conf file :</P
2659 CLASS="PROGRAMLISTING"
2660 > domain master = no
2662 preferred master = yes
2666 >Do not do this for more than one Samba server on each subnet,
2667 or they will war with each other over which is to be the local
2670 >The "local master" parameter allows Samba to act as a local master
2671 browser. The "preferred master" causes nmbd to force a browser
2672 election on startup and the "os level" parameter sets Samba high
2673 enough so that it should win any browser elections.</P
2675 >If you have an NT machine on the subnet that you wish to
2676 be the local master browser then you can disable Samba from
2677 becoming a local master browser by setting the following
2678 options in the [global] section of the smb.conf file :</P
2681 CLASS="PROGRAMLISTING"
2682 > domain master = no
2684 preferred master = no
2695 >2.7. Setting up Browsing in a DOMAIN</H2
2697 >If you are adding Samba servers to a Windows NT Domain then
2698 you must not set up a Samba server as a domain master browser.
2699 By default, a Windows NT Primary Domain Controller for a Domain
2700 name is also the Domain master browser for that name, and many
2701 things will break if a Samba server registers the Domain master
2702 browser NetBIOS name (DOMAIN>1B<) with WINS instead of the PDC.</P
2704 >For subnets other than the one containing the Windows NT PDC
2705 you may set up Samba servers as local master browsers as
2706 described. To make a Samba server a local master browser set
2707 the following options in the [global] section of the smb.conf
2711 CLASS="PROGRAMLISTING"
2712 > domain master = no
2714 preferred master = yes
2718 >If you wish to have a Samba server fight the election with machines
2719 on the same subnet you may set the "os level" parameter to lower
2720 levels. By doing this you can tune the order of machines that
2721 will become local master browsers if they are running. For
2722 more details on this see the section "FORCING SAMBA TO BE THE MASTER"
2725 >If you have Windows NT machines that are members of the domain
2726 on all subnets, and you are sure they will always be running then
2727 you can disable Samba from taking part in browser elections and
2728 ever becoming a local master browser by setting following options
2729 in the [global] section of the smb.conf file :</P
2733 > domain master = no
2735 preferred master = no
2746 >2.8. Forcing samba to be the master</H2
2748 >Who becomes the "master browser" is determined by an election process
2749 using broadcasts. Each election packet contains a number of parameters
2750 which determine what precedence (bias) a host should have in the
2751 election. By default Samba uses a very low precedence and thus loses
2752 elections to just about anyone else.</P
2754 >If you want Samba to win elections then just set the "os level" global
2755 option in smb.conf to a higher number. It defaults to 0. Using 34
2756 would make it win all elections over every other system (except other
2759 >A "os level" of 2 would make it beat WfWg and Win95, but not NTAS. A
2760 NTAS domain controller uses level 32.</P
2762 >The maximum os level is 255</P
2764 >If you want samba to force an election on startup, then set the
2765 "preferred master" global option in smb.conf to "yes". Samba will
2766 then have a slight advantage over other potential master browsers
2767 that are not preferred master browsers. Use this parameter with
2768 care, as if you have two hosts (whether they are windows 95 or NT or
2769 samba) on the same local subnet both set with "preferred master" to
2770 "yes", then periodically and continually they will force an election
2771 in order to become the local master browser.</P
2773 >If you want samba to be a "domain master browser", then it is
2774 recommended that you also set "preferred master" to "yes", because
2775 samba will not become a domain master browser for the whole of your
2776 LAN or WAN if it is not also a local master browser on its own
2777 broadcast isolated subnet.</P
2779 >It is possible to configure two samba servers to attempt to become
2780 the domain master browser for a domain. The first server that comes
2781 up will be the domain master browser. All other samba servers will
2782 attempt to become the domain master browser every 5 minutes. They
2783 will find that another samba server is already the domain master
2784 browser and will fail. This provides automatic redundancy, should
2785 the current domain master browser fail.</P
2794 >2.9. Making samba the domain master</H2
2796 >The domain master is responsible for collating the browse lists of
2797 multiple subnets so that browsing can occur between subnets. You can
2798 make samba act as the domain master by setting "domain master = yes"
2799 in smb.conf. By default it will not be a domain master.</P
2801 >Note that you should NOT set Samba to be the domain master for a
2802 workgroup that has the same name as an NT Domain.</P
2804 >When samba is the domain master and the master browser it will listen
2805 for master announcements (made roughly every twelve minutes) from local
2806 master browsers on other subnets and then contact them to synchronise
2809 >If you want samba to be the domain master then I suggest you also set
2810 the "os level" high enough to make sure it wins elections, and set
2811 "preferred master" to "yes", to get samba to force an election on
2814 >Note that all your servers (including samba) and clients should be
2815 using a WINS server to resolve NetBIOS names. If your clients are only
2816 using broadcasting to resolve NetBIOS names, then two things will occur:</P
2823 > your local master browsers will be unable to find a domain master
2824 browser, as it will only be looking on the local subnet.
2829 > if a client happens to get hold of a domain-wide browse list, and
2830 a user attempts to access a host in that list, it will be unable to
2831 resolve the NetBIOS name of that host.
2836 >If, however, both samba and your clients are using a WINS server, then:</P
2843 > your local master browsers will contact the WINS server and, as long as
2844 samba has registered that it is a domain master browser with the WINS
2845 server, your local master browser will receive samba's ip address
2846 as its domain master browser.
2851 > when a client receives a domain-wide browse list, and a user attempts
2852 to access a host in that list, it will contact the WINS server to
2853 resolve the NetBIOS name of that host. as long as that host has
2854 registered its NetBIOS name with the same WINS server, the user will
2855 be able to see that host.
2867 >2.10. Note about broadcast addresses</H2
2869 >If your network uses a "0" based broadcast address (for example if it
2870 ends in a 0) then you will strike problems. Windows for Workgroups
2871 does not seem to support a 0's broadcast and you will probably find
2872 that browsing and name lookups won't work.</P
2881 >2.11. Multiple interfaces</H2
2883 >Samba now supports machines with multiple network interfaces. If you
2884 have multiple interfaces then you will need to use the "interfaces"
2885 option in smb.conf to configure them. See smb.conf(5) for details.</P
2894 >Chapter 3. Oplocks</H1
2902 >3.1. What are oplocks?</H2
2904 >When a client opens a file it can request an "oplock" or file
2905 lease. This is (to simplify a bit) a guarentee that no one else
2906 has the file open simultaneously. It allows the client to not
2907 send any updates on the file to the server, thus reducing a
2908 network file access to local access (once the file is in
2909 client cache). An "oplock break" is when the server sends
2910 a request to the client to flush all its changes back to
2911 the server, so the file is in a consistent state for other
2912 opens to succeed. If a client fails to respond to this
2913 asynchronous request then the file can be corrupted. Hence
2914 the "turn off oplocks" answer if people are having multi-user
2915 file access problems.</P
2917 >Unless the kernel is "oplock aware" (SGI IRIX and Linux are
2918 the only two UNIXes that are at the moment) then if a local
2919 UNIX process accesses the file simultaneously then Samba
2920 has no way of telling this is occuring, so the guarentee
2921 to the client is broken. This can corrupt the file. Short
2922 answer - it you have UNIX clients accessing the same file
2923 as smbd locally or via NFS and you're not running Linux or
2924 IRIX then turn off oplocks for that file or share.</P
2926 >"Share modes". These are modes of opening a file, that
2927 guarentee an invarient - such as DENY_WRITE - which means
2928 that if any other opens are requested with write access after
2929 this current open has succeeded then they should be denied
2930 with a "sharing violation" error message. Samba handles these
2931 internally inside smbd. UNIX clients accessing the same file
2932 ignore these invarients. Just proving that if you need simultaneous
2933 file access from a Windows and UNIX client you *must* have an
2934 application that is written to lock records correctly on both
2935 sides. Few applications are written like this, and even fewer
2936 are cross platform (UNIX and Windows) so in practice this isn't
2937 much of a problem.</P
2939 >"Locking". This really means "byte range locking" - such as
2940 lock 10 bytes at file offset 24 for write access. This is the
2941 area in which well written UNIX and Windows apps will cooperate.
2942 Windows locks (at least from NT or above) are 64-bit unsigned
2943 offsets. UNIX locks are either 31 bit or 63 bit and are signed
2944 (the top bit is used for the sign). Samba handles these by
2945 first ensuring that all the Windows locks don't conflict (ie.
2946 if other Windows clients have competing locks then just reject
2947 immediately) - this allows us to support 64-bit Windows locks
2948 on 32-bit filesystems. Secondly any locks that are valid are
2949 then mapped onto UNIX fcntl byte range locks. These are the
2950 locks that will be seen by UNIX processes. If there is a conflict
2951 here the lock is rejected.</P
2953 >Note that if a client has an oplock then it "knows" that no
2954 other client can have the file open so usually doesn't bother
2955 to send to lock request to the server - this means once again
2956 if you need to share files between UNIX and Windows processes
2957 either use IRIX or Linux, or turn off oplocks for these
2965 NAME="BROWSING-QUICK"
2967 >Chapter 4. Quick Cross Subnet Browsing / Cross Workgroup Browsing guide</H1
2969 >This document should be read in conjunction with Browsing and may
2970 be taken as the fast track guide to implementing browsing across subnets
2971 and / or across workgroups (or domains). WINS is the best tool for resolution
2972 of NetBIOS names to IP addesses. WINS is NOT involved in browse list handling
2973 except by way of name to address mapping.</P
2981 >4.1. Discussion</H2
2983 >Firstly, all MS Windows networking is based on SMB (Server Message
2984 Block) based messaging. SMB messaging is implemented using NetBIOS. Samba
2985 implements NetBIOS by encapsulating it over TCP/IP. MS Windows products can
2986 do likewise. NetBIOS based networking uses broadcast messaging to affect
2987 browse list management. When running NetBIOS over TCP/IP this uses UDP
2988 based messaging. UDP messages can be broadcast or unicast.</P
2990 >Normally, only unicast UDP messaging can be forwarded by routers. The
2991 "remote announce" parameter to smb.conf helps to project browse announcements
2992 to remote network segments via unicast UDP. Similarly, the "remote browse sync"
2993 parameter of smb.conf implements browse list collation using unicast UDP.</P
2995 >Secondly, in those networks where Samba is the only SMB server technology
2996 wherever possible nmbd should be configured on one (1) machine as the WINS
2997 server. This makes it easy to manage the browsing environment. If each network
2998 segment is configured with it's own Samba WINS server, then the only way to
2999 get cross segment browsing to work is by using the "remote announce" and
3000 the "remote browse sync" parameters to your smb.conf file.</P
3002 >If only one WINS server is used then the use of the "remote announce" and the
3003 "remote browse sync" parameters should NOT be necessary.</P
3005 >Samba WINS does not support MS-WINS replication. This means that when setting up
3006 Samba as a WINS server there must only be one nmbd configured as a WINS server
3007 on the network. Some sites have used multiple Samba WINS servers for redundancy
3008 (one server per subnet) and then used "remote browse sync" and "remote announce"
3009 to affect browse list collation across all segments. Note that this means
3010 clients will only resolve local names, and must be configured to use DNS to
3011 resolve names on other subnets in order to resolve the IP addresses of the
3012 servers they can see on other subnets. This setup is not recommended, but is
3013 mentioned as a practical consideration (ie: an 'if all else fails' scenario).</P
3015 >Lastly, take note that browse lists are a collection of unreliable broadcast
3016 messages that are repeated at intervals of not more than 15 minutes. This means
3017 that it will take time to establish a browse list and it can take up to 45
3018 minutes to stabilise, particularly across network segments.</P
3027 >4.2. Use of the "Remote Announce" parameter</H2
3029 >The "remote announce" parameter of smb.conf can be used to forcibly ensure
3030 that all the NetBIOS names on a network get announced to a remote network.
3031 The syntax of the "remote announce" parameter is:
3033 CLASS="PROGRAMLISTING"
3034 > remote announce = a.b.c.d [e.f.g.h] ...</PRE
3038 CLASS="PROGRAMLISTING"
3039 > remote announce = a.b.c.d/WORKGROUP [e.f.g.h/WORKGROUP] ...</PRE
3046 CLASS="VARIABLELIST"
3049 >a.b.c.d and e.f.g.h</DT
3052 >is either the LMB (Local Master Browser) IP address
3053 or the broadcst address of the remote network.
3054 ie: the LMB is at 192.168.1.10, or the address
3055 could be given as 192.168.1.255 where the netmask
3056 is assumed to be 24 bits (255.255.255.0).
3057 When the remote announcement is made to the broadcast
3058 address of the remote network every host will receive
3059 our announcements. This is noisy and therefore
3060 undesirable but may be necessary if we do NOT know
3061 the IP address of the remote LMB.</P
3067 >is optional and can be either our own workgroup
3068 or that of the remote network. If you use the
3069 workgroup name of the remote network then our
3070 NetBIOS machine names will end up looking like
3071 they belong to that workgroup, this may cause
3072 name resolution problems and should be avoided.</P
3085 >4.3. Use of the "Remote Browse Sync" parameter</H2
3087 >The "remote browse sync" parameter of smb.conf is used to announce to
3088 another LMB that it must synchronise it's NetBIOS name list with our
3089 Samba LMB. It works ONLY if the Samba server that has this option is
3090 simultaneously the LMB on it's network segment.</P
3092 >The syntax of the "remote browse sync" parameter is:
3094 CLASS="PROGRAMLISTING"
3095 > remote browse sync = a.b.c.d</PRE
3098 where a.b.c.d is either the IP address of the remote LMB or else is the network broadcast address of the remote segment.</P
3107 >4.4. Use of WINS</H2
3109 >Use of WINS (either Samba WINS _or_ MS Windows NT Server WINS) is highly
3110 recommended. Every NetBIOS machine registers it's name together with a
3111 name_type value for each of of several types of service it has available.
3112 eg: It registers it's name directly as a unique (the type 0x03) name.
3113 It also registers it's name if it is running the lanmanager compatible
3114 server service (used to make shares and printers available to other users)
3115 by registering the server (the type 0x20) name.</P
3117 >All NetBIOS names are up to 15 characters in length. The name_type variable
3118 is added to the end of the name - thus creating a 16 character name. Any
3119 name that is shorter than 15 characters is padded with spaces to the 15th
3120 character. ie: All NetBIOS names are 16 characters long (including the
3121 name_type information).</P
3123 >WINS can store these 16 character names as they get registered. A client
3124 that wants to log onto the network can ask the WINS server for a list
3125 of all names that have registered the NetLogon service name_type. This saves
3126 broadcast traffic and greatly expedites logon processing. Since broadcast
3127 name resolution can not be used across network segments this type of
3128 information can only be provided via WINS _or_ via statically configured
3129 "lmhosts" files that must reside on all clients in the absence of WINS.</P
3131 >WINS also serves the purpose of forcing browse list synchronisation by all
3132 LMB's. LMB's must synchronise their browse list with the DMB (domain master
3133 browser) and WINS helps the LMB to identify it's DMB. By definition this
3134 will work only within a single workgroup. Note that the domain master browser
3135 has NOTHING to do with what is referred to as an MS Windows NT Domain. The
3136 later is a reference to a security environment while the DMB refers to the
3137 master controller for browse list information only.</P
3139 >Use of WINS will work correctly only if EVERY client TCP/IP protocol stack
3140 has been configured to use the WINS server/s. Any client that has not been
3141 configured to use the WINS server will continue to use only broadcast based
3142 name registration so that WINS may NEVER get to know about it. In any case,
3143 machines that have not registered with a WINS server will fail name to address
3144 lookup attempts by other clients and will therefore cause workstation access
3147 >To configure Samba as a WINS server just add "wins support = yes" to the
3148 smb.conf file [globals] section.</P
3150 >To configure Samba to register with a WINS server just add
3151 "wins server = a.b.c.d" to your smb.conf file [globals] section.</P
3159 > use both "wins support = yes" together with "wins server = a.b.c.d"
3160 particularly not using it's own IP address.</P
3169 >4.5. Do NOT use more than one (1) protocol on MS Windows machines</H2
3171 >A very common cause of browsing problems results from installing more than
3172 one protocol on an MS Windows machine.</P
3174 >Every NetBIOS machine take part in a process of electing the LMB (and DMB)
3175 every 15 minutes. A set of election criteria is used to determine the order
3176 of precidence for winning this election process. A machine running Samba or
3177 Windows NT will be biased so that the most suitable machine will predictably
3178 win and thus retain it's role.</P
3180 >The election process is "fought out" so to speak over every NetBIOS network
3181 interface. In the case of a Windows 9x machine that has both TCP/IP and IPX
3182 installed and has NetBIOS enabled over both protocols the election will be
3183 decided over both protocols. As often happens, if the Windows 9x machine is
3184 the only one with both protocols then the LMB may be won on the NetBIOS
3185 interface over the IPX protocol. Samba will then lose the LMB role as Windows
3186 9x will insist it knows who the LMB is. Samba will then cease to function
3187 as an LMB and thus browse list operation on all TCP/IP only machines will
3190 >The safest rule of all to follow it this - USE ONLY ONE PROTOCOL!</P
3199 >4.6. Name Resolution Order</H2
3201 >Resolution of NetBIOS names to IP addresses can take place using a number
3202 of methods. The only ones that can provide NetBIOS name_type information
3211 >WINS: the best tool!</TD
3215 >LMHOSTS: is static and hard to maintain.</TD
3219 >Broadcast: uses UDP and can not resolve names across remote segments.</TD
3227 >Alternative means of name resolution includes:
3235 >/etc/hosts: is static, hard to maintain, and lacks name_type info</TD
3239 >DNS: is a good choice but lacks essential name_type info.</TD
3247 >Many sites want to restrict DNS lookups and want to avoid broadcast name
3248 resolution traffic. The "name resolve order" parameter is of great help here.
3249 The syntax of the "name resolve order" parameter is:
3251 CLASS="PROGRAMLISTING"
3252 > name resolve order = wins lmhosts bcast host</PRE
3256 CLASS="PROGRAMLISTING"
3257 > name resolve order = wins lmhosts (eliminates bcast and host)</PRE
3261 CLASS="PROGRAMLISTING"
3262 > name resolve order = host lmhost wins bcast</PRE
3264 where "host" refers the the native methods used by the Unix system
3265 to implement the gethostbyname() function call. This is normally
3271 >/etc/nsswitch.conf</TT
3274 >/etc/resolv.conf</TT
3284 >Chapter 5. LanMan and NT Password Encryption in Samba</H1
3292 >5.1. Introduction</H2
3294 >Newer windows clients send encrypted passwords over
3295 the wire, instead of plain text passwords. The newest clients
3296 will only send encrypted passwords and refuse to send plain text
3297 passwords, unless their registry is tweaked.</P
3299 >These passwords can't be converted to unix style encrypted
3300 passwords. Because of that you can't use the standard unix
3301 user database, and you have to store the Lanman and NT hashes
3302 somewhere else. For more information, see the documentation
3305 >passdb backend = </B
3316 >5.2. Important Notes About Security</H2
3318 >The unix and SMB password encryption techniques seem similar
3319 on the surface. This similarity is, however, only skin deep. The unix
3320 scheme typically sends clear text passwords over the network when
3321 logging in. This is bad. The SMB encryption scheme never sends the
3322 cleartext password over the network but it does store the 16 byte
3323 hashed values on disk. This is also bad. Why? Because the 16 byte hashed
3324 values are a "password equivalent". You cannot derive the user's
3325 password from them, but they could potentially be used in a modified
3326 client to gain access to a server. This would require considerable
3327 technical knowledge on behalf of the attacker but is perfectly possible.
3328 You should thus treat the smbpasswd file as though it contained the
3329 cleartext passwords of all your users. Its contents must be kept
3330 secret, and the file should be protected accordingly.</P
3332 >Ideally we would like a password scheme which neither requires
3333 plain text passwords on the net or on disk. Unfortunately this
3334 is not available as Samba is stuck with being compatible with
3335 other SMB systems (WinNT, WfWg, Win95 etc). </P
3350 SRC="/docbook-dsssl/warning.gif"
3357 >Note that Windows NT 4.0 Service pack 3 changed the
3358 default for permissible authentication so that plaintext
3365 > sent over the wire.
3366 The solution to this is either to switch to encrypted passwords
3367 with Samba or edit the Windows NT registry to re-enable plaintext
3368 passwords. See the document WinNT.txt for details on how to do
3371 >Other Microsoft operating systems which also exhibit
3372 this behavior includes</P
3378 >MS DOS Network client 3.0 with
3379 the basic network redirector installed</P
3383 >Windows 95 with the network redirector
3402 >All current release of
3403 Microsoft SMB/CIFS clients support authentication via the
3404 SMB Challenge/Response mechanism described here. Enabling
3405 clear text authentication does not disable the ability
3406 of the client to participate in encrypted authentication.</P
3418 >5.2.1. Advantages of SMB Encryption</H3
3424 >plain text passwords are not passed across
3425 the network. Someone using a network sniffer cannot just
3426 record passwords going to the SMB server.</P
3430 >WinNT doesn't like talking to a server
3431 that isn't using SMB encrypted passwords. It will refuse
3432 to browse the server if the server is also in user level
3433 security mode. It will insist on prompting the user for the
3434 password on each connection, which is very annoying. The
3435 only things you can do to stop this is to use SMB encryption.
3447 >5.2.2. Advantages of non-encrypted passwords</H3
3453 >plain text passwords are not kept
3458 >uses same password file as other unix
3459 services such as login and ftp</P
3463 >you are probably already using other
3464 services (such as telnet and ftp) which send plain text
3465 passwords over the net, so sending them for SMB isn't
3478 >5.3. The smbpasswd Command</H2
3480 >The smbpasswd command maintains the two 32 byte password fields
3481 in the smbpasswd file. If you wish to make it similar to the unix
3491 >/usr/local/samba/bin/</TT
3493 main Samba binary directory).</P
3498 > now works in a client-server mode
3499 where it contacts the local smbd to change the user's password on its
3500 behalf. This has enormous benefits - as follows.</P
3505 > now has the capability
3506 to change passwords on Windows NT servers (this only works when
3507 the request is sent to the NT Primary Domain Controller if you
3508 are changing an NT Domain user's password).</P
3510 >To run smbpasswd as a normal user just type :</P
3524 >Old SMB password: </TT
3528 ><type old value here -
3529 or hit return if there was no old password></B
3535 >New SMB Password: </TT
3539 ><type new value>
3546 >Repeat New SMB Password: </TT
3550 ><re-type new value
3555 >If the old value does not match the current value stored for
3556 that user, or the two new values do not match each other, then the
3557 password will not be changed.</P
3559 >If invoked by an ordinary user it will only allow the user
3560 to change his or her own Samba password.</P
3562 >If run by the root user smbpasswd may take an optional
3563 argument, specifying the user name whose SMB password you wish to
3564 change. Note that when run as root smbpasswd does not prompt for
3565 or check the old password value, thus allowing root to set passwords
3566 for users who have forgotten their passwords.</P
3571 > is designed to work in the same way
3572 and be familiar to UNIX users who use the <B
3581 >For more details on using <B
3585 to the man page which will always be the definitive reference.</P
3598 >II. Type of installation</H1
3607 >This part contains information on using samba in a (NT 4 or ADS) domain.
3608 If you wish to run samba as a domain member or DC, read the appropriate chapter in
3616 >Table of Contents</B
3621 >How to Configure Samba as a NT4 Primary Domain Controller</A
3628 >Prerequisite Reading</A
3638 >Configuring the Samba Domain Controller</A
3643 >Creating Machine Trust Accounts and Joining Clients to the
3651 >Manual Creation of Machine Trust Accounts</A
3656 >"On-the-Fly" Creation of Machine Trust Accounts</A
3661 >Joining the Client to the Domain</A
3668 >Common Problems and Errors</A
3673 >System Policies and Profiles</A
3678 >What other help can I get?</A
3683 >Domain Control for Windows 9x/ME</A
3690 >Configuration Instructions: Network Logons</A
3695 >Configuration Instructions: Setting up Roaming User Profiles</A
3702 >DOMAIN_CONTROL.txt : Windows NT Domain Control & Samba</A
3709 >How to Act as a Backup Domain Controller in a Purely Samba Controlled Domain</A
3716 >Prerequisite Reading</A
3726 >What qualifies a Domain Controller on the network?</A
3733 >How does a Workstation find its domain controller?</A
3738 >When is the PDC needed?</A
3745 >Can Samba be a Backup Domain Controller?</A
3750 >How do I set up a Samba BDC?</A
3757 >How do I replicate the smbpasswd file?</A
3766 >Samba as a ADS domain member</A
3773 >Installing the required packages for Debian</A
3778 >Installing the required packages for RedHat</A
3788 >Setup your /etc/krb5.conf</A
3793 >Create the computer account</A
3807 >Test your server setup</A
3812 >Testing with smbclient</A
3823 HREF="#DOMAIN-SECURITY"
3824 >Samba as a NT4 domain member</A
3831 >Joining an NT Domain with Samba 2.2</A
3836 >Samba and Windows 2000 Domains</A
3841 >Why is this better than security = server?</A
3854 >Chapter 6. How to Configure Samba as a NT4 Primary Domain Controller</H1
3862 >6.1. Prerequisite Reading</H2
3864 >Before you continue reading in this chapter, please make sure
3865 that you are comfortable with configuring basic files services
3866 in smb.conf and how to enable and administer password
3867 encryption in Samba. Theses two topics are covered in the
3869 HREF="smb.conf.5.html"
3877 HREF="ENCRYPTION.html"
3879 >Encryption chapter</A
3881 of this HOWTO Collection.</P
3890 >6.2. Background</H2
3905 SRC="/docbook-dsssl/note.gif"
3918 > This document is a combination
3919 of David Bannon's "Samba 2.2 PDC HOWTO" and "Samba NT Domain FAQ".
3920 Both documents are superseded by this one.</P
3926 >Versions of Samba prior to release 2.2 had marginal capabilities to act
3927 as a Windows NT 4.0 Primary Domain Controller
3929 (PDC). With Samba 2.2.0, we are proud to announce official support for
3930 Windows NT 4.0-style domain logons from Windows NT 4.0 and Windows
3931 2000 clients. This article outlines the steps
3932 necessary for configuring Samba as a PDC. It is necessary to have a
3933 working Samba server prior to implementing the PDC functionality. If
3934 you have not followed the steps outlined in <A
3935 HREF="UNIX_INSTALL.html"
3937 > UNIX_INSTALL.html</A
3939 that your server is configured correctly before proceeding. Another
3940 good resource in the <A
3941 HREF="smb.conf.5.html"
3945 >. The following functionality should work in 2.2:</P
3951 > domain logons for Windows NT 4.0/2000 clients.
3956 > placing a Windows 9x client in user level security
3961 > retrieving a list of users and groups from a Samba PDC to
3962 Windows 9x/NT/2000 clients
3967 > roving (roaming) user profiles
3972 > Windows NT 4.0-style system policies
3977 >The following pieces of functionality are not included in the 2.2 release:</P
3983 > Windows NT 4 domain trusts
3988 > SAM replication with Windows NT 4.0 Domain Controllers
3989 (i.e. a Samba PDC and a Windows NT BDC or vice versa)
3994 > Adding users via the User Manager for Domains
3999 > Acting as a Windows 2000 Domain Controller (i.e. Kerberos and
4005 >Please note that Windows 9x clients are not true members of a domain
4006 for reasons outlined in this article. Therefore the protocol for
4007 support Windows 9x-style domain logons is completely different
4008 from NT4 domain logons and has been officially supported for some
4011 >Implementing a Samba PDC can basically be divided into 2 broad
4019 > Configuring the Samba PDC
4024 > Creating machine trust accounts and joining clients
4030 >There are other minor details such as user profiles, system
4031 policies, etc... However, these are not necessarily specific
4032 to a Samba PDC as much as they are related to Windows NT networking
4033 concepts. They will be mentioned only briefly here.</P
4042 >6.3. Configuring the Samba Domain Controller</H2
4044 >The first step in creating a working Samba PDC is to
4045 understand the parameters necessary in smb.conf. I will not
4046 attempt to re-explain the parameters here as they are more that
4047 adequately covered in <A
4048 HREF="smb.conf.5.html"
4052 >. For convenience, the parameters have been
4053 linked with the actual smb.conf description.</P
4055 >Here is an example <TT
4058 > for acting as a PDC:</P
4061 CLASS="PROGRAMLISTING"
4063 ; Basic server settings
4065 HREF="smb.conf.5.html#NETBIOSNAME"
4075 HREF="smb.conf.5.html#WORKGROUP"
4085 ; we should act as the domain and local master browser
4087 HREF="smb.conf.5.html#OSLEVEL"
4092 HREF="smb.conf.5.html#PERFERREDMASTER"
4094 >preferred master</A
4097 HREF="smb.conf.5.html#DOMAINMASTER"
4102 HREF="smb.conf.5.html#LOCALMASTER"
4107 ; security settings (must user security = user)
4109 HREF="smb.conf.5.html#SECURITYEQUALSUSER"
4114 ; encrypted passwords are a requirement for a PDC
4116 HREF="smb.conf.5.html#ENCRYPTPASSWORDS"
4118 >encrypt passwords</A
4121 ; support domain logons
4123 HREF="smb.conf.5.html#DOMAINLOGONS"
4128 ; where to store user profiles?
4130 HREF="smb.conf.5.html#LOGONPATH"
4133 > = \\%N\profiles\%u
4135 ; where is a user's home directory and where should it
4138 HREF="smb.conf.5.html#LOGONDRIVE"
4143 HREF="smb.conf.5.html#LOGONHOME"
4148 ; specify a generic logon script for all users
4149 ; this is a relative **DOS** path to the [netlogon] share
4151 HREF="smb.conf.5.html#LOGONSCRIPT"
4156 ; necessary share for domain controller
4159 HREF="smb.conf.5.html#PATH"
4162 > = /usr/local/samba/lib/netlogon
4164 HREF="smb.conf.5.html#READONLY"
4169 HREF="smb.conf.5.html#WRITELIST"
4179 ; share for storing user profiles
4182 HREF="smb.conf.5.html#PATH"
4185 > = /export/smb/ntprofile
4187 HREF="smb.conf.5.html#READONLY"
4192 HREF="smb.conf.5.html#CREATEMASK"
4197 HREF="smb.conf.5.html#DIRECTORYMASK"
4203 >There are a couple of points to emphasize in the above configuration.</P
4209 > Encrypted passwords must be enabled. For more details on how
4210 to do this, refer to <A
4211 HREF="ENCRYPTION.html"
4219 > The server must support domain logons and a
4228 > The server must be the domain master browser in order for Windows
4229 client to locate the server as a DC. Please refer to the various
4230 Network Browsing documentation included with this distribution for
4236 >As Samba 2.2 does not offer a complete implementation of group mapping
4237 between Windows NT groups and Unix groups (this is really quite
4238 complicated to explain in a short space), you should refer to the
4240 HREF="smb.conf.5.html#DOMAINADMINGROUP"
4244 > smb.conf parameter for information of creating "Domain
4245 Admins" style accounts.</P
4254 >6.4. Creating Machine Trust Accounts and Joining Clients to the
4257 >A machine trust account is a Samba account that is used to
4258 authenticate a client machine (rather than a user) to the Samba
4259 server. In Windows terminology, this is known as a "Computer
4262 >The password of a machine trust account acts as the shared secret for
4263 secure communication with the Domain Controller. This is a security
4264 feature to prevent an unauthorized machine with the same NetBIOS name
4265 from joining the domain and gaining access to domain user/group
4266 accounts. Windows NT and 2000 clients use machine trust accounts, but
4267 Windows 9x clients do not. Hence, a Windows 9x client is never a true
4268 member of a domain because it does not possess a machine trust
4269 account, and thus has no shared secret with the domain controller.</P
4271 >A Windows PDC stores each machine trust account in the Windows
4272 Registry. A Samba PDC, however, stores each machine trust account
4273 in two parts, as follows:
4280 >A Samba account, stored in the same location as user
4281 LanMan and NT password hashes (currently
4285 >). The Samba account
4286 possesses and uses only the NT password hash.</P
4290 >A corresponding Unix account, typically stored in
4294 >. (Future releases will alleviate the need to
4303 >There are two ways to create machine trust accounts:</P
4309 > Manual creation. Both the Samba and corresponding
4310 Unix account are created by hand.</P
4314 > "On-the-fly" creation. The Samba machine trust
4315 account is automatically created by Samba at the time the client
4316 is joined to the domain. (For security, this is the
4317 recommended method.) The corresponding Unix account may be
4318 created automatically or manually. </P
4328 >6.4.1. Manual Creation of Machine Trust Accounts</H3
4330 >The first step in manually creating a machine trust account is to
4331 manually create the corresponding Unix account in
4335 >. This can be done using
4339 > or other 'add user' command that is normally
4340 used to create new Unix accounts. The following is an example for a
4341 Linux based Samba server:</P
4348 >/usr/sbin/useradd -g 100 -d /dev/null -c <TT
4375 >On *BSD systems, this can be done using the 'chpass' utility:</P
4387 >$:*:101:100::0:0:Workstation <TT
4392 >:/dev/null:/sbin/nologin"</B
4398 > entry will list the machine name
4399 with a "$" appended, won't have a password, will have a null shell and no
4400 home directory. For example a machine named 'doppy' would have an
4404 > entry like this:</P
4407 CLASS="PROGRAMLISTING"
4408 >doppy$:x:505:501:<TT
4411 >machine_nickname</I
4413 >:/dev/null:/bin/false</PRE
4419 >machine_nickname</I
4422 descriptive name for the client, i.e., BasementComputer.
4428 > absolutely must be the NetBIOS
4429 name of the client to be joined to the domain. The "$" must be
4430 appended to the NetBIOS name of the client or Samba will not recognize
4431 this as a machine trust account.</P
4433 >Now that the corresponding Unix account has been created, the next step is to create
4434 the Samba account for the client containing the well-known initial
4435 machine trust account password. This can be done using the <A
4436 HREF="smbpasswd.8.html"
4450 >smbpasswd -a -m <TT
4463 > is the machine's NetBIOS
4464 name. The RID of the new machine account is generated from the UID of
4465 the corresponding Unix account.</P
4480 SRC="/docbook-dsssl/warning.gif"
4487 >Join the client to the domain immediately</B
4497 > Manually creating a machine trust account using this method is the
4498 equivalent of creating a machine trust account on a Windows NT PDC using
4499 the "Server Manager". From the time at which the account is created
4500 to the time which the client joins the domain and changes the password,
4501 your domain is vulnerable to an intruder joining your domain using a
4502 a machine with the same NetBIOS name. A PDC inherently trusts
4503 members of the domain and will serve out a large degree of user
4504 information to such clients. You have been warned!
4518 >6.4.2. "On-the-Fly" Creation of Machine Trust Accounts</H3
4520 >The second (and recommended) way of creating machine trust accounts is
4521 simply to allow the Samba server to create them as needed when the client
4522 is joined to the domain. </P
4524 >Since each Samba machine trust account requires a corresponding
4525 Unix account, a method for automatically creating the
4526 Unix account is usually supplied; this requires configuration of the
4528 HREF="smb.conf.5.html#ADDUSERSCRIPT"
4536 method is not required, however; corresponding Unix accounts may also
4537 be created manually.</P
4539 >Below is an example for a RedHat 6.2 Linux system.</P
4542 CLASS="PROGRAMLISTING"
4544 # <...remainder of parameters...>
4545 add user script = /usr/sbin/useradd -d /dev/null -g 100 -s /bin/false -M %u </PRE
4555 >6.4.3. Joining the Client to the Domain</H3
4557 >The procedure for joining a client to the domain varies with the
4558 version of Windows.</P
4572 > When the user elects to join the client to a domain, Windows prompts for
4573 an account and password that is privileged to join the domain. A
4574 Samba administrative account (i.e., a Samba account that has root
4575 privileges on the Samba server) must be entered here; the
4576 operation will fail if an ordinary user account is given.
4577 The password for this account should be
4578 set to a different password than the associated
4582 > entry, for security
4585 >The session key of the Samba administrative account acts as an
4586 encryption key for setting the password of the machine trust
4587 account. The machine trust account will be created on-the-fly, or
4588 updated if it already exists.</P
4600 > If the machine trust account was created manually, on the
4601 Identification Changes menu enter the domain name, but do not
4602 check the box "Create a Computer Account in the Domain." In this case,
4603 the existing machine trust account is used to join the machine to
4606 > If the machine trust account is to be created
4607 on-the-fly, on the Identification Changes menu enter the domain
4608 name, and check the box "Create a Computer Account in the Domain." In
4609 this case, joining the domain proceeds as above for Windows 2000
4610 (i.e., you must supply a Samba administrative account when
4623 >6.5. Common Problems and Errors</H2
4635 >I cannot include a '$' in a machine name.</I
4640 > A 'machine name' in (typically) <TT
4644 of the machine name with a '$' appended. FreeBSD (and other BSD
4645 systems?) won't create a user with a '$' in their name.
4648 > The problem is only in the program used to make the entry, once
4649 made, it works perfectly. So create a user without the '$' and
4653 > to edit the entry, adding the '$'. Or create
4654 the whole entry with vipw if you like, make sure you use a
4664 >I get told "You already have a connection to the Domain...."
4665 or "Cannot join domain, the credentials supplied conflict with an
4666 existing set.." when creating a machine trust account.</I
4671 > This happens if you try to create a machine trust account from the
4672 machine itself and already have a connection (e.g. mapped drive)
4673 to a share (or IPC$) on the Samba PDC. The following command
4674 will remove all network drive connections:
4686 > Further, if the machine is a already a 'member of a workgroup' that
4687 is the same name as the domain you are joining (bad idea) you will
4688 get this message. Change the workgroup name to something else, it
4689 does not matter what, reboot, and try again.
4698 >The system can not log you on (C000019B)....</I
4703 >I joined the domain successfully but after upgrading
4704 to a newer version of the Samba code I get the message, "The system
4705 can not log you on (C000019B), Please try a gain or consult your
4706 system administrator" when attempting to logon.
4709 > This occurs when the domain SID stored in
4712 >private/WORKGROUP.SID</TT
4714 changed. For example, you remove the file and <B
4718 creates a new one. Or you are swapping back and forth between
4719 versions 2.0.7, TNG and the HEAD branch code (not recommended). The
4720 only way to correct the problem is to restore the original domain
4721 SID or remove the domain client from the domain and rejoin.
4730 >The machine trust account for this computer either does not
4731 exist or is not accessible.</I
4736 > When I try to join the domain I get the message "The machine account
4737 for this computer either does not exist or is not accessible". What's
4741 > This problem is caused by the PDC not having a suitable machine trust account.
4742 If you are using the <TT
4748 accounts then this would indicate that it has not worked. Ensure the domain
4749 admin user system is working.
4752 > Alternatively if you are creating account entries manually then they
4753 have not been created correctly. Make sure that you have the entry
4754 correct for the machine trust account in smbpasswd file on the Samba PDC.
4755 If you added the account using an editor rather than using the smbpasswd
4756 utility, make sure that the account name is the machine NetBIOS name
4757 with a '$' appended to it ( i.e. computer_name$ ). There must be an entry
4758 in both /etc/passwd and the smbpasswd file. Some people have reported
4759 that inconsistent subnet masks between the Samba server and the NT
4760 client have caused this problem. Make sure that these are consistent
4761 for both client and server.
4770 >When I attempt to login to a Samba Domain from a NT4/W2K workstation,
4771 I get a message about my account being disabled.</I
4776 > This problem is caused by a PAM related bug in Samba 2.2.0. This bug is
4777 fixed in 2.2.1. Other symptoms could be unaccessible shares on
4778 NT/W2K member servers in the domain or the following error in your smbd.log:
4779 passdb/pampass.c:pam_account(268) PAM: UNKNOWN ERROR for User: %user%
4782 > At first be ensure to enable the useraccounts with <B
4786 >, this is normally done, when you create an account.
4789 > In order to work around this problem in 2.2.0, configure the
4798 >/etc/pam.d/samba</TT
4803 CLASS="PROGRAMLISTING"
4804 > account required pam_permit.so
4808 > If you want to remain backward compatibility to samba 2.0.x use
4812 >, it's also possible to use
4816 >. There are some bugs if you try to
4820 >, if you need this, be ensure to use
4821 the most recent version of this file.
4833 >6.6. System Policies and Profiles</H2
4835 >Much of the information necessary to implement System Policies and
4836 Roving User Profiles in a Samba domain is the same as that for
4837 implementing these same items in a Windows NT 4.0 domain.
4838 You should read the white paper <A
4839 HREF="http://www.microsoft.com/ntserver/management/deployment/planguide/prof_policies.asp"
4842 Profiles and Policies in Windows NT 4.0</A
4843 > available from Microsoft.</P
4845 >Here are some additional details:</P
4855 >What about Windows NT Policy Editor?</I
4860 > To create or edit <TT
4864 the NT Server Policy Editor, <B
4868 is included with NT Server but <SPAN
4872 >not NT Workstation</I
4875 There is a Policy Editor on a NTws
4876 but it is not suitable for creating <SPAN
4883 Further, although the Windows 95
4884 Policy Editor can be installed on an NT Workstation/Server, it will not
4885 work with NT policies because the registry key that are set by the policy templates.
4886 However, the files from the NT Server will run happily enough on an NTws.
4889 >poledit.exe, common.adm</TT
4894 to put the two *.adm files in <TT
4898 the binary will look for them unless told otherwise. Note also that that
4899 directory is 'hidden'.
4902 > The Windows NT policy editor is also included with the Service Pack 3 (and
4903 later) for Windows NT 4.0. Extract the files using <B
4905 >servicepackname /x</B
4910 > for service pack 6a. The policy editor,
4914 > and the associated template files (*.adm) should
4915 be extracted as well. It is also possible to downloaded the policy template
4916 files for Office97 and get a copy of the policy editor. Another possible
4917 location is with the Zero Administration Kit available for download from Microsoft.
4926 >Can Win95 do Policies?</I
4931 > Install the group policy handler for Win9x to pick up group
4932 policies. Look on the Win98 CD in <TT
4934 >\tools\reskit\netadmin\poledit</TT
4936 Install group policies on a Win9x client by double-clicking
4940 >. Log off and on again a couple of
4941 times and see if Win98 picks up group policies. Unfortunately this needs
4942 to be done on every Win9x machine that uses group policies....
4945 > If group policies don't work one reports suggests getting the updated
4946 (read: working) grouppol.dll for Windows 9x. The group list is grabbed
4956 >How do I get 'User Manager' and 'Server Manager'</I
4961 > Since I don't need to buy an NT Server CD now, how do I get
4962 the 'User Manager for Domains', the 'Server Manager'?
4965 > Microsoft distributes a version of these tools called nexus for
4966 installation on Windows 95 systems. The tools set includes
4977 >User Manager for Domains</P
4985 > Click here to download the archived file <A
4986 HREF="ftp://ftp.microsoft.com/Softlib/MSLFILES/NEXUS.EXE"
4988 >ftp://ftp.microsoft.com/Softlib/MSLFILES/NEXUS.EXE</A
4992 > The Windows NT 4.0 version of the 'User Manager for
4993 Domains' and 'Server Manager' are available from Microsoft via ftp
4995 HREF="ftp://ftp.microsoft.com/Softlib/MSLFILES/SRVTOOLS.EXE"
4997 >ftp://ftp.microsoft.com/Softlib/MSLFILES/SRVTOOLS.EXE</A
5010 >6.7. What other help can I get?</H2
5012 >There are many sources of information available in the form
5013 of mailing lists, RFC's and documentation. The docs that come
5014 with the samba distribution contain very good explanations of
5015 general SMB topics such as browsing.</P
5025 >What are some diagnostics tools I can use to debug the domain logon
5026 process and where can I find them?</I
5031 > One of the best diagnostic tools for debugging problems is Samba itself.
5032 You can use the -d option for both smbd and nmbd to specify what
5033 'debug level' at which to run. See the man pages on smbd, nmbd and
5034 smb.conf for more information on debugging options. The debug
5035 level can range from 1 (the default) to 10 (100 for debugging passwords).
5038 > Another helpful method of debugging is to compile samba using the
5042 > flag. This will include debug
5043 information in the binaries and allow you to attach gdb to the
5044 running smbd / nmbd process. In order to attach gdb to an smbd
5045 process for an NT workstation, first get the workstation to make the
5046 connection. Pressing ctrl-alt-delete and going down to the domain box
5047 is sufficient (at least, on the first time you join the domain) to
5048 generate a 'LsaEnumTrustedDomains'. Thereafter, the workstation
5049 maintains an open connection, and therefore there will be an smbd
5050 process running (assuming that you haven't set a really short smbd
5051 idle timeout) So, in between pressing ctrl alt delete, and actually
5052 typing in your password, you can gdb attach and continue.
5055 > Some useful samba commands worth investigating:
5062 >testparam | more</P
5066 >smbclient -L //{netbios name of server}</P
5070 > An SMB enabled version of tcpdump is available from
5072 HREF="http://www.tcpdump.org/"
5074 >http://www.tcpdup.org/</A
5076 Ethereal, another good packet sniffer for Unix and Win32
5077 hosts, can be downloaded from <A
5078 HREF="http://www.ethereal.com/"
5080 >http://www.ethereal.com</A
5084 > For tracing things on the Microsoft Windows NT, Network Monitor
5085 (aka. netmon) is available on the Microsoft Developer Network CD's,
5086 the Windows NT Server install CD and the SMS CD's. The version of
5087 netmon that ships with SMS allows for dumping packets between any two
5088 computers (i.e. placing the network interface in promiscuous mode).
5089 The version on the NT Server install CD will only allow monitoring
5090 of network traffic directed to the local NT box and broadcasts on the
5091 local subnet. Be aware that Ethereal can read and write netmon
5101 >How do I install 'Network Monitor' on an NT Workstation
5102 or a Windows 9x box?</I
5107 > Installing netmon on an NT workstation requires a couple
5108 of steps. The following are for installing Netmon V4.00.349, which comes
5109 with Microsoft Windows NT Server 4.0, on Microsoft Windows NT
5110 Workstation 4.0. The process should be similar for other version of
5111 Windows NT / Netmon. You will need both the Microsoft Windows
5112 NT Server 4.0 Install CD and the Workstation 4.0 Install CD.
5115 > Initially you will need to install 'Network Monitor Tools and Agent'
5116 on the NT Server. To do this
5123 >Goto Start - Settings - Control Panel -
5124 Network - Services - Add </P
5128 >Select the 'Network Monitor Tools and Agent' and
5133 >Click 'OK' on the Network Control Panel.
5138 >Insert the Windows NT Server 4.0 install CD
5143 > At this point the Netmon files should exist in
5146 >%SYSTEMROOT%\System32\netmon\*.*</TT
5148 Two subdirectories exist as well, <TT
5152 which contains the necessary DLL's for parsing the netmon packet
5159 > In order to install the Netmon tools on an NT Workstation, you will
5160 first need to install the 'Network Monitor Agent' from the Workstation
5168 >Goto Start - Settings - Control Panel -
5169 Network - Services - Add</P
5173 >Select the 'Network Monitor Agent' and click
5178 >Click 'OK' on the Network Control Panel.
5183 >Insert the Windows NT Workstation 4.0 install
5184 CD when prompted.</P
5188 > Now copy the files from the NT Server in %SYSTEMROOT%\System32\netmon\*.*
5189 to %SYSTEMROOT%\System32\netmon\*.* on the Workstation and set
5190 permissions as you deem appropriate for your site. You will need
5191 administrative rights on the NT box to run netmon.
5194 > To install Netmon on a Windows 9x box install the network monitor agent
5195 from the Windows 9x CD (\admin\nettools\netmon). There is a readme
5196 file located with the netmon driver files on the CD if you need
5197 information on how to do this. Copy the files from a working
5198 Netmon installation.
5203 > The following is a list if helpful URLs and other links:
5210 >Home of Samba site <A
5211 HREF="http://samba.org"
5213 > http://samba.org</A
5214 >. We have a mirror near you !</P
5225 on the Samba mirrors might mention your problem. If so,
5226 it might mean that the developers are working on it.</P
5230 >See how Scott Merrill simulates a BDC behavior at
5232 HREF="http://www.skippy.net/linux/smb-howto.html"
5234 > http://www.skippy.net/linux/smb-howto.html</A
5239 >Although 2.0.7 has almost had its day as a PDC, David Bannon will
5240 keep the 2.0.7 PDC pages at <A
5241 HREF="http://bioserve.latrobe.edu.au/samba"
5243 > http://bioserve.latrobe.edu.au/samba</A
5244 > going for a while yet.</P
5248 >Misc links to CIFS information
5250 HREF="http://samba.org/cifs/"
5252 >http://samba.org/cifs/</A
5257 >NT Domains for Unix <A
5258 HREF="http://mailhost.cb1.com/~lkcl/ntdom/"
5260 > http://mailhost.cb1.com/~lkcl/ntdom/</A
5265 >FTP site for older SMB specs:
5267 HREF="ftp://ftp.microsoft.com/developr/drg/CIFS/"
5269 > ftp://ftp.microsoft.com/developr/drg/CIFS/</A
5284 >How do I get help from the mailing lists?</I
5289 > There are a number of Samba related mailing lists. Go to <A
5290 HREF="http://samba.org"
5292 >http://samba.org</A
5293 >, click on your nearest mirror
5294 and then click on <B
5297 > and then click on <B
5299 > Samba related mailing lists</B
5303 > For questions relating to Samba TNG go to
5305 HREF="http://www.samba-tng.org/"
5307 >http://www.samba-tng.org/</A
5309 It has been requested that you don't post questions about Samba-TNG to the
5310 main stream Samba lists.</P
5312 > If you post a message to one of the lists please observe the following guide lines :
5319 > Always remember that the developers are volunteers, they are
5320 not paid and they never guarantee to produce a particular feature at
5321 a particular time. Any time lines are 'best guess' and nothing more.
5326 > Always mention what version of samba you are using and what
5327 operating system its running under. You should probably list the
5328 relevant sections of your smb.conf file, at least the options
5329 in [global] that affect PDC support.</P
5333 >In addition to the version, if you obtained Samba via
5334 CVS mention the date when you last checked it out.</P
5338 > Try and make your question clear and brief, lots of long,
5339 convoluted questions get deleted before they are completely read !
5340 Don't post html encoded messages (if you can select colour or font
5345 > If you run one of those nifty 'I'm on holidays' things when
5346 you are away, make sure its configured to not answer mailing lists.
5351 > Don't cross post. Work out which is the best list to post to
5352 and see what happens, i.e. don't post to both samba-ntdom and samba-technical.
5353 Many people active on the lists subscribe to more
5354 than one list and get annoyed to see the same message two or more times.
5355 Often someone will see a message and thinking it would be better dealt
5356 with on another, will forward it on for you.</P
5360 >You might include <SPAN
5367 log files written at a debug level set to as much as 20.
5368 Please don't send the entire log but enough to give the context of the
5373 >(Possibly) If you have a complete netmon trace ( from the opening of
5374 the pipe to the error ) you can send the *.CAP file as well.</P
5378 >Please think carefully before attaching a document to an email.
5379 Consider pasting the relevant parts into the body of the message. The samba
5380 mailing lists go to a huge number of people, do they all need a copy of your
5381 smb.conf in their attach directory?</P
5391 >How do I get off the mailing lists?</I
5396 >To have your name removed from a samba mailing list, go to the
5397 same place you went to to get on it. Go to <A
5398 HREF="http://lists.samba.org/"
5400 >http://lists.samba.org</A
5402 click on your nearest mirror and then click on <B
5408 > Samba related mailing lists</B
5411 HREF="http://lists.samba.org/mailman/roster/samba-ntdom"
5417 > Please don't post messages to the list asking to be removed, you will just
5418 be referred to the above address (unless that process failed in some way...)
5430 >6.8. Domain Control for Windows 9x/ME</H2
5445 SRC="/docbook-dsssl/note.gif"
5452 >The following section contains much of the original
5453 DOMAIN.txt file previously included with Samba. Much of
5454 the material is based on what went into the book <SPAN
5459 Edition, Using Samba</I
5461 >, by Richard Sharpe.</P
5467 >A domain and a workgroup are exactly the same thing in terms of network
5468 browsing. The difference is that a distributable authentication
5469 database is associated with a domain, for secure login access to a
5470 network. Also, different access rights can be granted to users if they
5471 successfully authenticate against a domain logon server (NT server and
5472 other systems based on NT server support this, as does at least Samba TNG now).</P
5474 >The SMB client logging on to a domain has an expectation that every other
5475 server in the domain should accept the same authentication information.
5476 Network browsing functionality of domains and workgroups is
5477 identical and is explained in BROWSING.txt. It should be noted, that browsing
5478 is totally orthogonal to logon support.</P
5480 >Issues related to the single-logon network model are discussed in this
5481 section. Samba supports domain logons, network logon scripts, and user
5482 profiles for MS Windows for workgroups and MS Windows 9X/ME clients
5483 which will be the focus of this section.</P
5485 >When an SMB client in a domain wishes to logon it broadcast requests for a
5486 logon server. The first one to reply gets the job, and validates its
5487 password using whatever mechanism the Samba administrator has installed.
5488 It is possible (but very stupid) to create a domain where the user
5489 database is not shared between servers, i.e. they are effectively workgroup
5490 servers advertising themselves as participating in a domain. This
5491 demonstrates how authentication is quite different from but closely
5492 involved with domains.</P
5494 >Using these features you can make your clients verify their logon via
5495 the Samba server; make clients run a batch file when they logon to
5496 the network and download their preferences, desktop and start menu.</P
5498 >Before launching into the configuration instructions, it is
5499 worthwhile lookingat how a Windows 9x/ME client performs a logon:</P
5506 > The client broadcasts (to the IP broadcast address of the subnet it is in)
5507 a NetLogon request. This is sent to the NetBIOS name DOMAIN<1c> at the
5508 NetBIOS layer. The client chooses the first response it receives, which
5509 contains the NetBIOS name of the logon server to use in the format of
5515 > The client then connects to that server, logs on (does an SMBsessetupX) and
5516 then connects to the IPC$ share (using an SMBtconX).
5521 > The client then does a NetWkstaUserLogon request, which retrieves the name
5522 of the user's logon script.
5527 > The client then connects to the NetLogon share and searches for this
5528 and if it is found and can be read, is retrieved and executed by the client.
5529 After this, the client disconnects from the NetLogon share.
5534 > The client then sends a NetUserGetInfo request to the server, to retrieve
5535 the user's home share, which is used to search for profiles. Since the
5536 response to the NetUserGetInfo request does not contain much more
5537 the user's home share, profiles for Win9X clients MUST reside in the user
5543 > The client then connects to the user's home share and searches for the
5544 user's profile. As it turns out, you can specify the user's home share as
5545 a sharename and path. For example, \\server\fred\.profile.
5546 If the profiles are found, they are implemented.
5551 > The client then disconnects from the user's home share, and reconnects to
5552 the NetLogon share and looks for CONFIG.POL, the policies file. If this is
5553 found, it is read and implemented.
5564 >6.8.1. Configuration Instructions: Network Logons</H3
5566 >The main difference between a PDC and a Windows 9x logon
5567 server configuration is that</P
5573 >Password encryption is not required for a Windows 9x logon server.</P
5577 >Windows 9x/ME clients do not possess machine trust accounts.</P
5581 >Therefore, a Samba PDC will also act as a Windows 9x logon
5597 SRC="/docbook-dsssl/warning.gif"
5604 >security mode and master browsers</B
5614 >There are a few comments to make in order to tie up some
5615 loose ends. There has been much debate over the issue of whether
5616 or not it is ok to configure Samba as a Domain Controller in security
5617 modes other than <TT
5620 >. The only security mode
5621 which will not work due to technical reasons is <TT
5632 mode security is really just a variation on SMB user level security.</P
5634 >Actually, this issue is also closely tied to the debate on whether
5635 or not Samba must be the domain master browser for its workgroup
5636 when operating as a DC. While it may technically be possible
5637 to configure a server as such (after all, browsing and domain logons
5638 are two distinctly different functions), it is not a good idea to
5639 so. You should remember that the DC must register the DOMAIN#1b NetBIOS
5640 name. This is the name used by Windows clients to locate the DC.
5641 Windows clients do not distinguish between the DC and the DMB.
5642 For this reason, it is very wise to configure the Samba DC as the DMB.</P
5644 >Now back to the issue of configuring a Samba DC to use a mode other
5645 than "security = user". If a Samba host is configured to use
5646 another SMB server or DC in order to validate user connection
5647 requests, then it is a fact that some other machine on the network
5648 (the "password server") knows more about user than the Samba host.
5649 99% of the time, this other host is a domain controller. Now
5650 in order to operate in domain mode security, the "workgroup" parameter
5651 must be set to the name of the Windows NT domain (which already
5652 has a domain controller, right?)</P
5654 >Therefore configuring a Samba box as a DC for a domain that
5655 already by definition has a PDC is asking for trouble.
5656 Therefore, you should always configure the Samba DC to be the DMB
5670 >6.8.2. Configuration Instructions: Setting up Roaming User Profiles</H3
5685 SRC="/docbook-dsssl/warning.gif"
5698 > Roaming profiles support is different
5699 for Win9X and WinNT.</P
5705 >Before discussing how to configure roaming profiles, it is useful to see how
5706 Win9X and WinNT clients implement these features.</P
5708 >Win9X clients send a NetUserGetInfo request to the server to get the user's
5709 profiles location. However, the response does not have room for a separate
5710 profiles location field, only the user's home share. This means that Win9X
5711 profiles are restricted to being in the user's home directory.</P
5713 >WinNT clients send a NetSAMLogon RPC request, which contains many fields,
5714 including a separate field for the location of the user's profiles.
5715 This means that support for profiles is different for Win9X and WinNT.</P
5723 >6.8.2.1. Windows NT Configuration</H4
5725 >To support WinNT clients, in the [global] section of smb.conf set the
5726 following (for example):</P
5729 CLASS="PROGRAMLISTING"
5730 >logon path = \\profileserver\profileshare\profilepath\%U\moreprofilepath</PRE
5733 >The default for this option is \\%N\%U\profile, namely
5734 \\sambaserver\username\profile. The \\N%\%U service is created
5735 automatically by the [homes] service.
5736 If you are using a samba server for the profiles, you _must_ make the
5737 share specified in the logon path browseable. </P
5752 SRC="/docbook-dsssl/note.gif"
5759 >[lkcl 26aug96 - we have discovered a problem where Windows clients can
5760 maintain a connection to the [homes] share in between logins. The
5761 [homes] share must NOT therefore be used in a profile path.]</P
5774 >6.8.2.2. Windows 9X Configuration</H4
5776 >To support Win9X clients, you must use the "logon home" parameter. Samba has
5777 now been fixed so that "net use/home" now works as well, and it, too, relies
5778 on the "logon home" parameter.</P
5780 >By using the logon home parameter, you are restricted to putting Win9X
5781 profiles in the user's home directory. But wait! There is a trick you
5782 can use. If you set the following in the [global] section of your
5786 CLASS="PROGRAMLISTING"
5787 >logon home = \\%L\%U\.profiles</PRE
5790 >then your Win9X clients will dutifully put their clients in a subdirectory
5791 of your home directory called .profiles (thus making them hidden).</P
5793 >Not only that, but 'net use/home' will also work, because of a feature in
5794 Win9X. It removes any directory stuff off the end of the home directory area
5795 and only uses the server and share portion. That is, it looks like you
5796 specified \\%L\%U for "logon home".</P
5805 >6.8.2.3. Win9X and WinNT Configuration</H4
5807 >You can support profiles for both Win9X and WinNT clients by setting both the
5808 "logon home" and "logon path" parameters. For example:</P
5811 CLASS="PROGRAMLISTING"
5812 >logon home = \\%L\%U\.profiles
5813 logon path = \\%L\profiles\%U</PRE
5829 SRC="/docbook-dsssl/note.gif"
5836 >I have not checked what 'net use /home' does on NT when "logon home" is
5850 >6.8.2.4. Windows 9X Profile Setup</H4
5852 >When a user first logs in on Windows 9X, the file user.DAT is created,
5853 as are folders "Start Menu", "Desktop", "Programs" and "Nethood".
5854 These directories and their contents will be merged with the local
5855 versions stored in c:\windows\profiles\username on subsequent logins,
5856 taking the most recent from each. You will need to use the [global]
5857 options "preserve case = yes", "short preserve case = yes" and
5858 "case sensitive = no" in order to maintain capital letters in shortcuts
5859 in any of the profile folders.</P
5861 >The user.DAT file contains all the user's preferences. If you wish to
5862 enforce a set of preferences, rename their user.DAT file to user.MAN,
5863 and deny them write access to this file.</P
5870 > On the Windows 95 machine, go to Control Panel | Passwords and
5871 select the User Profiles tab. Select the required level of
5872 roaming preferences. Press OK, but do _not_ allow the computer
5878 > On the Windows 95 machine, go to Control Panel | Network |
5879 Client for Microsoft Networks | Preferences. Select 'Log on to
5880 NT Domain'. Then, ensure that the Primary Logon is 'Client for
5881 Microsoft Networks'. Press OK, and this time allow the computer
5887 >Under Windows 95, Profiles are downloaded from the Primary Logon.
5888 If you have the Primary Logon as 'Client for Novell Networks', then
5889 the profiles and logon script will be downloaded from your Novell
5890 Server. If you have the Primary Logon as 'Windows Logon', then the
5891 profiles will be loaded from the local machine - a bit against the
5892 concept of roaming profiles, if you ask me.</P
5894 >You will now find that the Microsoft Networks Login box contains
5895 [user, password, domain] instead of just [user, password]. Type in
5896 the samba server's domain name (or any other domain known to exist,
5897 but bear in mind that the user will be authenticated against this
5898 domain and profiles downloaded from it, if that domain logon server
5899 supports it), user name and user's password.</P
5901 >Once the user has been successfully validated, the Windows 95 machine
5902 will inform you that 'The user has not logged on before' and asks you
5903 if you wish to save the user's preferences? Select 'yes'.</P
5905 >Once the Windows 95 client comes up with the desktop, you should be able
5906 to examine the contents of the directory specified in the "logon path"
5907 on the samba server and verify that the "Desktop", "Start Menu",
5908 "Programs" and "Nethood" folders have been created.</P
5910 >These folders will be cached locally on the client, and updated when
5911 the user logs off (if you haven't made them read-only by then :-).
5912 You will find that if the user creates further folders or short-cuts,
5913 that the client will merge the profile contents downloaded with the
5914 contents of the profile directory already on the local client, taking
5915 the newest folders and short-cuts from each set.</P
5917 >If you have made the folders / files read-only on the samba server,
5918 then you will get errors from the w95 machine on logon and logout, as
5919 it attempts to merge the local and the remote profile. Basically, if
5920 you have any errors reported by the w95 machine, check the Unix file
5921 permissions and ownership rights on the profile directory contents,
5922 on the samba server.</P
5924 >If you have problems creating user profiles, you can reset the user's
5925 local desktop cache, as shown below. When this user then next logs in,
5926 they will be told that they are logging in "for the first time".</P
5933 > instead of logging in under the [user, password, domain] dialog,
5939 > run the regedit.exe program, and look in:
5942 > HKEY_LOCAL_MACHINE\Windows\CurrentVersion\ProfileList
5945 > you will find an entry, for each user, of ProfilePath. Note the
5946 contents of this key (likely to be c:\windows\profiles\username),
5947 then delete the key ProfilePath for the required user.
5950 > [Exit the registry editor].
5961 > - before deleting the contents of the
5963 the ProfilePath (this is likely to be c:\windows\profiles\username),
5964 ask them if they have any important files stored on their desktop
5965 or in their start menu. delete the contents of the directory
5966 ProfilePath (making a backup if any of the files are needed).
5969 > This will have the effect of removing the local (read-only hidden
5970 system file) user.DAT in their profile directory, as well as the
5971 local "desktop", "nethood", "start menu" and "programs" folders.
5976 > search for the user's .PWL password-caching file in the c:\windows
5977 directory, and delete it.
5982 > log off the windows 95 client.
5987 > check the contents of the profile path (see "logon path" described
5988 above), and delete the user.DAT or user.MAN file for the user,
5989 making a backup if required.
5994 >If all else fails, increase samba's debug log levels to between 3 and 10,
5995 and / or run a packet trace program such as tcpdump or netmon.exe, and
5996 look for any error reports.</P
5998 >If you have access to an NT server, then first set up roaming profiles
5999 and / or netlogons on the NT server. Make a packet trace, or examine
6000 the example packet traces provided with NT server, and see what the
6001 differences are with the equivalent samba trace.</P
6010 >6.8.2.5. Windows NT Workstation 4.0</H4
6012 >When a user first logs in to a Windows NT Workstation, the profile
6013 NTuser.DAT is created. The profile location can be now specified
6014 through the "logon path" parameter. </P
6029 SRC="/docbook-dsssl/note.gif"
6036 >[lkcl 10aug97 - i tried setting the path to
6037 \\samba-server\homes\profile, and discovered that this fails because
6038 a background process maintains the connection to the [homes] share
6039 which does _not_ close down in between user logins. you have to
6040 have \\samba-server\%L\profile, where user is the username created
6041 from the [homes] share].</P
6047 >There is a parameter that is now available for use with NT Profiles:
6048 "logon drive". This should be set to "h:" or any other drive, and
6049 should be used in conjunction with the new "logon home" parameter.</P
6051 >The entry for the NT 4.0 profile is a _directory_ not a file. The NT
6052 help on profiles mentions that a directory is also created with a .PDS
6053 extension. The user, while logging in, must have write permission to
6054 create the full profile path (and the folder with the .PDS extension)
6055 [lkcl 10aug97 - i found that the creation of the .PDS directory failed,
6056 and had to create these manually for each user, with a shell script.
6057 also, i presume, but have not tested, that the full profile path must
6058 be browseable just as it is for w95, due to the manner in which they
6059 attempt to create the full profile path: test existence of each path
6060 component; create path component].</P
6062 >In the profile directory, NT creates more folders than 95. It creates
6063 "Application Data" and others, as well as "Desktop", "Nethood",
6064 "Start Menu" and "Programs". The profile itself is stored in a file
6065 NTuser.DAT. Nothing appears to be stored in the .PDS directory, and
6066 its purpose is currently unknown.</P
6068 >You can use the System Control Panel to copy a local profile onto
6069 a samba server (see NT Help on profiles: it is also capable of firing
6070 up the correct location in the System Control Panel for you). The
6071 NT Help file also mentions that renaming NTuser.DAT to NTuser.MAN
6072 turns a profile into a mandatory one.</P
6087 SRC="/docbook-dsssl/note.gif"
6094 >[lkcl 10aug97 - i notice that NT Workstation tells me that it is
6095 downloading a profile from a slow link. whether this is actually the
6096 case, or whether there is some configuration issue, as yet unknown,
6097 that makes NT Workstation _think_ that the link is a slow one is a
6098 matter to be resolved].</P
6100 >[lkcl 20aug97 - after samba digest correspondence, one user found, and
6101 another confirmed, that profiles cannot be loaded from a samba server
6102 unless "security = user" and "encrypt passwords = yes" (see the file
6103 ENCRYPTION.txt) or "security = server" and "password server = ip.address.
6104 of.yourNTserver" are used. Either of these options will allow the NT
6105 workstation to access the samba server using LAN manager encrypted
6106 passwords, without the user intervention normally required by NT
6107 workstation for clear-text passwords].</P
6109 >[lkcl 25aug97 - more comments received about NT profiles: the case of
6110 the profile _matters_. the file _must_ be called NTuser.DAT or, for
6111 a mandatory profile, NTuser.MAN].</P
6124 >6.8.2.6. Windows NT Server</H4
6126 >There is nothing to stop you specifying any path that you like for the
6127 location of users' profiles. Therefore, you could specify that the
6128 profile be stored on a samba server, or any other SMB server, as long as
6129 that SMB server supports encrypted passwords.</P
6138 >6.8.2.7. Sharing Profiles between W95 and NT Workstation 4.0</H4
6153 SRC="/docbook-dsssl/warning.gif"
6160 >Potentially outdated or incorrect material follows</B
6170 >I think this is all bogus, but have not deleted it. (Richard Sharpe)</P
6176 >The default logon path is \\%N\%U. NT Workstation will attempt to create
6177 a directory "\\samba-server\username.PDS" if you specify the logon path
6178 as "\\samba-server\username" with the NT User Manager. Therefore, you
6179 will need to specify (for example) "\\samba-server\username\profile".
6180 NT 4.0 will attempt to create "\\samba-server\username\profile.PDS", which
6181 is more likely to succeed.</P
6183 >If you then want to share the same Start Menu / Desktop with W95, you will
6184 need to specify "logon path = \\samba-server\username\profile" [lkcl 10aug97
6185 this has its drawbacks: i created a shortcut to telnet.exe, which attempts
6186 to run from the c:\winnt\system32 directory. this directory is obviously
6187 unlikely to exist on a Win95-only host].</P
6189 > If you have this set up correctly, you will find separate user.DAT and
6190 NTuser.DAT files in the same profile directory.</P
6205 SRC="/docbook-dsssl/note.gif"
6212 >[lkcl 25aug97 - there are some issues to resolve with downloading of
6213 NT profiles, probably to do with time/date stamps. i have found that
6214 NTuser.DAT is never updated on the workstation after the first time that
6215 it is copied to the local workstation profile directory. this is in
6216 contrast to w95, where it _does_ transfer / update profiles correctly].</P
6231 >6.9. DOMAIN_CONTROL.txt : Windows NT Domain Control & Samba</H2
6246 SRC="/docbook-dsssl/warning.gif"
6253 >Possibly Outdated Material</B
6263 > This appendix was originally authored by John H Terpstra of
6264 the Samba Team and is included here for posterity.
6278 The term "Domain Controller" and those related to it refer to one specific
6279 method of authentication that can underly an SMB domain. Domain Controllers
6280 prior to Windows NT Server 3.1 were sold by various companies and based on
6281 private extensions to the LAN Manager 2.1 protocol. Windows NT introduced
6282 Microsoft-specific ways of distributing the user authentication database.
6283 See DOMAIN.txt for examples of how Samba can participate in or create
6284 SMB domains based on shared authentication database schemes other than the
6287 >Windows NT Server can be installed as either a plain file and print server
6288 (WORKGROUP workstation or server) or as a server that participates in Domain
6289 Control (DOMAIN member, Primary Domain controller or Backup Domain controller).
6290 The same is true for OS/2 Warp Server, Digital Pathworks and other similar
6291 products, all of which can participate in Domain Control along with Windows NT.</P
6293 >To many people these terms can be confusing, so let's try to clear the air.</P
6295 >Every Windows NT system (workstation or server) has a registry database.
6296 The registry contains entries that describe the initialization information
6297 for all services (the equivalent of Unix Daemons) that run within the Windows
6298 NT environment. The registry also contains entries that tell application
6299 software where to find dynamically loadable libraries that they depend upon.
6300 In fact, the registry contains entries that describes everything that anything
6301 may need to know to interact with the rest of the system.</P
6303 >The registry files can be located on any Windows NT machine by opening a
6304 command prompt and typing:</P
6309 > dir %SystemRoot%\System32\config</P
6311 >The environment variable %SystemRoot% value can be obtained by typing:</P
6316 >echo %SystemRoot%</P
6318 >The active parts of the registry that you may want to be familiar with are
6319 the files called: default, system, software, sam and security.</P
6321 >In a domain environment, Microsoft Windows NT domain controllers participate
6322 in replication of the SAM and SECURITY files so that all controllers within
6323 the domain have an exactly identical copy of each.</P
6325 >The Microsoft Windows NT system is structured within a security model that
6326 says that all applications and services must authenticate themselves before
6327 they can obtain permission from the security manager to do what they set out
6330 >The Windows NT User database also resides within the registry. This part of
6331 the registry contains the user's security identifier, home directory, group
6332 memberships, desktop profile, and so on.</P
6334 >Every Windows NT system (workstation as well as server) will have its own
6335 registry. Windows NT Servers that participate in Domain Security control
6336 have a database that they share in common - thus they do NOT own an
6337 independent full registry database of their own, as do Workstations and
6340 >The User database is called the SAM (Security Access Manager) database and
6341 is used for all user authentication as well as for authentication of inter-
6342 process authentication (i.e. to ensure that the service action a user has
6343 requested is permitted within the limits of that user's privileges).</P
6345 >The Samba team have produced a utility that can dump the Windows NT SAM into
6346 smbpasswd format: see ENCRYPTION.txt for information on smbpasswd and
6347 /pub/samba/pwdump on your nearest Samba mirror for the utility. This
6348 facility is useful but cannot be easily used to implement SAM replication
6349 to Samba systems.</P
6351 >Windows for Workgroups, Windows 95, and Windows NT Workstations and Servers
6352 can participate in a Domain security system that is controlled by Windows NT
6353 servers that have been correctly configured. Almost every domain will have
6354 ONE Primary Domain Controller (PDC). It is desirable that each domain will
6355 have at least one Backup Domain Controller (BDC).</P
6357 >The PDC and BDCs then participate in replication of the SAM database so that
6358 each Domain Controlling participant will have an up to date SAM component
6359 within its registry.</P
6368 >Chapter 7. How to Act as a Backup Domain Controller in a Purely Samba Controlled Domain</H1
6376 >7.1. Prerequisite Reading</H2
6378 >Before you continue reading in this chapter, please make sure
6379 that you are comfortable with configuring a Samba PDC
6380 as described in the <A
6381 HREF="Samba-PDC-HOWTO.html"
6393 >7.2. Background</H2
6395 >What is a Domain Controller? It is a machine that is able to answer
6396 logon requests from workstations in a Windows NT Domain. Whenever a
6397 user logs into a Windows NT Workstation, the workstation connects to a
6398 Domain Controller and asks him whether the username and password the
6399 user typed in is correct. The Domain Controller replies with a lot of
6400 information about the user, for example the place where the users
6401 profile is stored, the users full name of the user. All this
6402 information is stored in the NT user database, the so-called SAM.</P
6404 >There are two kinds of Domain Controller in a NT 4 compatible Domain:
6405 A Primary Domain Controller (PDC) and one or more Backup Domain
6406 Controllers (BDC). The PDC contains the master copy of the
6407 SAM. Whenever the SAM has to change, for example when a user changes
6408 his password, this change has to be done on the PDC. A Backup Domain
6409 Controller is a machine that maintains a read-only copy of the
6410 SAM. This way it is able to reply to logon requests and authenticate
6411 users in case the PDC is not available. During this time no changes to
6412 the SAM are possible. Whenever changes to the SAM are done on the PDC,
6413 all BDC receive the changes from the PDC.</P
6415 >Since version 2.2 Samba officially supports domain logons for all
6416 current Windows Clients, including Windows 2000 and XP. This text
6417 assumes the domain to be named SAMBA. To be able to act as a PDC, some
6418 parameters in the [global]-section of the smb.conf have to be set:</P
6421 CLASS="PROGRAMLISTING"
6424 domain logons = yes</PRE
6427 >Several other things like a [homes] and a [netlogon] share also may be
6428 set along with settings for the profile path, the users home drive and
6429 others. This will not be covered in this document.</P
6438 >7.3. What qualifies a Domain Controller on the network?</H2
6440 >Every machine that is a Domain Controller for the domain SAMBA has to
6441 register the NetBIOS group name SAMBA#1c with the WINS server and/or
6442 by broadcast on the local network. The PDC also registers the unique
6443 NetBIOS name SAMBA#1b with the WINS server. The name type #1b is
6444 normally reserved for the domain master browser, a role that has
6445 nothing to do with anything related to authentication, but the
6446 Microsoft Domain implementation requires the domain master browser to
6447 be on the same machine as the PDC.</P
6455 >7.3.1. How does a Workstation find its domain controller?</H3
6457 >A NT workstation in the domain SAMBA that wants a local user to be
6458 authenticated has to find the domain controller for SAMBA. It does
6459 this by doing a NetBIOS name query for the group name SAMBA#1c. It
6460 assumes that each of the machines it gets back from the queries is a
6461 domain controller and can answer logon requests. To not open security
6462 holes both the workstation and the selected (TODO: How is the DC
6463 chosen) domain controller authenticate each other. After that the
6464 workstation sends the user's credentials (his name and password) to
6465 the domain controller, asking for approval.</P
6474 >7.3.2. When is the PDC needed?</H3
6476 >Whenever a user wants to change his password, this has to be done on
6477 the PDC. To find the PDC, the workstation does a NetBIOS name query
6478 for SAMBA#1b, assuming this machine maintains the master copy of the
6479 SAM. The workstation contacts the PDC, both mutually authenticate and
6480 the password change is done.</P
6490 >7.4. Can Samba be a Backup Domain Controller?</H2
6492 >With version 2.2, no. The native NT SAM replication protocols have
6493 not yet been fully implemented. The Samba Team is working on
6494 understanding and implementing the protocols, but this work has not
6495 been finished for version 2.2.</P
6497 >Can I get the benefits of a BDC with Samba? Yes. The main reason for
6498 implementing a BDC is availability. If the PDC is a Samba machine,
6499 a second Samba machine can be set up to
6500 service logon requests whenever the PDC is down.</P
6509 >7.5. How do I set up a Samba BDC?</H2
6511 >Several things have to be done:</P
6517 >The domain SID has to be the same on the PDC and the BDC. This used to
6518 be stored in the file private/MACHINE.SID. This file is not created
6519 anymore since Samba 2.2.5 or even earlier. Nowadays the domain SID is
6520 stored in the file private/secrets.tdb. Simply copying the secrets.tdb
6521 from the PDC to the BDC does not work, as the BDC would
6522 generate a new SID for itself and override the domain SID with this
6525 >To retrieve the domain SID from the PDC or an existing BDC and store it in the
6526 secrets.tdb, execute 'net rpc getsid' on the BDC.</P
6530 >The Unix user database has to be synchronized from the PDC to the
6531 BDC. This means that both the /etc/passwd and /etc/group have to be
6532 replicated from the PDC to the BDC. This can be done manually
6533 whenever changes are made, or the PDC is set up as a NIS master
6534 server and the BDC as a NIS slave server. To set up the BDC as a
6535 mere NIS client would not be enough, as the BDC would not be able to
6536 access its user database in case of a PDC failure.</P
6540 >The Samba password database in the file private/smbpasswd has to be
6541 replicated from the PDC to the BDC. This is a bit tricky, see the
6546 >Any netlogon share has to be replicated from the PDC to the
6547 BDC. This can be done manually whenever login scripts are changed,
6548 or it can be done automatically together with the smbpasswd
6553 >Finally, the BDC has to be found by the workstations. This can be done
6557 CLASS="PROGRAMLISTING"
6560 domain logons = yes</PRE
6563 >in the [global]-section of the smb.conf of the BDC. This makes the BDC
6564 only register the name SAMBA#1c with the WINS server. This is no
6565 problem as the name SAMBA#1c is a NetBIOS group name that is meant to
6566 be registered by more than one machine. The parameter 'domain master =
6567 no' forces the BDC not to register SAMBA#1b which as a unique NetBIOS
6568 name is reserved for the Primary Domain Controller.</P
6576 >7.5.1. How do I replicate the smbpasswd file?</H3
6578 >Replication of the smbpasswd file is sensitive. It has to be done
6579 whenever changes to the SAM are made. Every user's password change is
6580 done in the smbpasswd file and has to be replicated to the BDC. So
6581 replicating the smbpasswd file very often is necessary.</P
6583 >As the smbpasswd file contains plain text password equivalents, it
6584 must not be sent unencrypted over the wire. The best way to set up
6585 smbpasswd replication from the PDC to the BDC is to use the utility
6586 rsync. rsync can use ssh as a transport. ssh itself can be set up to
6587 accept *only* rsync transfer without requiring the user to type a
6598 >Chapter 8. Samba as a ADS domain member</H1
6600 >This is a VERY ROUGH guide to setting up the current (November 2001)
6601 pre-alpha version of Samba 3.0 with kerberos authentication against a
6602 Windows2000 KDC. The procedures listed here are likely to change as
6603 the code develops.</P
6605 >Pieces you need before you begin:
6613 >a Windows 2000 server.</TD
6617 >samba 3.0 or higher.</TD
6621 >the MIT kerberos development libraries (either install from the above sources or use a package). The heimdal libraries will not work.</TD
6625 >the OpenLDAP development libraries.</TD
6639 >8.1. Installing the required packages for Debian</H2
6641 >On Debian you need to install the following packages:
6668 >8.2. Installing the required packages for RedHat</H2
6670 >On RedHat this means you should have at least:
6678 >krb5-workstation (for kinit)</TD
6682 >krb5-libs (for linking with)</TD
6686 >krb5-devel (because you are compiling from source)</TD
6694 >in addition to the standard development environment.</P
6696 >Note that these are not standard on a RedHat install, and you may need
6697 to get them off CD2.</P
6706 >8.3. Compile Samba</H2
6708 >If your kerberos libraries are in a non-standard location then
6709 remember to add the configure option --with-krb5=DIR.</P
6711 >After you run configure make sure that include/config.h contains
6715 CLASS="PROGRAMLISTING"
6716 >#define HAVE_KRB5 1
6717 #define HAVE_LDAP 1</PRE
6720 >If it doesn't then configure did not find your krb5 libraries or
6721 your ldap libraries. Look in config.log to figure out why and fix
6724 >Then compile and install Samba as usual. You must use at least the
6725 following 3 options in smb.conf:</P
6728 CLASS="PROGRAMLISTING"
6729 > realm = YOUR.KERBEROS.REALM
6730 ads server = your.kerberos.server
6732 encrypt passwords = yes</PRE
6735 >Strictly speaking, you can omit the realm name and you can use an IP
6736 address for the ads server. In that case Samba will auto-detect these.</P
6738 >You do *not* need a smbpasswd file, although it won't do any harm
6739 and if you have one then Samba will be able to fall back to normal
6740 password security for older clients. I expect that the above
6741 required options will change soon when we get better active
6742 directory integration.</P
6751 >8.4. Setup your /etc/krb5.conf</H2
6753 >The minimal configuration for krb5.conf is:</P
6756 CLASS="PROGRAMLISTING"
6758 YOUR.KERBEROS.REALM = {
6759 kdc = your.kerberos.server
6763 >Test your config by doing a "kinit USERNAME@REALM" and making sure that
6764 your password is accepted by the Win2000 KDC. </P
6766 >NOTE: The realm must be uppercase. </P
6768 >You also must ensure that you can do a reverse DNS lookup on the IP
6769 address of your KDC. Also, the name that this reverse lookup maps to
6770 must either be the netbios name of the KDC (ie. the hostname with no
6771 domain attached) or it can alternatively be the netbios name
6772 followed by the realm. </P
6774 >The easiest way to ensure you get this right is to add a /etc/hosts
6775 entry mapping the IP address of your KDC to its netbios name. If you
6776 don't get this right then you will get a "local error" when you try
6777 to join the realm.</P
6779 >If all you want is kerberos support in smbclient then you can skip
6780 straight to step 5 now. Step 3 is only needed if you want kerberos
6790 >8.5. Create the computer account</H2
6792 >Do a "kinit" as a user that has authority to change arbitrary
6793 passwords on the KDC ("Administrator" is a good choice). Then as a
6794 user that has write permission on the Samba private directory
6807 >8.5.1. Possible errors</H3
6812 CLASS="VARIABLELIST"
6815 >"bash: kinit: command not found"</DT
6818 >kinit is in the krb5-workstation RPM on RedHat systems, and is in /usr/kerberos/bin, so it won't be in the path until you log in again (or open a new terminal)</P
6821 >"ADS support not compiled in"</DT
6824 >Samba must be reconfigured (remove config.cache) and recompiled (make clean all install) after the kerberos libs and headers are installed.</P
6838 >8.6. Test your server setup</H2
6840 >On a Windows 2000 client try <B
6842 >net use * \\server\share</B
6844 be logged in with kerberos without needing to know a password. If
6845 this fails then run <B
6848 >. Did you get a ticket for the
6849 server? Does it have an encoding type of DES-CBC-MD5 ? </P
6858 >8.7. Testing with smbclient</H2
6860 >On your Samba server try to login to a Win2000 server or your Samba
6861 server using smbclient and kerberos. Use smbclient as usual, but
6862 specify the -k option to choose kerberos authentication.</P
6873 >You must change administrator password at least once after DC install,
6874 to create the right encoding types</P
6876 >w2k doesn't seem to create the _kerberos._udp and _ldap._tcp in
6877 their defaults DNS setup. Maybe fixed in service packs?</P
6884 NAME="DOMAIN-SECURITY"
6886 >Chapter 9. Samba as a NT4 domain member</H1
6894 >9.1. Joining an NT Domain with Samba 2.2</H2
6896 >Assume you have a Samba 2.x server with a NetBIOS name of
6900 > and are joining an NT domain called
6904 >, which has a PDC with a NetBIOS name
6908 > and two backup domain controllers
6909 with NetBIOS names <TT
6918 >In order to join the domain, first stop all Samba daemons
6919 and run the command:</P
6927 >smbpasswd -j DOM -r DOMPDC
6931 >Administrator%password</I
6937 >as we are joining the domain DOM and the PDC for that domain
6938 (the only machine that has write access to the domain SAM database)
6942 >Administrator%password</I
6945 the login name and password for an account which has the necessary
6946 privilege to add machines to the domain. If this is successful
6947 you will see the message:</P
6950 CLASS="COMPUTEROUTPUT"
6951 >smbpasswd: Joined domain DOM.</TT
6955 >in your terminal window. See the <A
6956 HREF="smbpasswd.8.html"
6959 > man page for more details.</P
6961 >There is existing development code to join a domain
6962 without having to create the machine trust account on the PDC
6963 beforehand. This code will hopefully be available soon
6964 in release branches as well.</P
6966 >This command goes through the machine account password
6967 change protocol, then writes the new (random) machine account
6968 password for this Samba server into a file in the same directory
6969 in which an smbpasswd file would be stored - normally :</P
6973 >/usr/local/samba/private</TT
6976 >In Samba 2.0.x, the filename looks like this:</P
6983 ><NT DOMAIN NAME></I
6997 > suffix stands for machine account
6998 password file. So in our example above, the file would be called:</P
7005 >In Samba 2.2, this file has been replaced with a TDB
7006 (Trivial Database) file named <TT
7012 >This file is created and owned by root and is not
7013 readable by any other user. It is the key to the domain-level
7014 security for your system, and should be treated as carefully
7015 as a shadow password file.</P
7017 >Now, before restarting the Samba daemons you must
7019 HREF="smb.conf.5.html"
7026 > file to tell Samba it should now use domain security.</P
7028 >Change (or add) your <A
7029 HREF="smb.conf.5.html#SECURITY"
7037 > line in the [global] section
7038 of your smb.conf to read:</P
7042 >security = domain</B
7046 HREF="smb.conf.5.html#WORKGROUP"
7054 > line in the [global] section to read: </P
7061 >as this is the name of the domain we are joining. </P
7063 >You must also have the parameter <A
7064 HREF="smb.conf.5.html#ENCRYPTPASSWORDS"
7069 >encrypt passwords</I
7076 > in order for your users to authenticate to the NT PDC.</P
7078 >Finally, add (or modify) a <A
7079 HREF="smb.conf.5.html#PASSWORDSERVER"
7084 >password server =</I
7087 > line in the [global]
7088 section to read: </P
7092 >password server = DOMPDC DOMBDC1 DOMBDC2</B
7095 >These are the primary and backup domain controllers Samba
7096 will attempt to contact in order to authenticate users. Samba will
7097 try to contact each of these servers in order, so you may want to
7098 rearrange this list in order to spread out the authentication load
7099 among domain controllers.</P
7101 >Alternatively, if you want smbd to automatically determine
7102 the list of Domain controllers to use for authentication, you may
7103 set this line to be :</P
7107 >password server = *</B
7110 >This method, which was introduced in Samba 2.0.6,
7111 allows Samba to use exactly the same mechanism that NT does. This
7112 method either broadcasts or uses a WINS database in order to
7113 find domain controllers to authenticate against.</P
7115 >Finally, restart your Samba daemons and get ready for
7116 clients to begin using domain security!</P
7125 >9.2. Samba and Windows 2000 Domains</H2
7127 >Many people have asked regarding the state of Samba's ability to participate in
7128 a Windows 2000 Domain. Samba 3.0 is able to act as a member server of a Windows
7129 2000 domain operating in mixed or native mode.</P
7131 >There is much confusion between the circumstances that require a "mixed" mode
7132 Win2k DC and a when this host can be switched to "native" mode. A "mixed" mode
7133 Win2k domain controller is only needed if Windows NT BDCs must exist in the same
7134 domain. By default, a Win2k DC in "native" mode will still support
7135 NetBIOS and NTLMv1 for authentication of legacy clients such as Windows 9x and
7136 NT 4.0. Samba has the same requirements as a Windows NT 4.0 member server.</P
7138 >The steps for adding a Samba 2.2 host to a Win2k domain are the same as those
7139 for adding a Samba server to a Windows NT 4.0 domain. The only exception is that
7140 the "Server Manager" from NT 4 has been replaced by the "Active Directory Users and
7141 Computers" MMC (Microsoft Management Console) plugin.</P
7150 >9.3. Why is this better than security = server?</H2
7152 >Currently, domain security in Samba doesn't free you from
7153 having to create local Unix users to represent the users attaching
7154 to your server. This means that if domain user <TT
7158 > attaches to your domain security Samba server, there needs
7159 to be a local Unix user fred to represent that user in the Unix
7160 filesystem. This is very similar to the older Samba security mode
7162 HREF="smb.conf.5.html#SECURITYEQUALSSERVER"
7164 >security = server</A
7166 where Samba would pass through the authentication request to a Windows
7167 NT server in the same way as a Windows 95 or Windows 98 server would.
7170 >Please refer to the <A
7175 > for information on a system to automatically
7176 assign UNIX uids and gids to Windows NT Domain users and groups.
7177 This code is available in development branches only at the moment,
7178 but will be moved to release branches soon.</P
7180 >The advantage to domain-level security is that the
7181 authentication in domain-level security is passed down the authenticated
7182 RPC channel in exactly the same way that an NT server would do it. This
7183 means Samba servers now participate in domain trust relationships in
7184 exactly the same way NT servers do (i.e., you can add Samba servers into
7185 a resource domain and have the authentication passed on from a resource
7186 domain PDC to an account domain PDC.</P
7188 >In addition, with <B
7190 >security = server</B
7192 daemon on a server has to keep a connection open to the
7193 authenticating server for as long as that daemon lasts. This can drain
7194 the connection resources on a Microsoft NT server and cause it to run
7195 out of available connections. With <B
7197 >security = domain</B
7199 however, the Samba daemons connect to the PDC/BDC only for as long
7200 as is necessary to authenticate the user, and then drop the connection,
7201 thus conserving PDC connection resources.</P
7203 >And finally, acting in the same manner as an NT server
7204 authenticating to a PDC means that as part of the authentication
7205 reply, the Samba server gets the user identification information such
7206 as the user SID, the list of NT groups the user belongs to, etc. All
7207 this information will allow Samba to be extended in the future into
7208 a mode the developers currently call appliance mode. In this mode,
7209 no local Unix users will be necessary, and Samba will generate Unix
7210 uids and gids from the information passed back from the PDC when a
7211 user is authenticated, making a Samba server truly plug and play
7212 in an NT domain environment. Watch for this code soon.</P
7220 > Much of the text of this document
7221 was first published in the Web magazine <A
7222 HREF="http://www.linuxworld.com"
7227 HREF="http://www.linuxworld.com/linuxworld/lw-1998-10/lw-10-samba.html"
7244 >III. Optional configuration</H1
7253 >Samba has several features that you might want or might not want to use. The chapters in this
7254 part each cover one specific feature.</P
7261 >Table of Contents</B
7265 HREF="#INTEGRATE-MS-NETWORKS"
7266 >Integrating MS Windows networks with Samba</A
7278 >Name Resolution in a pure Unix/Linux world</A
7295 >/etc/resolv.conf</TT
7311 >/etc/nsswitch.conf</TT
7319 >Name resolution as used within MS Windows networking</A
7326 >The NetBIOS Name Cache</A
7331 >The LMHOSTS file</A
7353 >How browsing functions and how to deploy stable and
7354 dependable browsing using Samba</A
7359 >MS Windows security options and how to configure
7360 Samba for seemless integration</A
7367 >Use MS Windows NT as an authentication server</A
7372 >Make Samba a member of an MS Windows NT security domain</A
7377 >Configure Samba as an authentication server</A
7390 HREF="#UNIX-PERMISSIONS"
7391 >UNIX Permission Bits and Windows NT Access Control Lists</A
7398 >Viewing and changing UNIX permissions using the NT
7404 >How to view file security on a Samba share</A
7409 >Viewing file ownership</A
7414 >Viewing file or directory permissions</A
7421 >File Permissions</A
7426 >Directory Permissions</A
7433 >Modifying file or directory permissions</A
7438 >Interaction with the standard Samba create mask
7444 >Interaction with the standard Samba file attribute
7452 >Configuring PAM for distributed but centrally
7453 managed authentication</A
7465 >Distributed Authentication</A
7470 >PAM Configuration in smb.conf</A
7477 >Hosting a Microsoft Distributed File System tree on Samba</A
7500 >Printing Support</A
7519 >Creating [print$]</A
7524 >Setting Drivers for Existing Printers</A
7529 >Support a large number of printers</A
7534 >Adding New Printers via the Windows NT APW</A
7539 >Samba and Printer Ports</A
7546 >The Imprints Toolset</A
7553 >What is Imprints?</A
7558 >Creating Printer Driver Packages</A
7563 >The Imprints server</A
7568 >The Installation Client</A
7587 >Debugging printer problems</A
7592 >What printers do I have?</A
7597 >Setting up printcap and print servers</A
7602 >Job sent, no output</A
7607 >Job sent, strange output</A
7612 >Raw PostScript printed</A
7617 >Advanced Printing</A
7630 HREF="#SECURITYLEVELS"
7643 >More complete description of security levels</A
7650 >Unified Logons between Windows NT and UNIX using Winbind</A
7667 >What Winbind Provides</A
7681 >How Winbind Works</A
7688 >Microsoft Remote Procedure Calls</A
7693 >Name Service Switch</A
7698 >Pluggable Authentication Modules</A
7703 >User and Group ID Allocation</A
7715 >Installation and Configuration</A
7732 >Testing Things Out</A
7751 >Passdb MySQL plugin</A
7768 >Using plaintext passwords or encrypted password</A
7773 >Getting non-column data from the table</A
7780 >Passdb XML plugin</A
7798 HREF="#SAMBA-LDAP-HOWTO"
7799 >Storing Samba's User/Machine Account information in an LDAP Directory</A
7816 >Supported LDAP Servers</A
7821 >Schema and Relationship to the RFC 2307 posixAccount</A
7826 >Configuring Samba with LDAP</A
7833 >OpenLDAP configuration</A
7838 >Configuring Samba</A
7845 >Accounts and Groups management</A
7850 >Security and sambaAccount</A
7855 >LDAP specials attributes for sambaAccounts</A
7860 >Example LDIF Entries for a sambaAccount</A
7872 >HOWTO Access Samba source code via CVS</A
7884 >CVS Access to samba.org</A
7891 >Access via CVSweb</A
7904 HREF="#GROUPMAPPING"
7905 >Group mapping HOWTO</A
7910 >Samba performance issues</A
7939 >Old 'fake oplocks' option - deprecated</A
8027 NAME="INTEGRATE-MS-NETWORKS"
8029 >Chapter 10. Integrating MS Windows networks with Samba</H1
8039 >To identify the key functional mechanisms of MS Windows networking
8040 to enable the deployment of Samba as a means of extending and/or
8041 replacing MS Windows NT/2000 technology.</P
8043 >We will examine:</P
8050 >Name resolution in a pure Unix/Linux TCP/IP
8056 >Name resolution as used within MS Windows
8062 >How browsing functions and how to deploy stable
8063 and dependable browsing using Samba
8068 >MS Windows security options and how to
8069 configure Samba for seemless integration
8074 >Configuration of Samba as:</P
8081 >A stand-alone server</P
8085 >An MS Windows NT 3.x/4.0 security domain member
8090 >An alternative to an MS Windows NT 3.x/4.0 Domain Controller
8104 >10.2. Name Resolution in a pure Unix/Linux world</H2
8106 >The key configuration files covered in this section are:</P
8121 >/etc/resolv.conf</TT
8135 >/etc/nsswitch.conf</TT
8151 >Contains a static list of IP Addresses and names.
8155 CLASS="PROGRAMLISTING"
8156 > 127.0.0.1 localhost localhost.localdomain
8157 192.168.1.1 bigbox.caldera.com bigbox alias4box</PRE
8164 name resolution mechanism so that uses do not need to remember
8167 >Network packets that are sent over the physical network transport
8168 layer communicate not via IP addresses but rather using the Media
8169 Access Control address, or MAC address. IP Addresses are currently
8170 32 bits in length and are typically presented as four (4) decimal
8171 numbers that are separated by a dot (or period). eg: 168.192.1.1</P
8173 >MAC Addresses use 48 bits (or 6 bytes) and are typically represented
8174 as two digit hexadecimal numbers separated by colons. eg:
8175 40:8e:0a:12:34:56</P
8177 >Every network interfrace must have an MAC address. Associated with
8178 a MAC address there may be one or more IP addresses. There is NO
8179 relationship between an IP address and a MAC address, all such assignments
8180 are arbitary or discretionary in nature. At the most basic level all
8181 network communications takes place using MAC addressing. Since MAC
8182 addresses must be globally unique, and generally remains fixed for
8183 any particular interface, the assignment of an IP address makes sense
8184 from a network management perspective. More than one IP address can
8185 be assigned per MAC address. One address must be the primary IP address,
8186 this is the address that will be returned in the ARP reply.</P
8188 >When a user or a process wants to communicate with another machine
8189 the protocol implementation ensures that the "machine name" or "host
8190 name" is resolved to an IP address in a manner that is controlled
8191 by the TCP/IP configuration control files. The file
8195 > is one such file.</P
8197 >When the IP address of the destination interface has been
8198 determined a protocol called ARP/RARP is used to identify
8199 the MAC address of the target interface. ARP stands for Address
8200 Resolution Protocol, and is a broadcast oriented method that
8201 uses UDP (User Datagram Protocol) to send a request to all
8202 interfaces on the local network segment using the all 1's MAC
8203 address. Network interfaces are programmed to respond to two
8204 MAC addresses only; their own unique address and the address
8205 ff:ff:ff:ff:ff:ff. The reply packet from an ARP request will
8206 contain the MAC address and the primary IP address for each
8212 > file is foundational to all
8213 Unix/Linux TCP/IP installations and as a minumum will contain
8214 the localhost and local network interface IP addresses and the
8215 primary names by which they are known within the local machine.
8216 This file helps to prime the pump so that a basic level of name
8217 resolution can exist before any other method of name resolution
8218 becomes available.</P
8229 >/etc/resolv.conf</TT
8232 >This file tells the name resolution libraries:</P
8238 >The name of the domain to which the machine
8244 >The name(s) of any domains that should be
8245 automatically searched when trying to resolve unqualified
8246 host names to their IP address
8251 >The name or IP address of available Domain
8252 Name Servers that may be asked to perform name to address
8273 > is the primary means by
8274 which the setting in /etc/resolv.conf may be affected. It is a
8275 critical configuration file. This file controls the order by
8276 which name resolution may procede. The typical structure is:</P
8279 CLASS="PROGRAMLISTING"
8284 >then both addresses should be returned. Please refer to the
8285 man page for host.conf for further details.</P
8296 >/etc/nsswitch.conf</TT
8299 >This file controls the actual name resolution targets. The
8300 file typically has resolver object specifications as follows:</P
8303 CLASS="PROGRAMLISTING"
8304 > # /etc/nsswitch.conf
8306 # Name Service Switch configuration file.
8310 # Alternative entries for password authentication are:
8311 # passwd: compat files nis ldap winbind
8315 hosts: files nis dns
8316 # Alternative entries for host name resolution are:
8317 # hosts: files dns nis nis+ hesoid db compat ldap wins
8318 networks: nis files dns
8321 protocols: nis files
8323 services: nis files</PRE
8326 >Of course, each of these mechanisms requires that the appropriate
8327 facilities and/or services are correctly configured.</P
8329 >It should be noted that unless a network request/message must be
8330 sent, TCP/IP networks are silent. All TCP/IP communications assumes a
8331 principal of speaking only when necessary.</P
8333 >Starting with version 2.2.0 samba has Linux support for extensions to
8334 the name service switch infrastructure so that linux clients will
8335 be able to obtain resolution of MS Windows NetBIOS names to IP
8336 Addresses. To gain this functionality Samba needs to be compiled
8337 with appropriate arguments to the make command (ie: <B
8340 nsswitch/libnss_wins.so</B
8341 >). The resulting library should
8342 then be installed in the <TT
8346 the "wins" parameter needs to be added to the "hosts:" line in
8349 >/etc/nsswitch.conf</TT
8350 > file. At this point it
8351 will be possible to ping any MS Windows machine by it's NetBIOS
8352 machine name, so long as that machine is within the workgroup to
8353 which both the samba machine and the MS Windows machine belong.</P
8363 >10.3. Name resolution as used within MS Windows networking</H2
8365 >MS Windows networking is predicated about the name each machine
8366 is given. This name is known variously (and inconsistently) as
8367 the "computer name", "machine name", "networking name", "netbios name",
8368 "SMB name". All terms mean the same thing with the exception of
8369 "netbios name" which can apply also to the name of the workgroup or the
8370 domain name. The terms "workgroup" and "domain" are really just a
8371 simply name with which the machine is associated. All NetBIOS names
8372 are exactly 16 characters in length. The 16th character is reserved.
8373 It is used to store a one byte value that indicates service level
8374 information for the NetBIOS name that is registered. A NetBIOS machine
8375 name is therefore registered for each service type that is provided by
8376 the client/server.</P
8378 >The following are typical NetBIOS name/service type registrations:</P
8381 CLASS="PROGRAMLISTING"
8382 > Unique NetBIOS Names:
8383 MACHINENAME<00> = Server Service is running on MACHINENAME
8384 MACHINENAME<03> = Generic Machine Name (NetBIOS name)
8385 MACHINENAME<20> = LanMan Server service is running on MACHINENAME
8386 WORKGROUP<1b> = Domain Master Browser
8389 WORKGROUP<03> = Generic Name registered by all members of WORKGROUP
8390 WORKGROUP<1c> = Domain Controllers / Netlogon Servers
8391 WORKGROUP<1d> = Local Master Browsers
8392 WORKGROUP<1e> = Internet Name Resolvers</PRE
8395 >It should be noted that all NetBIOS machines register their own
8396 names as per the above. This is in vast contrast to TCP/IP
8397 installations where traditionally the system administrator will
8398 determine in the /etc/hosts or in the DNS database what names
8399 are associated with each IP address.</P
8401 >One further point of clarification should be noted, the <TT
8405 file and the DNS records do not provide the NetBIOS name type information
8406 that MS Windows clients depend on to locate the type of service that may
8407 be needed. An example of this is what happens when an MS Windows client
8408 wants to locate a domain logon server. It find this service and the IP
8409 address of a server that provides it by performing a lookup (via a
8410 NetBIOS broadcast) for enumeration of all machines that have
8411 registered the name type *<1c>. A logon request is then sent to each
8412 IP address that is returned in the enumerated list of IP addresses. Which
8413 ever machine first replies then ends up providing the logon services.</P
8415 >The name "workgroup" or "domain" really can be confusing since these
8416 have the added significance of indicating what is the security
8417 architecture of the MS Windows network. The term "workgroup" indicates
8418 that the primary nature of the network environment is that of a
8419 peer-to-peer design. In a WORKGROUP all machines are responsible for
8420 their own security, and generally such security is limited to use of
8421 just a password (known as SHARE MODE security). In most situations
8422 with peer-to-peer networking the users who control their own machines
8423 will simply opt to have no security at all. It is possible to have
8424 USER MODE security in a WORKGROUP environment, thus requiring use
8425 of a user name and a matching password.</P
8427 >MS Windows networking is thus predetermined to use machine names
8428 for all local and remote machine message passing. The protocol used is
8429 called Server Message Block (SMB) and this is implemented using
8430 the NetBIOS protocol (Network Basic Input Output System). NetBIOS can
8431 be encapsulated using LLC (Logical Link Control) protocol - in which case
8432 the resulting protocol is called NetBEUI (Network Basic Extended User
8433 Interface). NetBIOS can also be run over IPX (Internetworking Packet
8434 Exchange) protocol as used by Novell NetWare, and it can be run
8435 over TCP/IP protocols - in which case the resulting protocol is called
8436 NBT or NetBT, the NetBIOS over TCP/IP.</P
8438 >MS Windows machines use a complex array of name resolution mechanisms.
8439 Since we are primarily concerned with TCP/IP this demonstration is
8440 limited to this area.</P
8448 >10.3.1. The NetBIOS Name Cache</H3
8450 >All MS Windows machines employ an in memory buffer in which is
8451 stored the NetBIOS names and IP addresses for all external
8452 machines that that machine has communicated with over the
8453 past 10-15 minutes. It is more efficient to obtain an IP address
8454 for a machine from the local cache than it is to go through all the
8455 configured name resolution mechanisms.</P
8457 >If a machine whose name is in the local name cache has been shut
8458 down before the name had been expired and flushed from the cache, then
8459 an attempt to exchange a message with that machine will be subject
8460 to time-out delays. i.e.: Its name is in the cache, so a name resolution
8461 lookup will succeed, but the machine can not respond. This can be
8462 frustrating for users - but it is a characteristic of the protocol.</P
8464 >The MS Windows utility that allows examination of the NetBIOS
8465 name cache is called "nbtstat". The Samba equivalent of this
8466 is called "nmblookup".</P
8475 >10.3.2. The LMHOSTS file</H3
8477 >This file is usually located in MS Windows NT 4.0 or
8480 >C:\WINNT\SYSTEM32\DRIVERS\ETC</TT
8482 the IP Address and the machine name in matched pairs. The
8486 > file performs NetBIOS name
8487 to IP address mapping oriented.</P
8489 >It typically looks like:</P
8492 CLASS="PROGRAMLISTING"
8493 > # Copyright (c) 1998 Microsoft Corp.
8495 # This is a sample LMHOSTS file used by the Microsoft Wins Client (NetBIOS
8496 # over TCP/IP) stack for Windows98
8498 # This file contains the mappings of IP addresses to NT computernames
8499 # (NetBIOS) names. Each entry should be kept on an individual line.
8500 # The IP address should be placed in the first column followed by the
8501 # corresponding computername. The address and the comptername
8502 # should be separated by at least one space or tab. The "#" character
8503 # is generally used to denote the start of a comment (see the exceptions
8506 # This file is compatible with Microsoft LAN Manager 2.x TCP/IP lmhosts
8507 # files and offers the following extensions:
8510 # #DOM:<domain>
8511 # #INCLUDE <filename>
8514 # \0xnn (non-printing character support)
8516 # Following any entry in the file with the characters "#PRE" will cause
8517 # the entry to be preloaded into the name cache. By default, entries are
8518 # not preloaded, but are parsed only after dynamic name resolution fails.
8520 # Following an entry with the "#DOM:<domain>" tag will associate the
8521 # entry with the domain specified by <domain>. This affects how the
8522 # browser and logon services behave in TCP/IP environments. To preload
8523 # the host name associated with #DOM entry, it is necessary to also add a
8524 # #PRE to the line. The <domain> is always preloaded although it will not
8525 # be shown when the name cache is viewed.
8527 # Specifying "#INCLUDE <filename>" will force the RFC NetBIOS (NBT)
8528 # software to seek the specified <filename> and parse it as if it were
8529 # local. <filename> is generally a UNC-based name, allowing a
8530 # centralized lmhosts file to be maintained on a server.
8531 # It is ALWAYS necessary to provide a mapping for the IP address of the
8532 # server prior to the #INCLUDE. This mapping must use the #PRE directive.
8533 # In addtion the share "public" in the example below must be in the
8534 # LanManServer list of "NullSessionShares" in order for client machines to
8535 # be able to read the lmhosts file successfully. This key is under
8536 # \machine\system\currentcontrolset\services\lanmanserver\parameters\nullsessionshares
8537 # in the registry. Simply add "public" to the list found there.
8539 # The #BEGIN_ and #END_ALTERNATE keywords allow multiple #INCLUDE
8540 # statements to be grouped together. Any single successful include
8541 # will cause the group to succeed.
8543 # Finally, non-printing characters can be embedded in mappings by
8544 # first surrounding the NetBIOS name in quotations, then using the
8545 # \0xnn notation to specify a hex value for a non-printing character.
8547 # The following example illustrates all of these extensions:
8549 # 102.54.94.97 rhino #PRE #DOM:networking #net group's DC
8550 # 102.54.94.102 "appname \0x14" #special app server
8551 # 102.54.94.123 popular #PRE #source server
8552 # 102.54.94.117 localsrv #PRE #needed for the include
8555 # #INCLUDE \\localsrv\public\lmhosts
8556 # #INCLUDE \\rhino\public\lmhosts
8559 # In the above example, the "appname" server contains a special
8560 # character in its name, the "popular" and "localsrv" server names are
8561 # preloaded, and the "rhino" server name is specified so it can be used
8562 # to later #INCLUDE a centrally maintained lmhosts file if the "localsrv"
8563 # system is unavailable.
8565 # Note that the whole file is parsed including comments on each lookup,
8566 # so keeping the number of comments to a minimum will improve performance.
8567 # Therefore it is not advisable to simply add lmhosts file entries onto the
8568 # end of this file.</PRE
8578 >10.3.3. HOSTS file</H3
8580 >This file is usually located in MS Windows NT 4.0 or 2000 in
8583 >C:\WINNT\SYSTEM32\DRIVERS\ETC</TT
8585 the IP Address and the IP hostname in matched pairs. It can be
8586 used by the name resolution infrastructure in MS Windows, depending
8587 on how the TCP/IP environment is configured. This file is in
8588 every way the equivalent of the Unix/Linux <TT
8600 >10.3.4. DNS Lookup</H3
8602 >This capability is configured in the TCP/IP setup area in the network
8603 configuration facility. If enabled an elaborate name resolution sequence
8604 is followed the precise nature of which isdependant on what the NetBIOS
8605 Node Type parameter is configured to. A Node Type of 0 means use
8606 NetBIOS broadcast (over UDP broadcast) is first used if the name
8607 that is the subject of a name lookup is not found in the NetBIOS name
8608 cache. If that fails then DNS, HOSTS and LMHOSTS are checked. If set to
8609 Node Type 8, then a NetBIOS Unicast (over UDP Unicast) is sent to the
8610 WINS Server to obtain a lookup before DNS, HOSTS, LMHOSTS, or broadcast
8620 >10.3.5. WINS Lookup</H3
8622 >A WINS (Windows Internet Name Server) service is the equivaent of the
8623 rfc1001/1002 specified NBNS (NetBIOS Name Server). A WINS server stores
8624 the names and IP addresses that are registered by a Windows client
8625 if the TCP/IP setup has been given at least one WINS Server IP Address.</P
8627 >To configure Samba to be a WINS server the following parameter needs
8628 to be added to the <TT
8634 CLASS="PROGRAMLISTING"
8635 > wins support = Yes</PRE
8638 >To configure Samba to use a WINS server the following parameters are
8639 needed in the smb.conf file:</P
8642 CLASS="PROGRAMLISTING"
8644 wins server = xxx.xxx.xxx.xxx</PRE
8653 of the WINS server.</P
8663 >10.4. How browsing functions and how to deploy stable and
8664 dependable browsing using Samba</H2
8666 >As stated above, MS Windows machines register their NetBIOS names
8667 (i.e.: the machine name for each service type in operation) on start
8668 up. Also, as stated above, the exact method by which this name registration
8669 takes place is determined by whether or not the MS Windows client/server
8670 has been given a WINS server address, whether or not LMHOSTS lookup
8671 is enabled, or if DNS for NetBIOS name resolution is enabled, etc.</P
8673 >In the case where there is no WINS server all name registrations as
8674 well as name lookups are done by UDP broadcast. This isolates name
8675 resolution to the local subnet, unless LMHOSTS is used to list all
8676 names and IP addresses. In such situations Samba provides a means by
8677 which the samba server name may be forcibly injected into the browse
8678 list of a remote MS Windows network (using the "remote announce" parameter).</P
8680 >Where a WINS server is used, the MS Windows client will use UDP
8681 unicast to register with the WINS server. Such packets can be routed
8682 and thus WINS allows name resolution to function across routed networks.</P
8684 >During the startup process an election will take place to create a
8685 local master browser if one does not already exist. On each NetBIOS network
8686 one machine will be elected to function as the domain master browser. This
8687 domain browsing has nothing to do with MS security domain control.
8688 Instead, the domain master browser serves the role of contacting each local
8689 master browser (found by asking WINS or from LMHOSTS) and exchanging browse
8690 list contents. This way every master browser will eventually obtain a complete
8691 list of all machines that are on the network. Every 11-15 minutes an election
8692 is held to determine which machine will be the master browser. By the nature of
8693 the election criteria used, the machine with the highest uptime, or the
8694 most senior protocol version, or other criteria, will win the election
8695 as domain master browser.</P
8697 >Clients wishing to browse the network make use of this list, but also depend
8698 on the availability of correct name resolution to the respective IP
8699 address/addresses. </P
8701 >Any configuration that breaks name resolution and/or browsing intrinsics
8702 will annoy users because they will have to put up with protracted
8703 inability to use the network services.</P
8705 >Samba supports a feature that allows forced synchonisation
8706 of browse lists across routed networks using the "remote
8707 browse sync" parameter in the smb.conf file. This causes Samba
8708 to contact the local master browser on a remote network and
8709 to request browse list synchronisation. This effectively bridges
8710 two networks that are separated by routers. The two remote
8711 networks may use either broadcast based name resolution or WINS
8712 based name resolution, but it should be noted that the "remote
8713 browse sync" parameter provides browse list synchronisation - and
8714 that is distinct from name to address resolution, in other
8715 words, for cross subnet browsing to function correctly it is
8716 essential that a name to address resolution mechanism be provided.
8717 This mechanism could be via DNS, <TT
8730 >10.5. MS Windows security options and how to configure
8731 Samba for seemless integration</H2
8733 >MS Windows clients may use encrypted passwords as part of a
8734 challenege/response authentication model (a.k.a. NTLMv1) or
8735 alone, or clear text strings for simple password based
8736 authentication. It should be realized that with the SMB
8737 protocol the password is passed over the network either
8738 in plain text or encrypted, but not both in the same
8739 authentication requets.</P
8741 >When encrypted passwords are used a password that has been
8742 entered by the user is encrypted in two ways:</P
8748 >An MD4 hash of the UNICODE of the password
8749 string. This is known as the NT hash.
8754 >The password is converted to upper case,
8755 and then padded or trucated to 14 bytes. This string is
8756 then appended with 5 bytes of NULL characters and split to
8757 form two 56 bit DES keys to encrypt a "magic" 8 byte value.
8758 The resulting 16 bytes for the LanMan hash.
8763 >You should refer to the <A
8764 HREF="ENCRYPTION.html"
8766 >Password Encryption</A
8767 > chapter in this HOWTO collection
8768 for more details on the inner workings</P
8770 >MS Windows 95 pre-service pack 1, MS Windows NT versions 3.x
8771 and version 4.0 pre-service pack 3 will use either mode of
8772 password authentication. All versions of MS Windows that follow
8773 these versions no longer support plain text passwords by default.</P
8775 >MS Windows clients have a habit of dropping network mappings that
8776 have been idle for 10 minutes or longer. When the user attempts to
8777 use the mapped drive connection that has been dropped, the client
8778 re-establishes the connection using
8779 a cached copy of the password.</P
8781 >When Microsoft changed the default password mode, they dropped support for
8782 caching of the plain text password. This means that when the registry
8783 parameter is changed to re-enable use of plain text passwords it appears to
8784 work, but when a dropped mapping attempts to revalidate it will fail if
8785 the remote authentication server does not support encrypted passwords.
8786 This means that it is definitely not a good idea to re-enable plain text
8787 password support in such clients.</P
8789 >The following parameters can be used to work around the
8790 issue of Windows 9x client upper casing usernames and
8791 password before transmitting them to the SMB server
8792 when using clear text authentication.</P
8795 CLASS="PROGRAMLISTING"
8797 HREF="smb.conf.5.html#PASSWORDLEVEL"
8807 HREF="smb.conf.5.html#USERNAMELEVEL"
8818 >By default Samba will lower case the username before attempting
8819 to lookup the user in the database of local system accounts.
8820 Because UNIX usernames conventionally only contain lower case
8827 is rarely even needed.</P
8829 >However, password on UNIX systems often make use of mixed case
8830 characters. This means that in order for a user on a Windows 9x
8831 client to connect to a Samba server using clear text authentication,
8837 > must be set to the maximum
8838 number of upper case letter which <SPAN
8845 is a password. Note that is the server OS uses the traditional
8846 DES version of crypt(), then a <TT
8852 of 8 will result in case insensitive passwords as seen from Windows
8853 users. This will also result in longer login times as Samba
8854 hash to compute the permutations of the password string and
8855 try them one by one until a match is located (or all combinations fail).</P
8857 >The best option to adopt is to enable support for encrypted passwords
8858 where ever Samba is used. There are three configuration possibilities
8859 for support of encrypted passwords:</P
8867 >10.5.1. Use MS Windows NT as an authentication server</H3
8869 >This method involves the additions of the following parameters
8870 in the smb.conf file:</P
8873 CLASS="PROGRAMLISTING"
8874 > encrypt passwords = Yes
8876 password server = "NetBIOS_name_of_PDC"</PRE
8879 >There are two ways of identifying whether or not a username and
8880 password pair was valid or not. One uses the reply information provided
8881 as part of the authentication messaging process, the other uses
8882 just and error code.</P
8884 >The down-side of this mode of configuration is the fact that
8885 for security reasons Samba will send the password server a bogus
8886 username and a bogus password and if the remote server fails to
8887 reject the username and password pair then an alternative mode
8888 of identification of validation is used. Where a site uses password
8889 lock out after a certain number of failed authentication attempts
8890 this will result in user lockouts.</P
8892 >Use of this mode of authentication does require there to be
8893 a standard Unix account for the user, this account can be blocked
8894 to prevent logons by other than MS Windows clients.</P
8903 >10.5.2. Make Samba a member of an MS Windows NT security domain</H3
8905 >This method involves additon of the following paramters in the smb.conf file:</P
8908 CLASS="PROGRAMLISTING"
8909 > encrypt passwords = Yes
8911 workgroup = "name of NT domain"
8912 password server = *</PRE
8915 >The use of the "*" argument to "password server" will cause samba
8916 to locate the domain controller in a way analogous to the way
8917 this is done within MS Windows NT.</P
8919 >In order for this method to work the Samba server needs to join the
8920 MS Windows NT security domain. This is done as follows:</P
8926 >On the MS Windows NT domain controller using
8927 the Server Manager add a machine account for the Samba server.
8932 >Next, on the Linux system execute:
8935 >smbpasswd -r PDC_NAME -j DOMAIN_NAME</B
8941 >Use of this mode of authentication does require there to be
8942 a standard Unix account for the user in order to assign
8943 a uid once the account has been authenticated by the remote
8944 Windows DC. This account can be blocked to prevent logons by
8945 other than MS Windows clients by things such as setting an invalid
8951 >An alternative to assigning UIDs to Windows users on a
8952 Samba member server is presented in the <A
8955 >Winbind Overview</A
8957 this HOWTO collection.</P
8966 >10.5.3. Configure Samba as an authentication server</H3
8968 >This mode of authentication demands that there be on the
8969 Unix/Linux system both a Unix style account as well as an
8970 smbpasswd entry for the user. The Unix system account can be
8971 locked if required as only the encrypted password will be
8972 used for SMB client authentication.</P
8974 >This method involves addition of the following parameters to
8975 the smb.conf file:</P
8978 CLASS="PROGRAMLISTING"
8979 >## please refer to the Samba PDC HOWTO chapter later in
8980 ## this collection for more details
8982 encrypt passwords = Yes
8985 ; an OS level of 33 or more is recommended
8989 path = /somewhare/in/file/system
8990 read only = yes</PRE
8993 >in order for this method to work a Unix system account needs
8994 to be created for each user, as well as for each MS Windows NT/2000
8995 machine. The following structure is required.</P
9003 >10.5.3.1. Users</H4
9005 >A user account that may provide a home directory should be
9006 created. The following Linux system commands are typical of
9007 the procedure for creating an account.</P
9010 CLASS="PROGRAMLISTING"
9011 > # useradd -s /bin/bash -d /home/"userid" -m "userid"
9013 Enter Password: <pw>
9015 # smbpasswd -a "userid"
9016 Enter Password: <pw></PRE
9026 >10.5.3.2. MS Windows NT Machine Accounts</H4
9028 >These are required only when Samba is used as a domain
9029 controller. Refer to the Samba-PDC-HOWTO for more details.</P
9032 CLASS="PROGRAMLISTING"
9033 > # useradd -s /bin/false -d /dev/null "machine_name"\$
9034 # passwd -l "machine_name"\$
9035 # smbpasswd -a -m "machine_name"</PRE
9047 >10.6. Conclusions</H2
9049 >Samba provides a flexible means to operate as...</P
9055 >A Stand-alone server - No special action is needed
9056 other than to create user accounts. Stand-alone servers do NOT
9057 provide network logon services, meaning that machines that use this
9058 server do NOT perform a domain logon but instead make use only of
9059 the MS Windows logon which is local to the MS Windows
9065 >An MS Windows NT 3.x/4.0 security domain member.
9070 >An alternative to an MS Windows NT 3.x/4.0
9081 NAME="UNIX-PERMISSIONS"
9083 >Chapter 11. UNIX Permission Bits and Windows NT Access Control Lists</H1
9091 >11.1. Viewing and changing UNIX permissions using the NT
9092 security dialogs</H2
9094 >New in the Samba 2.0.4 release is the ability for Windows
9095 NT clients to use their native security settings dialog box to
9096 view and modify the underlying UNIX permissions.</P
9098 >Note that this ability is careful not to compromise
9099 the security of the UNIX host Samba is running on, and
9100 still obeys all the file permission rules that a Samba
9101 administrator can set.</P
9103 >In Samba 2.0.4 and above the default value of the
9105 HREF="smb.conf.5.html#NTACLSUPPORT"
9113 > has been changed from
9121 manipulation of permissions is turned on by default.</P
9130 >11.2. How to view file security on a Samba share</H2
9132 >From an NT 4.0 client, single-click with the right
9133 mouse button on any file or directory in a Samba mounted
9134 drive letter or UNC path. When the menu pops-up, click
9141 > entry at the bottom of
9142 the menu. This brings up the normal file properties dialog
9143 box, but with Samba 2.0.4 this will have a new tab along the top
9150 >. Click on this tab and you
9151 will see three buttons, <SPAN
9177 > button will cause either
9178 an error message <SPAN
9180 >A requested privilege is not held
9182 > to appear if the user is not the
9183 NT Administrator, or a dialog which is intended to allow an
9184 Administrator to add auditing requirements to a file if the
9185 user is logged on as the NT Administrator. This dialog is
9186 non-functional with a Samba share at this time, as the only
9187 useful button, the <B
9190 > button will not currently
9191 allow a list of users to be seen.</P
9200 >11.3. Viewing file ownership</H2
9206 brings up a dialog box telling you who owns the given file. The
9207 owner name will be of the form :</P
9211 >"SERVER\user (Long name)"</B
9219 > is the NetBIOS name of
9220 the Samba server, <TT
9225 > is the user name of
9226 the UNIX user who owns the file, and <TT
9232 is the descriptive string identifying the user (normally found in the
9233 GECOS field of the UNIX password database). Click on the <B
9237 > button to remove this dialog.</P
9239 >If the parameter <TT
9248 > then the file owner will
9249 be shown as the NT user <B
9257 > button will not allow
9258 you to change the ownership of this file to yourself (clicking on
9259 it will display a dialog box complaining that the user you are
9260 currently logged onto the NT client cannot be found). The reason
9261 for this is that changing the ownership of a file is a privileged
9262 operation in UNIX, available only to the <SPAN
9269 user. As clicking on this button causes NT to attempt to change
9270 the ownership of a file to the current user logged into the NT
9271 client this will not work with Samba at this time.</P
9273 >There is an NT chown command that will work with Samba
9274 and allow a user with Administrator privilege connected
9275 to a Samba 2.0.4 server as root to change the ownership of
9276 files on both a local NTFS filesystem or remote mounted NTFS
9277 or Samba drive. This is available as part of the <SPAN
9284 > NT security library written by Jeremy Allison of
9285 the Samba Team, available from the main Samba ftp site.</P
9294 >11.4. Viewing file or directory permissions</H2
9296 >The third button is the <B
9300 button. Clicking on this brings up a dialog box that shows both
9301 the permissions and the UNIX owner of the file or directory.
9302 The owner is displayed in the form :</P
9306 >"SERVER\user (Long name)"</B
9314 > is the NetBIOS name of
9315 the Samba server, <TT
9320 > is the user name of
9321 the UNIX user who owns the file, and <TT
9327 is the descriptive string identifying the user (normally found in the
9328 GECOS field of the UNIX password database).</P
9330 >If the parameter <TT
9339 > then the file owner will
9340 be shown as the NT user <B
9344 permissions will be shown as NT "Full Control".</P
9346 >The permissions field is displayed differently for files
9347 and directories, so I'll describe the way file permissions
9348 are displayed first.</P
9356 >11.4.1. File Permissions</H3
9358 >The standard UNIX user/group/world triple and
9359 the corresponding "read", "write", "execute" permissions
9360 triples are mapped by Samba into a three element NT ACL
9361 with the 'r', 'w', and 'x' bits mapped into the corresponding
9362 NT permissions. The UNIX world permissions are mapped into
9363 the global NT group <B
9367 by the list of permissions allowed for UNIX world. The UNIX
9368 owner and group permissions are displayed as an NT
9376 > icon respectively followed by the list
9377 of permissions allowed for the UNIX user and group.</P
9379 >As many UNIX permission sets don't map into common
9390 usually the permissions will be prefixed by the words <B
9392 > "Special Access"</B
9393 > in the NT display list.</P
9395 >But what happens if the file has no permissions allowed
9396 for a particular UNIX user group or world component ? In order
9397 to allow "no permissions" to be seen and modified then Samba
9400 >"Take Ownership"</B
9402 (which has no meaning in UNIX) and reports a component with
9403 no permissions as having the NT <B
9407 This was chosen of course to make it look like a zero, meaning
9408 zero permissions. More details on the decision behind this will
9418 >11.4.2. Directory Permissions</H3
9420 >Directories on an NT NTFS file system have two
9421 different sets of permissions. The first set of permissions
9422 is the ACL set on the directory itself, this is usually displayed
9423 in the first set of parentheses in the normal <B
9427 NT style. This first set of permissions is created by Samba in
9428 exactly the same way as normal file permissions are, described
9429 above, and is displayed in the same way.</P
9431 >The second set of directory permissions has no real meaning
9432 in the UNIX permissions world and represents the <B
9435 > permissions that any file created within
9436 this directory would inherit.</P
9438 >Samba synthesises these inherited permissions for NT by
9439 returning as an NT ACL the UNIX permission mode that a new file
9440 created by Samba on this share would receive.</P
9450 >11.5. Modifying file or directory permissions</H2
9452 >Modifying file and directory permissions is as simple
9453 as changing the displayed permissions in the dialog box, and
9457 > button. However, there are
9458 limitations that a user needs to be aware of, and also interactions
9459 with the standard Samba permission masks and mapping of DOS
9460 attributes that need to also be taken into account.</P
9462 >If the parameter <TT
9471 > then any attempt to set
9472 security permissions will fail with an <B
9478 >The first thing to note is that the <B
9482 button will not return a list of users in Samba 2.0.4 (it will give
9483 an error message of <B
9485 >"The remote procedure call failed
9486 and did not execute"</B
9487 >). This means that you can only
9488 manipulate the current user/group/world permissions listed in
9489 the dialog box. This actually works quite well as these are the
9490 only permissions that UNIX actually has.</P
9492 >If a permission triple (either user, group, or world)
9493 is removed from the list of permissions in the NT dialog box,
9497 > button is pressed it will
9498 be applied as "no permissions" on the UNIX side. If you then
9499 view the permissions again the "no permissions" entry will appear
9503 > flag, as described above. This
9504 allows you to add permissions back to a file or directory once
9505 you have removed them from a triple component.</P
9507 >As UNIX supports only the "r", "w" and "x" bits of
9508 an NT ACL then if other NT security attributes such as "Delete
9509 access" are selected then they will be ignored when applied on
9510 the Samba server.</P
9512 >When setting permissions on a directory the second
9513 set of permissions (in the second set of parentheses) is
9514 by default applied to all files within that directory. If this
9515 is not what you want you must uncheck the <B
9518 permissions on existing files"</B
9519 > checkbox in the NT
9520 dialog before clicking <B
9525 >If you wish to remove all permissions from a
9526 user/group/world component then you may either highlight the
9527 component and click the <B
9531 or set the component to only have the special <B
9535 > permission (displayed as <B
9548 >11.6. Interaction with the standard Samba create mask
9551 >Note that with Samba 2.0.5 there are four new parameters
9552 to control this interaction. These are :</P
9564 >force security mode</I
9571 >directory security mask</I
9578 >force directory security mode</I
9582 >Once a user clicks <B
9586 permissions Samba maps the given permissions into a user/group/world
9587 r/w/x triple set, and then will check the changed permissions for a
9588 file against the bits set in the <A
9589 HREF="smb.conf.5.html#SECURITYMASK"
9598 > parameter. Any bits that
9599 were changed that are not set to '1' in this parameter are left alone
9600 in the file permissions.</P
9602 >Essentially, zero bits in the <TT
9608 mask may be treated as a set of bits the user is <SPAN
9615 allowed to change, and one bits are those the user is allowed to change.
9618 >If not set explicitly this parameter is set to the same value as
9620 HREF="smb.conf.5.html#CREATEMASK"
9629 > parameter to provide compatibility with Samba 2.0.4
9630 where this permission change facility was introduced. To allow a user to
9631 modify all the user/group/world permissions on a file, set this parameter
9634 >Next Samba checks the changed permissions for a file against
9635 the bits set in the <A
9636 HREF="smb.conf.5.html#FORCESECURITYMODE"
9641 >force security mode</I
9644 > parameter. Any bits
9645 that were changed that correspond to bits set to '1' in this parameter
9646 are forced to be set.</P
9648 >Essentially, bits set in the <TT
9651 >force security mode
9654 > parameter may be treated as a set of bits that, when
9655 modifying security on a file, the user has always set to be 'on'.</P
9657 >If not set explicitly this parameter is set to the same value
9659 HREF="smb.conf.5.html#FORCECREATEMODE"
9668 > parameter to provide compatibility
9669 with Samba 2.0.4 where the permission change facility was introduced.
9670 To allow a user to modify all the user/group/world permissions on a file
9671 with no restrictions set this parameter to 000.</P
9684 > parameters are applied to the change
9685 request in that order.</P
9687 >For a directory Samba will perform the same operations as
9688 described above for a file except using the parameter <TT
9691 > directory security mask</I
9702 >force directory security mode
9705 > parameter instead of <TT
9708 >force security mode
9716 >directory security mask</I
9719 by default is set to the same value as the <TT
9725 > parameter and the <TT
9728 >force directory security
9731 > parameter by default is set to the same value as
9735 >force directory mode</I
9737 > parameter to provide
9738 compatibility with Samba 2.0.4 where the permission change facility
9741 >In this way Samba enforces the permission restrictions that
9742 an administrator can set on a Samba share, whilst still allowing users
9743 to modify the permission bits within that restriction.</P
9745 >If you want to set up a share that allows users full control
9746 in modifying the permission bits on their files and directories and
9747 doesn't force any particular bits to be set 'on', then set the following
9748 parameters in the <A
9749 HREF="smb.conf.5.html"
9756 > file in that share specific section :</P
9761 >security mask = 0777</I
9768 >force security mode = 0</I
9775 >directory security mask = 0777</I
9782 >force directory security mode = 0</I
9786 >As described, in Samba 2.0.4 the parameters :</P
9798 >force create mode</I
9812 >force directory mode</I
9816 >were used instead of the parameters discussed here.</P
9825 >11.7. Interaction with the standard Samba file attribute
9828 >Samba maps some of the DOS attribute bits (such as "read
9829 only") into the UNIX permissions of a file. This means there can
9830 be a conflict between the permission bits set via the security
9831 dialog and the permission bits set by the file attribute mapping.
9834 >One way this can show up is if a file has no UNIX read access
9835 for the owner it will show up as "read only" in the standard
9836 file attributes tabbed dialog. Unfortunately this dialog is
9837 the same one that contains the security info in another tab.</P
9839 >What this can mean is that if the owner changes the permissions
9840 to allow themselves read access using the security dialog, clicks
9844 > to get back to the standard attributes tab
9845 dialog, and then clicks <B
9848 > on that dialog, then
9849 NT will set the file permissions back to read-only (as that is what
9850 the attributes still say in the dialog). This means that after setting
9851 permissions and clicking <B
9854 > to get back to the
9855 attributes dialog you should always hit <B
9862 > to ensure that your changes
9863 are not overridden.</P
9872 >Chapter 12. Configuring PAM for distributed but centrally
9873 managed authentication</H1
9881 >12.1. Samba and PAM</H2
9883 >A number of Unix systems (eg: Sun Solaris), as well as the
9884 xxxxBSD family and Linux, now utilize the Pluggable Authentication
9885 Modules (PAM) facility to provide all authentication,
9886 authorization and resource control services. Prior to the
9887 introduction of PAM, a decision to use an alternative to
9888 the system password database (<TT
9892 would require the provision of alternatives for all programs that provide
9893 security services. Such a choice would involve provision of
9894 alternatives to such programs as: <B
9906 >PAM provides a mechanism that disconnects these security programs
9907 from the underlying authentication/authorization infrastructure.
9908 PAM is configured either through one file <TT
9912 or by editing individual files that are located in <TT
9917 >The following is an example <TT
9919 >/etc/pam.d/login</TT
9920 > configuration file.
9921 This example had all options been uncommented is probably not usable
9922 as it stacks many conditions before allowing successful completion
9923 of the login process. Essentially all conditions can be disabled
9924 by commenting them out except the calls to <TT
9930 CLASS="PROGRAMLISTING"
9932 # The PAM configuration file for the `login' service
9934 auth required pam_securetty.so
9935 auth required pam_nologin.so
9936 # auth required pam_dialup.so
9937 # auth optional pam_mail.so
9938 auth required pam_pwdb.so shadow md5
9939 # account requisite pam_time.so
9940 account required pam_pwdb.so
9941 session required pam_pwdb.so
9942 # session optional pam_lastlog.so
9943 # password required pam_cracklib.so retry=3
9944 password required pam_pwdb.so shadow md5</PRE
9947 >PAM allows use of replacable modules. Those available on a
9948 sample system include:</P
9951 CLASS="PROGRAMLISTING"
9952 >$ /bin/ls /lib/security
9953 pam_access.so pam_ftp.so pam_limits.so
9954 pam_ncp_auth.so pam_rhosts_auth.so pam_stress.so
9955 pam_cracklib.so pam_group.so pam_listfile.so
9956 pam_nologin.so pam_rootok.so pam_tally.so
9957 pam_deny.so pam_issue.so pam_mail.so
9958 pam_permit.so pam_securetty.so pam_time.so
9959 pam_dialup.so pam_lastlog.so pam_mkhomedir.so
9960 pam_pwdb.so pam_shells.so pam_unix.so
9961 pam_env.so pam_ldap.so pam_motd.so
9962 pam_radius.so pam_smbpass.so pam_unix_acct.so
9963 pam_wheel.so pam_unix_auth.so pam_unix_passwd.so
9964 pam_userdb.so pam_warn.so pam_unix_session.so</PRE
9967 >The following example for the login program replaces the use of
9971 > module which uses the system
9972 password database (<TT
9986 > which uses the Samba
9987 database which contains the Microsoft MD4 encrypted password
9988 hashes. This database is stored in either
9991 >/usr/local/samba/private/smbpasswd</TT
9995 >/etc/samba/smbpasswd</TT
9999 >/etc/samba.d/smbpasswd</TT
10000 >, depending on the
10001 Samba implementation for your Unix/Linux system. The
10004 >pam_smbpass.so</TT
10005 > module is provided by
10006 Samba version 2.2.1 or later. It can be compiled by specifying the
10009 >--with-pam_smbpass</B
10010 > options when running Samba's
10014 > script. For more information
10018 > module, see the documentation
10021 >source/pam_smbpass</TT
10022 > directory of the Samba
10023 source distribution.</P
10026 CLASS="PROGRAMLISTING"
10028 # The PAM configuration file for the `login' service
10030 auth required pam_smbpass.so nodelay
10031 account required pam_smbpass.so nodelay
10032 session required pam_smbpass.so nodelay
10033 password required pam_smbpass.so nodelay</PRE
10036 >The following is the PAM configuration file for a particular
10037 Linux system. The default condition uses <TT
10043 CLASS="PROGRAMLISTING"
10045 # The PAM configuration file for the `samba' service
10047 auth required /lib/security/pam_pwdb.so nullok nodelay shadow audit
10048 account required /lib/security/pam_pwdb.so audit nodelay
10049 session required /lib/security/pam_pwdb.so nodelay
10050 password required /lib/security/pam_pwdb.so shadow md5</PRE
10053 >In the following example the decision has been made to use the
10054 smbpasswd database even for basic samba authentication. Such a
10055 decision could also be made for the passwd program and would
10056 thus allow the smbpasswd passwords to be changed using the passwd
10060 CLASS="PROGRAMLISTING"
10062 # The PAM configuration file for the `samba' service
10064 auth required /lib/security/pam_smbpass.so nodelay
10065 account required /lib/security/pam_pwdb.so audit nodelay
10066 session required /lib/security/pam_pwdb.so nodelay
10067 password required /lib/security/pam_smbpass.so nodelay smbconf=/etc/samba.d/smb.conf</PRE
10070 >Note: PAM allows stacking of authentication mechanisms. It is
10071 also possible to pass information obtained within one PAM module through
10072 to the next module in the PAM stack. Please refer to the documentation for
10073 your particular system implementation for details regarding the specific
10074 capabilities of PAM in this environment. Some Linux implmentations also
10078 > module that allows all
10079 authentication to be configured in a single central file. The
10083 > method has some very devoted followers
10084 on the basis that it allows for easier administration. As with all issues in
10085 life though, every decision makes trade-offs, so you may want examine the
10086 PAM documentation for further helpful information.</P
10095 >12.2. Distributed Authentication</H2
10097 >The astute administrator will realize from this that the
10100 >pam_smbpass.so</TT
10110 HREF="http://rsync.samba.org/"
10112 >http://rsync.samba.org/</A
10114 will allow the establishment of a centrally managed, distributed
10115 user/password database that can also be used by all
10116 PAM (eg: Linux) aware programs and applications. This arrangement
10117 can have particularly potent advantages compared with the
10118 use of Microsoft Active Directory Service (ADS) in so far as
10119 reduction of wide area network authentication traffic.</P
10128 >12.3. PAM Configuration in smb.conf</H2
10130 >There is an option in smb.conf called <A
10131 HREF="smb.conf.5.html#OBEYPAMRESTRICTIONS"
10133 >obey pam restrictions</A
10135 The following is from the on-line help for this option in SWAT;</P
10137 >When Samba 2.2 is configure to enable PAM support (i.e.
10141 >), this parameter will
10142 control whether or not Samba should obey PAM's account
10143 and session management directives. The default behavior
10144 is to use PAM for clear text authentication only and to
10145 ignore any account or session management. Note that Samba always
10146 ignores PAM for authentication in the case of
10148 HREF="smb.conf.5.html#ENCRYPTPASSWORDS"
10150 >encrypt passwords = yes</A
10152 The reason is that PAM modules cannot support the challenge/response
10153 authentication mechanism needed in the presence of SMB
10154 password encryption. </P
10158 >obey pam restrictions = no</B
10168 >Chapter 13. Hosting a Microsoft Distributed File System tree on Samba</H1
10176 >13.1. Instructions</H2
10178 >The Distributed File System (or Dfs) provides a means of
10179 separating the logical view of files and directories that users
10180 see from the actual physical locations of these resources on the
10181 network. It allows for higher availability, smoother storage expansion,
10182 load balancing etc. For more information about Dfs, refer to <A
10183 HREF="http://www.microsoft.com/NTServer/nts/downloads/winfeatures/NTSDistrFile/AdminGuide.asp"
10185 > Microsoft documentation</A
10188 >This document explains how to host a Dfs tree on a Unix
10189 machine (for Dfs-aware clients to browse) using Samba.</P
10191 >To enable SMB-based DFS for Samba, configure it with the
10197 > option. Once built, a
10198 Samba server can be made a Dfs server by setting the global
10200 HREF="smb.conf.5.html#HOSTMSDFS"
10208 > parameter in the <TT
10212 > file. You designate a share as a Dfs root using the share
10214 HREF="smb.conf.5.html#MSDFSROOT"
10222 > parameter. A Dfs root directory on
10223 Samba hosts Dfs links in the form of symbolic links that point
10224 to other servers. For example, a symbolic link
10227 >junction->msdfs:storage1\share1</TT
10229 the share directory acts as the Dfs junction. When Dfs-aware
10230 clients attempt to access the junction link, they are redirected
10231 to the storage location (in this case, \\storage1\share1).</P
10233 >Dfs trees on Samba work with all Dfs-aware clients ranging
10234 from Windows 95 to 2000.</P
10236 >Here's an example of setting up a Dfs tree on a Samba
10240 CLASS="PROGRAMLISTING"
10241 ># The smb.conf file:
10243 netbios name = SAMBA
10247 path = /export/dfsroot
10252 >In the /export/dfsroot directory we set up our dfs links to
10253 other servers on the network.</P
10261 >cd /export/dfsroot</B
10271 >chown root /export/dfsroot</B
10281 >chmod 755 /export/dfsroot</B
10291 >ln -s msdfs:storageA\\shareA linka</B
10301 >ln -s msdfs:serverB\\share,serverC\\share linkb</B
10305 >You should set up the permissions and ownership of
10306 the directory acting as the Dfs root such that only designated
10307 users can create, delete or modify the msdfs links. Also note
10308 that symlink names should be all lowercase. This limitation exists
10309 to have Samba avoid trying all the case combinations to get at
10310 the link name. Finally set up the symbolic links to point to the
10311 network shares you want, and start Samba.</P
10313 >Users on Dfs-aware clients can now browse the Dfs tree
10314 on the Samba server at \\samba\dfs. Accessing
10315 links linka or linkb (which appear as directories to the client)
10316 takes users directly to the appropriate shares on the network.</P
10330 >Windows clients need to be rebooted
10331 if a previously mounted non-dfs share is made a dfs
10332 root or vice versa. A better way is to introduce a
10333 new share and make it the dfs root.</P
10337 >Currently there's a restriction that msdfs
10338 symlink names should all be lowercase.</P
10342 >For security purposes, the directory
10343 acting as the root of the Dfs tree should have ownership
10344 and permissions set so that only designated users can
10345 modify the symbolic links in the directory.</P
10357 >Chapter 14. Printing Support</H1
10365 >14.1. Introduction</H2
10367 >Beginning with the 2.2.0 release, Samba supports
10368 the native Windows NT printing mechanisms implemented via
10369 MS-RPC (i.e. the SPOOLSS named pipe). Previous versions of
10370 Samba only supported LanMan printing calls.</P
10372 >The additional functionality provided by the new
10373 SPOOLSS support includes:</P
10379 >Support for downloading printer driver
10380 files to Windows 95/98/NT/2000 clients upon demand.
10385 >Uploading of printer drivers via the
10386 Windows NT Add Printer Wizard (APW) or the
10387 Imprints tool set (refer to <A
10388 HREF="http://imprints.sourceforge.net"
10390 >http://imprints.sourceforge.net</A
10396 >Support for the native MS-RPC printing
10397 calls such as StartDocPrinter, EnumJobs(), etc... (See
10398 the MSDN documentation at <A
10399 HREF="http://msdn.microsoft.com/"
10401 >http://msdn.microsoft.com/</A
10403 for more information on the Win32 printing API)
10408 >Support for NT Access Control Lists (ACL)
10409 on printer objects</P
10413 >Improved support for printer queue manipulation
10414 through the use of an internal databases for spooled job
10419 >There has been some initial confusion about what all this means
10420 and whether or not it is a requirement for printer drivers to be
10421 installed on a Samba host in order to support printing from Windows
10422 clients. As a side note, Samba does not use these drivers in any way to process
10423 spooled files. They are utilized entirely by the clients.</P
10425 >The following MS KB article, may be of some help if you are dealing with
10426 Windows 2000 clients: <SPAN
10430 >How to Add Printers with No User
10431 Interaction in Windows 2000</I
10436 HREF="http://support.microsoft.com/support/kb/articles/Q189/1/05.ASP"
10438 >http://support.microsoft.com/support/kb/articles/Q189/1/05.ASP</A
10448 >14.2. Configuration</H2
10463 SRC="/docbook-dsssl/warning.gif"
10470 >[print$] vs. [printer$]</B
10480 >Previous versions of Samba recommended using a share named [printer$].
10481 This name was taken from the printer$ service created by Windows 9x
10482 clients when a printer was shared. Windows 9x printer servers always have
10483 a printer$ service which provides read-only access via no
10484 password in order to support printer driver downloads.</P
10486 >However, the initial implementation allowed for a
10487 parameter named <TT
10490 >printer driver location</I
10493 to be used on a per share basis to specify the location of
10494 the driver files associated with that printer. Another
10495 parameter named <TT
10501 a means of defining the printer driver name to be sent to
10514 >14.2.1. Creating [print$]</H3
10516 >In order to support the uploading of printer driver
10517 files, you must first configure a file share named [print$].
10518 The name of this share is hard coded in Samba's internals so
10519 the name is very important (print$ is the service used by
10520 Windows NT print servers to provide support for printer driver
10523 >You should modify the server's smb.conf file to add the global
10524 parameters and to create the
10525 following file share (of course, some of the parameter values,
10526 such as 'path' are arbitrary and should be replaced with
10527 appropriate values for your site):</P
10530 CLASS="PROGRAMLISTING"
10532 ; members of the ntadmin group should be able
10533 ; to add drivers and set printer properties
10534 ; root is implicitly a 'printer admin'
10535 printer admin = @ntadmin
10538 path = /usr/local/samba/printers
10542 ; since this share is configured as read only, then we need
10543 ; a 'write list'. Check the file system permissions to make
10544 ; sure this account can copy files to the share. If this
10545 ; is setup to a non-root account, then it should also exist
10546 ; as a 'printer admin'
10547 write list = @ntadmin,root</PRE
10551 HREF="smb.conf.5.html#WRITELIST"
10559 > is used to allow administrative
10560 level user accounts to have write access in order to update files
10561 on the share. See the <A
10562 HREF="smb.conf.5.html"
10566 > for more information on configuring file shares.</P
10568 >The requirement for <A
10569 HREF="smb.conf.5.html#GUESTOK"
10576 > depends upon how your
10577 site is configured. If users will be guaranteed to have
10578 an account on the Samba host, then this is a non-issue.</P
10593 SRC="/docbook-dsssl/note.gif"
10610 >The non-issue is that if all your Windows NT users are guaranteed to be
10611 authenticated by the Samba server (such as a domain member server and the NT
10612 user has already been validated by the Domain Controller in
10613 order to logon to the Windows NT console), then guest access
10614 is not necessary. Of course, in a workgroup environment where
10615 you just want to be able to print without worrying about
10616 silly accounts and security, then configure the share for
10617 guest access. You'll probably want to add <A
10618 HREF="smb.conf.5.html#MAPTOGUEST"
10622 >map to guest = Bad User</B
10624 > in the [global] section as well. Make sure
10625 you understand what this parameter does before using it
10632 >In order for a Windows NT print server to support
10633 the downloading of driver files by multiple client architectures,
10634 it must create subdirectories within the [print$] service
10635 which correspond to each of the supported client architectures.
10636 Samba follows this model as well.</P
10638 >Next create the directory tree below the [print$] share
10639 for each architecture you wish to support.</P
10642 CLASS="PROGRAMLISTING"
10644 |-W32X86 ; "Windows NT x86"
10645 |-WIN40 ; "Windows 95/98"
10646 |-W32ALPHA ; "Windows NT Alpha_AXP"
10647 |-W32MIPS ; "Windows NT R4000"
10648 |-W32PPC ; "Windows NT PowerPC"</PRE
10664 SRC="/docbook-dsssl/warning.gif"
10671 >ATTENTION! REQUIRED PERMISSIONS</B
10681 >In order to currently add a new driver to you Samba host,
10682 one of two conditions must hold true:</P
10688 >The account used to connect to the Samba host
10689 must have a uid of 0 (i.e. a root account)</P
10693 >The account used to connect to the Samba host
10694 must be a member of the <A
10695 HREF="smb.conf.5.html#PRINTERADMIN"
10708 >Of course, the connected account must still possess access
10709 to add files to the subdirectories beneath [print$]. Remember
10710 that all file shares are set to 'read only' by default.</P
10716 >Once you have created the required [print$] service and
10717 associated subdirectories, simply log onto the Samba server using
10724 from a Windows NT 4.0/2k client. Open "Network Neighbourhood" or
10725 "My Network Places" and browse for the Samba host. Once you have located
10726 the server, navigate to the "Printers..." folder.
10727 You should see an initial listing of printers
10728 that matches the printer shares defined on your Samba host.</P
10737 >14.2.2. Setting Drivers for Existing Printers</H3
10739 >The initial listing of printers in the Samba host's
10740 Printers folder will have no real printer driver assigned
10741 to them. This defaults to a NULL string to allow the use
10742 of the local Add Printer Wizard on NT/2000 clients.
10743 Attempting to view the printer properties for a printer
10744 which has this default driver assigned will result in
10745 the error message:</P
10751 >Device settings cannot be displayed. The driver
10752 for the specified printer is not installed, only spooler
10753 properties will be displayed. Do you want to install the
10758 >Click "No" in the error dialog and you will be presented with
10759 the printer properties window. The way to assign a driver to a
10760 printer is to either</P
10766 >Use the "New Driver..." button to install
10767 a new printer driver, or</P
10771 >Select a driver from the popup list of
10772 installed drivers. Initially this list will be empty.</P
10776 >If you wish to install printer drivers for client
10777 operating systems other than "Windows NT x86", you will need
10778 to use the "Sharing" tab of the printer properties dialog.</P
10780 >Assuming you have connected with a root account, you
10781 will also be able modify other printer properties such as
10782 ACLs and device settings using this dialog box.</P
10784 >A few closing comments for this section, it is possible
10785 on a Windows NT print server to have printers
10786 listed in the Printers folder which are not shared. Samba does
10787 not make this distinction. By definition, the only printers of
10788 which Samba is aware are those which are specified as shares in
10794 >Another interesting side note is that Windows NT clients do
10795 not use the SMB printer share, but rather can print directly
10796 to any printer on another Windows NT host using MS-RPC. This
10797 of course assumes that the printing client has the necessary
10798 privileges on the remote host serving the printer. The default
10799 permissions assigned by Windows NT to a printer gives the "Print"
10800 permissions to the "Everyone" well-known group.</P
10809 >14.2.3. Support a large number of printers</H3
10811 >One issue that has arisen during the development
10812 phase of Samba 2.2 is the need to support driver downloads for
10813 100's of printers. Using the Windows NT APW is somewhat
10814 awkward to say the list. If more than one printer are using the
10815 same driver, the <A
10816 HREF="rpcclient.1.html"
10821 setdriver command</B
10823 > can be used to set the driver
10824 associated with an installed driver. The following is example
10825 of how this could be accomplished:</P
10828 CLASS="PROGRAMLISTING"
10833 >rpcclient pogo -U root%secret -c "enumdrivers"
10834 Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
10837 Printer Driver Info 1:
10838 Driver Name: [HP LaserJet 4000 Series PS]
10840 Printer Driver Info 1:
10841 Driver Name: [HP LaserJet 2100 Series PS]
10843 Printer Driver Info 1:
10844 Driver Name: [HP LaserJet 4Si/4SiMX PS]
10849 >rpcclient pogo -U root%secret -c "enumprinters"
10850 Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
10852 name:[\\POGO\hp-print]
10853 description:[POGO\\POGO\hp-print,NO DRIVER AVAILABLE FOR THIS PRINTER,]
10859 >rpcclient pogo -U root%secret \
10863 > -c "setdriver hp-print \"HP LaserJet 4000 Series PS\""
10864 Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
10865 Successfully set hp-print to driver HP LaserJet 4000 Series PS.</PRE
10875 >14.2.4. Adding New Printers via the Windows NT APW</H3
10877 >By default, Samba offers all printer shares defined in <TT
10881 in the "Printers..." folder. Also existing in this folder is the Windows NT
10882 Add Printer Wizard icon. The APW will be show only if</P
10888 >The connected user is able to successfully
10889 execute an OpenPrinterEx(\\server) with administrative
10890 privileges (i.e. root or <TT
10901 HREF="smb.conf.5.html#SHOWADDPRINTERWIZARD"
10907 add printer wizard = yes</I
10915 >In order to be able to use the APW to successfully add a printer to a Samba
10917 HREF="smb.conf.5.html#ADDPRINTERCOMMAND"
10926 > must have a defined value. The program
10927 hook must successfully add the printer to the system (i.e.
10931 > or appropriate files) and
10937 >When using the APW from a client, if the named printer share does
10941 > will execute the <TT
10947 > and reparse to the <TT
10951 to attempt to locate the new printer share. If the share is still not defined,
10952 an error of "Access Denied" is returned to the client. Note that the
10956 >add printer program</I
10958 > is executed under the context
10959 of the connected user, not necessarily a root account.</P
10961 >There is a complementary <A
10962 HREF="smb.conf.5.html#DELETEPRINTERCOMMAND"
10971 > for removing entries from the "Printers..."
10974 >The following is an example <A
10975 HREF="smb.conf.5.html#ADDPRINTERCOMMAN"
10980 >add printer command</I
10983 > script. It adds the appropriate entries to <TT
10985 >/etc/printcap.local</TT
10986 > (change that to what you need) and returns a line of 'Done' which is needed for the whole process to work.</P
10988 CLASS="PROGRAMLISTING"
10991 # Script to insert a new printer entry into printcap.local
10993 # $1, printer name, used as the descriptive name
10994 # $2, share name, used as the printer name for Linux
10997 # $5, location, used for the device file of the printer
10998 # $6, win9x location
11001 # Make sure we use the location that RedHat uses for local printer defs
11002 PRINTCAP=/etc/printcap.local
11003 DATE=`date +%Y%m%d-%H%M%S`
11005 RESTART="service lpd restart"
11008 cp $PRINTCAP $PRINTCAP.$DATE
11009 # Add the printer to $PRINTCAP
11010 echo "" >> $PRINTCAP
11011 echo "$2|$1:\\" >> $PRINTCAP
11012 echo " :sd=/var/spool/lpd/$2:\\" >> $PRINTCAP
11013 echo " :mx=0:ml=0:sh:\\" >> $PRINTCAP
11014 echo " :lp=/usr/local/samba/var/print/$5.prn:" >> $PRINTCAP
11016 touch "/usr/local/samba/var/print/$5.prn" >> /tmp/printadd.$$ 2>&1
11017 chown $LP "/usr/local/samba/var/print/$5.prn" >> /tmp/printadd.$$ 2>&1
11019 mkdir /var/spool/lpd/$2
11020 chmod 700 /var/spool/lpd/$2
11021 chown $LP /var/spool/lpd/$2
11022 #echo $1 >> "/usr/local/samba/var/print/$5.prn"
11023 #echo $2 >> "/usr/local/samba/var/print/$5.prn"
11024 #echo $3 >> "/usr/local/samba/var/print/$5.prn"
11025 #echo $4 >> "/usr/local/samba/var/print/$5.prn"
11026 #echo $5 >> "/usr/local/samba/var/print/$5.prn"
11027 #echo $6 >> "/usr/local/samba/var/print/$5.prn"
11028 $RESTART >> "/usr/local/samba/var/print/$5.prn"
11029 # Not sure if this is needed
11030 touch /usr/local/samba/lib/smb.conf
11032 # You need to return a value, but I am not sure what it means.
11044 >14.2.5. Samba and Printer Ports</H3
11046 >Windows NT/2000 print servers associate a port with each printer. These normally
11047 take the form of LPT1:, COM1:, FILE:, etc... Samba must also support the
11048 concept of ports associated with a printer. By default, only one printer port,
11049 named "Samba Printer Port", exists on a system. Samba does not really a port in
11050 order to print, rather it is a requirement of Windows clients. </P
11052 >Note that Samba does not support the concept of "Printer Pooling" internally
11053 either. This is when a logical printer is assigned to multiple ports as
11054 a form of load balancing or fail over.</P
11056 >If you require that multiple ports be defined for some reason,
11061 HREF="smb.conf.5.html#ENUMPORTSCOMMAND"
11070 > which can be used to define an external program
11071 that generates a listing of ports on a system.</P
11081 >14.3. The Imprints Toolset</H2
11083 >The Imprints tool set provides a UNIX equivalent of the
11084 Windows NT Add Printer Wizard. For complete information, please
11085 refer to the Imprints web site at <A
11086 HREF="http://imprints.sourceforge.net/"
11088 > http://imprints.sourceforge.net/</A
11089 > as well as the documentation
11090 included with the imprints source distribution. This section will
11091 only provide a brief introduction to the features of Imprints.</P
11099 >14.3.1. What is Imprints?</H3
11101 >Imprints is a collection of tools for supporting the goals
11108 >Providing a central repository information
11109 regarding Windows NT and 95/98 printer driver packages</P
11113 >Providing the tools necessary for creating
11114 the Imprints printer driver packages.</P
11118 >Providing an installation client which
11119 will obtain and install printer drivers on remote Samba
11120 and Windows NT 4 print servers.</P
11131 >14.3.2. Creating Printer Driver Packages</H3
11133 >The process of creating printer driver packages is beyond
11134 the scope of this document (refer to Imprints.txt also included
11135 with the Samba distribution for more information). In short,
11136 an Imprints driver package is a gzipped tarball containing the
11137 driver files, related INF files, and a control file needed by the
11138 installation client.</P
11147 >14.3.3. The Imprints server</H3
11149 >The Imprints server is really a database server that
11150 may be queried via standard HTTP mechanisms. Each printer
11151 entry in the database has an associated URL for the actual
11152 downloading of the package. Each package is digitally signed
11153 via GnuPG which can be used to verify that package downloaded
11154 is actually the one referred in the Imprints database. It is
11161 > recommended that this security check
11171 >14.3.4. The Installation Client</H3
11173 >More information regarding the Imprints installation client
11174 is available in the <TT
11176 >Imprints-Client-HOWTO.ps</TT
11178 file included with the imprints source package.</P
11180 >The Imprints installation client comes in two forms.</P
11186 >a set of command line Perl scripts</P
11190 >a GTK+ based graphical interface to
11191 the command line perl scripts</P
11195 >The installation client (in both forms) provides a means
11196 of querying the Imprints database server for a matching
11197 list of known printer model names as well as a means to
11198 download and install the drivers on remote Samba and Windows
11199 NT print servers.</P
11201 >The basic installation process is in four steps and
11202 perl code is wrapped around <B
11212 CLASS="PROGRAMLISTING"
11214 foreach (supported architecture for a given driver)
11216 1. rpcclient: Get the appropriate upload directory
11217 on the remote server
11218 2. smbclient: Upload the driver files
11219 3. rpcclient: Issues an AddPrinterDriver() MS-RPC
11222 4. rpcclient: Issue an AddPrinterEx() MS-RPC to actually
11223 create the printer</PRE
11226 >One of the problems encountered when implementing
11227 the Imprints tool set was the name space issues between
11228 various supported client architectures. For example, Windows
11229 NT includes a driver named "Apple LaserWriter II NTX v51.8"
11230 and Windows 95 calls its version of this driver "Apple
11231 LaserWriter II NTX"</P
11233 >The problem is how to know what client drivers have
11234 been uploaded for a printer. As astute reader will remember
11235 that the Windows NT Printer Properties dialog only includes
11236 space for one printer driver name. A quick look in the
11237 Windows NT 4.0 system registry at</P
11241 >HKLM\System\CurrentControlSet\Control\Print\Environment
11245 >will reveal that Windows NT always uses the NT driver
11246 name. This is ok as Windows NT always requires that at least
11247 the Windows NT version of the printer driver is present.
11248 However, Samba does not have the requirement internally.
11249 Therefore, how can you use the NT driver name if is has not
11250 already been installed?</P
11252 >The way of sidestepping this limitation is to require
11253 that all Imprints printer driver packages include both the Intel
11254 Windows NT and 95/98 printer drivers and that NT driver is
11255 installed first.</P
11265 >14.4. Diagnosis</H2
11273 >14.4.1. Introduction</H3
11275 >This is a short description of how to debug printing problems with
11276 Samba. This describes how to debug problems with printing from a SMB
11277 client to a Samba server, not the other way around. For the reverse
11278 see the examples/printing directory.</P
11280 >Ok, so you want to print to a Samba server from your PC. The first
11281 thing you need to understand is that Samba does not actually do any
11282 printing itself, it just acts as a middleman between your PC client
11283 and your Unix printing subsystem. Samba receives the file from the PC
11284 then passes the file to a external "print command". What print command
11285 you use is up to you.</P
11287 >The whole things is controlled using options in smb.conf. The most
11288 relevant options (which you should look up in the smb.conf man page)
11292 CLASS="PROGRAMLISTING"
11294 print command - send a file to a spooler
11295 lpq command - get spool queue status
11296 lprm command - remove a job
11298 path = /var/spool/lpd/samba</PRE
11301 >The following are nice to know about:</P
11304 CLASS="PROGRAMLISTING"
11305 > queuepause command - stop a printer or print queue
11306 queueresume command - start a printer or print queue</PRE
11312 CLASS="PROGRAMLISTING"
11313 > print command = /usr/bin/lpr -r -P%p %s
11314 lpq command = /usr/bin/lpq -P%p %s
11315 lprm command = /usr/bin/lprm -P%p %j
11316 queuepause command = /usr/sbin/lpc -P%p stop
11317 queuepause command = /usr/sbin/lpc -P%p start</PRE
11320 >Samba should set reasonable defaults for these depending on your
11321 system type, but it isn't clairvoyant. It is not uncommon that you
11322 have to tweak these for local conditions. The commands should
11323 always have fully specified pathnames, as the smdb may not have
11324 the correct PATH values.</P
11326 >When you send a job to Samba to be printed, it will make a temporary
11327 copy of it in the directory specified in the [printers] section.
11328 and it should be periodically cleaned out. The lpr -r option
11329 requests that the temporary copy be removed after printing; If
11330 printing fails then you might find leftover files in this directory,
11331 and it should be periodically cleaned out. Samba used the lpq
11332 command to determine the "job number" assigned to your print job
11335 >The %>letter< are "macros" that get dynamically replaced with appropriate
11336 values when they are used. The %s gets replaced with the name of the spool
11337 file that Samba creates and the %p gets replaced with the name of the
11338 printer. The %j gets replaced with the "job number" which comes from
11348 >14.4.2. Debugging printer problems</H3
11350 >One way to debug printing problems is to start by replacing these
11351 command with shell scripts that record the arguments and the contents
11352 of the print file. A simple example of this kind of things might
11356 CLASS="PROGRAMLISTING"
11357 > print command = /tmp/saveprint %p %s
11360 # we make sure that we are the right user
11361 /usr/bin/id -p >/tmp/tmp.print
11362 # we run the command and save the error messages
11363 # replace the command with the one appropriate for your system
11364 /usr/bin/lpr -r -P$1 $2 2>>&/tmp/tmp.print</PRE
11367 >Then you print a file and try removing it. You may find that the
11368 print queue needs to be stopped in order to see the queue status
11369 and remove the job:</P
11372 CLASS="PROGRAMLISTING"
11373 > h4: {42} % echo hi >/tmp/hi
11374 h4: {43} % smbclient //localhost/lw4
11375 added interface ip=10.0.0.4 bcast=10.0.0.255 nmask=255.255.255.0
11377 Domain=[ASTART] OS=[Unix] Server=[Samba 2.0.7]
11378 smb: \> print /tmp/hi
11379 putting file /tmp/hi as hi-17534 (0.0 kb/s) (average 0.0 kb/s)
11382 smb: \> cancel 1049
11383 Error cancelling job 1049 : code 0
11384 smb: \> cancel 1049
11387 smb: \> exit</PRE
11390 >The 'code 0' indicates that the job was removed. The comment
11391 by the smbclient is a bit misleading on this.
11392 You can observe the command output and then and look at the
11393 /tmp/tmp.print file to see what the results are. You can quickly
11394 find out if the problem is with your printing system. Often people
11395 have problems with their /etc/printcap file or permissions on
11396 various print queues.</P
11405 >14.4.3. What printers do I have?</H3
11407 >You can use the 'testprns' program to check to see if the printer
11408 name you are using is recognized by Samba. For example, you can
11412 CLASS="PROGRAMLISTING"
11413 > testprns printer /etc/printcap</PRE
11416 >Samba can get its printcap information from a file or from a program.
11417 You can try the following to see the format of the extracted
11421 CLASS="PROGRAMLISTING"
11422 > testprns -a printer /etc/printcap
11424 testprns -a printer '|/bin/cat printcap'</PRE
11434 >14.4.4. Setting up printcap and print servers</H3
11436 >You may need to set up some printcaps for your Samba system to use.
11437 It is strongly recommended that you use the facilities provided by
11438 the print spooler to set up queues and printcap information.</P
11440 >Samba requires either a printcap or program to deliver printcap
11441 information. This printcap information has the format:</P
11444 CLASS="PROGRAMLISTING"
11445 > name|alias1|alias2...:option=value:...</PRE
11448 >For almost all printing systems, the printer 'name' must be composed
11449 only of alphanumeric or underscore '_' characters. Some systems also
11450 allow hyphens ('-') as well. An alias is an alternative name for the
11451 printer, and an alias with a space in it is used as a 'comment'
11452 about the printer. The printcap format optionally uses a \ at the end of lines
11453 to extend the printcap to multiple lines.</P
11455 >Here are some examples of printcap files:</P
11463 >pr just printer name</P
11467 >pr|alias printer name and alias</P
11471 >pr|My Printer printer name, alias used as comment</P
11475 >pr:sh:\ Same as pr:sh:cm= testing
11481 >pr:sh Same as pr:sh:cm= testing
11487 >Samba reads the printcap information when first started. If you make
11488 changes in the printcap information, then you must do the following:</P
11495 >make sure that the print spooler is aware of these changes.
11496 The LPRng system uses the 'lpc reread' command to do this.</P
11500 >make sure that the spool queues, etc., exist and have the
11501 correct permissions. The LPRng system uses the 'checkpc -f'
11502 command to do this.</P
11506 >You now should send a SIGHUP signal to the smbd server to have
11507 it reread the printcap information.</P
11518 >14.4.5. Job sent, no output</H3
11520 >This is the most frustrating part of printing. You may have sent the
11521 job, verified that the job was forwarded, set up a wrapper around
11522 the command to send the file, but there was no output from the printer.</P
11524 >First, check to make sure that the job REALLY is getting to the
11525 right print queue. If you are using a BSD or LPRng print spooler,
11526 you can temporarily stop the printing of jobs. Jobs can still be
11527 submitted, but they will not be printed. Use:</P
11530 CLASS="PROGRAMLISTING"
11531 > lpc -Pprinter stop</PRE
11534 >Now submit a print job and then use 'lpq -Pprinter' to see if the
11535 job is in the print queue. If it is not in the print queue then
11536 you will have to find out why it is not being accepted for printing.</P
11538 >Next, you may want to check to see what the format of the job really
11539 was. With the assistance of the system administrator you can view
11540 the submitted jobs files. You may be surprised to find that these
11541 are not in what you would expect to call a printable format.
11542 You can use the UNIX 'file' utitily to determine what the job
11543 format actually is:</P
11546 CLASS="PROGRAMLISTING"
11547 > cd /var/spool/lpd/printer # spool directory of print jobs
11548 ls # find job files
11549 file dfA001myhost</PRE
11552 >You should make sure that your printer supports this format OR that
11553 your system administrator has installed a 'print filter' that will
11554 convert the file to a format appropriate for your printer.</P
11563 >14.4.6. Job sent, strange output</H3
11565 >Once you have the job printing, you can then start worrying about
11566 making it print nicely.</P
11568 >The most common problem is extra pages of output: banner pages
11569 OR blank pages at the end.</P
11571 >If you are getting banner pages, check and make sure that the
11572 printcap option or printer option is configured for no banners.
11573 If you have a printcap, this is the :sh (suppress header or banner
11574 page) option. You should have the following in your printer.</P
11577 CLASS="PROGRAMLISTING"
11578 > printer: ... :sh</PRE
11581 >If you have this option and are still getting banner pages, there
11582 is a strong chance that your printer is generating them for you
11583 automatically. You should make sure that banner printing is disabled
11584 for the printer. This usually requires using the printer setup software
11585 or procedures supplied by the printer manufacturer.</P
11587 >If you get an extra page of output, this could be due to problems
11588 with your job format, or if you are generating PostScript jobs,
11589 incorrect setting on your printer driver on the MicroSoft client.
11590 For example, under Win95 there is a option:</P
11593 CLASS="PROGRAMLISTING"
11594 > Printers|Printer Name|(Right Click)Properties|Postscript|Advanced|</PRE
11597 >that allows you to choose if a Ctrl-D is appended to all jobs.
11598 This is a very bad thing to do, as most spooling systems will
11599 automatically add a ^D to the end of the job if it is detected as
11600 PostScript. The multiple ^D may cause an additional page of output.</P
11609 >14.4.7. Raw PostScript printed</H3
11611 >This is a problem that is usually caused by either the print spooling
11612 system putting information at the start of the print job that makes
11613 the printer think the job is a text file, or your printer simply
11614 does not support PostScript. You may need to enable 'Automatic
11615 Format Detection' on your printer.</P
11624 >14.4.8. Advanced Printing</H3
11626 >Note that you can do some pretty magic things by using your
11627 imagination with the "print command" option and some shell scripts.
11628 Doing print accounting is easy by passing the %U option to a print
11629 command shell script. You could even make the print command detect
11630 the type of output and its size and send it to an appropriate
11640 >14.4.9. Real debugging</H3
11642 >If the above debug tips don't help, then maybe you need to bring in
11643 the bug guns, system tracing. See Tracing.txt in this directory.</P
11651 NAME="SECURITYLEVELS"
11653 >Chapter 15. Security levels</H1
11661 >15.1. Introduction</H2
11663 >Samba supports the following options to the global smb.conf parameter</P
11666 CLASS="PROGRAMLISTING"
11669 HREF="smb.conf.5.html#SECURITY"
11677 > = [share|user(default)|server|domain|ads]</PRE
11680 >Please refer to the smb.conf man page for usage information and to the document
11682 HREF="DOMAIN_MEMBER.html"
11684 >DOMAIN_MEMBER.html</A
11685 > for further background details
11686 on domain mode security. The Windows 2000 Kerberos domain security model
11687 (security = ads) is described in the <A
11688 HREF="ADS-HOWTO.html"
11693 >Of the above, "security = server" means that Samba reports to clients that
11694 it is running in "user mode" but actually passes off all authentication
11695 requests to another "user mode" server. This requires an additional
11696 parameter "password server =" that points to the real authentication server.
11697 That real authentication server can be another Samba server or can be a
11698 Windows NT server, the later natively capable of encrypted password support.</P
11707 >15.2. More complete description of security levels</H2
11709 >A SMB server tells the client at startup what "security level" it is
11710 running. There are two options "share level" and "user level". Which
11711 of these two the client receives affects the way the client then tries
11712 to authenticate itself. It does not directly affect (to any great
11713 extent) the way the Samba server does security. I know this is
11714 strange, but it fits in with the client/server approach of SMB. In SMB
11715 everything is initiated and controlled by the client, and the server
11716 can only tell the client what is available and whether an action is
11719 >I'll describe user level security first, as its simpler. In user level
11720 security the client will send a "session setup" command directly after
11721 the protocol negotiation. This contains a username and password. The
11722 server can either accept or reject that username/password
11723 combination. Note that at this stage the server has no idea what
11724 share the client will eventually try to connect to, so it can't base
11725 the "accept/reject" on anything other than:</P
11732 >the username/password</P
11736 >the machine that the client is coming from</P
11740 >If the server accepts the username/password then the client expects to
11741 be able to mount any share (using a "tree connection") without
11742 specifying a password. It expects that all access rights will be as
11743 the username/password specified in the "session setup". </P
11745 >It is also possible for a client to send multiple "session setup"
11746 requests. When the server responds it gives the client a "uid" to use
11747 as an authentication tag for that username/password. The client can
11748 maintain multiple authentication contexts in this way (WinDD is an
11749 example of an application that does this)</P
11751 >Ok, now for share level security. In share level security the client
11752 authenticates itself separately for each share. It will send a
11753 password along with each "tree connection" (share mount). It does not
11754 explicitly send a username with this operation. The client is
11755 expecting a password to be associated with each share, independent of
11756 the user. This means that samba has to work out what username the
11757 client probably wants to use. It is never explicitly sent the
11758 username. Some commercial SMB servers such as NT actually associate
11759 passwords directly with shares in share level security, but samba
11760 always uses the unix authentication scheme where it is a
11761 username/password that is authenticated, not a "share/password".</P
11763 >Many clients send a "session setup" even if the server is in share
11764 level security. They normally send a valid username but no
11765 password. Samba records this username in a list of "possible
11766 usernames". When the client then does a "tree connection" it also adds
11767 to this list the name of the share they try to connect to (useful for
11768 home directories) and any users listed in the "user =" smb.conf
11769 line. The password is then checked in turn against these "possible
11770 usernames". If a match is found then the client is authenticated as
11773 >Finally "server level" security. In server level security the samba
11774 server reports to the client that it is in user level security. The
11775 client then does a "session setup" as described earlier. The samba
11776 server takes the username/password that the client sends and attempts
11777 to login to the "password server" by sending exactly the same
11778 username/password that it got from the client. If that server is in
11779 user level security and accepts the password then samba accepts the
11780 clients connection. This allows the samba server to use another SMB
11781 server as the "password server". </P
11783 >You should also note that at the very start of all this, where the
11784 server tells the client what security level it is in, it also tells
11785 the client if it supports encryption. If it does then it supplies the
11786 client with a random "cryptkey". The client will then send all
11787 passwords in encrypted form. You have to compile samba with encryption
11788 enabled to support this feature, and you have to maintain a separate
11789 smbpasswd file with SMB style encrypted passwords. It is
11790 cryptographically impossible to translate from unix style encryption
11791 to SMB style encryption, although there are some fairly simple management
11792 schemes by which the two could be kept in sync.</P
11801 >Chapter 16. Unified Logons between Windows NT and UNIX using Winbind</H1
11809 >16.1. Abstract</H2
11811 >Integration of UNIX and Microsoft Windows NT through
11812 a unified logon has been considered a "holy grail" in heterogeneous
11813 computing environments for a long time. We present
11820 >, a component of the Samba suite
11821 of programs as a solution to the unified logon problem. Winbind
11822 uses a UNIX implementation
11823 of Microsoft RPC calls, Pluggable Authentication Modules, and the Name
11824 Service Switch to allow Windows NT domain users to appear and operate
11825 as UNIX users on a UNIX machine. This paper describes the winbind
11826 system, explaining the functionality it provides, how it is configured,
11827 and how it works internally.</P
11836 >16.2. Introduction</H2
11838 >It is well known that UNIX and Microsoft Windows NT have
11839 different models for representing user and group information and
11840 use different technologies for implementing them. This fact has
11841 made it difficult to integrate the two systems in a satisfactory
11844 >One common solution in use today has been to create
11845 identically named user accounts on both the UNIX and Windows systems
11846 and use the Samba suite of programs to provide file and print services
11847 between the two. This solution is far from perfect however, as
11848 adding and deleting users on both sets of machines becomes a chore
11849 and two sets of passwords are required both of which
11850 can lead to synchronization problems between the UNIX and Windows
11851 systems and confusion for users.</P
11853 >We divide the unified logon problem for UNIX machines into
11854 three smaller problems:</P
11860 >Obtaining Windows NT user and group information
11865 >Authenticating Windows NT users
11870 >Password changing for Windows NT users
11875 >Ideally, a prospective solution to the unified logon problem
11876 would satisfy all the above components without duplication of
11877 information on the UNIX machines and without creating additional
11878 tasks for the system administrator when maintaining users and
11879 groups on either system. The winbind system provides a simple
11880 and elegant solution to all three components of the unified logon
11890 >16.3. What Winbind Provides</H2
11892 >Winbind unifies UNIX and Windows NT account management by
11893 allowing a UNIX box to become a full member of a NT domain. Once
11894 this is done the UNIX box will see NT users and groups as if
11895 they were native UNIX users and groups, allowing the NT domain
11896 to be used in much the same manner that NIS+ is used within
11897 UNIX-only environments.</P
11899 >The end result is that whenever any
11900 program on the UNIX machine asks the operating system to lookup
11901 a user or group name, the query will be resolved by asking the
11902 NT domain controller for the specified domain to do the lookup.
11903 Because Winbind hooks into the operating system at a low level
11904 (via the NSS name resolution modules in the C library) this
11905 redirection to the NT domain controller is completely
11908 >Users on the UNIX machine can then use NT user and group
11909 names as they would use "native" UNIX names. They can chown files
11910 so that they are owned by NT domain users or even login to the
11911 UNIX machine and run a UNIX X-Window session as a domain user.</P
11913 >The only obvious indication that Winbind is being used is
11914 that user and group names take the form DOMAIN\user and
11915 DOMAIN\group. This is necessary as it allows Winbind to determine
11916 that redirection to a domain controller is wanted for a particular
11917 lookup and which trusted domain is being referenced.</P
11919 >Additionally, Winbind provides an authentication service
11920 that hooks into the Pluggable Authentication Modules (PAM) system
11921 to provide authentication via a NT domain to any PAM enabled
11922 applications. This capability solves the problem of synchronizing
11923 passwords between systems since all passwords are stored in a single
11924 location (on the domain controller).</P
11932 >16.3.1. Target Uses</H3
11934 >Winbind is targeted at organizations that have an
11935 existing NT based domain infrastructure into which they wish
11936 to put UNIX workstations or servers. Winbind will allow these
11937 organizations to deploy UNIX workstations without having to
11938 maintain a separate account infrastructure. This greatly
11939 simplifies the administrative overhead of deploying UNIX
11940 workstations into a NT based organization.</P
11942 >Another interesting way in which we expect Winbind to
11943 be used is as a central part of UNIX based appliances. Appliances
11944 that provide file and print services to Microsoft based networks
11945 will be able to use Winbind to provide seamless integration of
11946 the appliance into the domain.</P
11956 >16.4. How Winbind Works</H2
11958 >The winbind system is designed around a client/server
11959 architecture. A long running <B
11963 listens on a UNIX domain socket waiting for requests
11964 to arrive. These requests are generated by the NSS and PAM
11965 clients and processed sequentially.</P
11967 >The technologies used to implement winbind are described
11968 in detail below.</P
11976 >16.4.1. Microsoft Remote Procedure Calls</H3
11978 >Over the last two years, efforts have been underway
11979 by various Samba Team members to decode various aspects of
11980 the Microsoft Remote Procedure Call (MSRPC) system. This
11981 system is used for most network related operations between
11982 Windows NT machines including remote management, user authentication
11983 and print spooling. Although initially this work was done
11984 to aid the implementation of Primary Domain Controller (PDC)
11985 functionality in Samba, it has also yielded a body of code which
11986 can be used for other purposes.</P
11988 >Winbind uses various MSRPC calls to enumerate domain users
11989 and groups and to obtain detailed information about individual
11990 users or groups. Other MSRPC calls can be used to authenticate
11991 NT domain users and to change user passwords. By directly querying
11992 a Windows PDC for user and group information, winbind maps the
11993 NT account information onto UNIX user and group names.</P
12002 >16.4.2. Name Service Switch</H3
12004 >The Name Service Switch, or NSS, is a feature that is
12005 present in many UNIX operating systems. It allows system
12006 information such as hostnames, mail aliases and user information
12007 to be resolved from different sources. For example, a standalone
12008 UNIX workstation may resolve system information from a series of
12009 flat files stored on the local filesystem. A networked workstation
12010 may first attempt to resolve system information from local files,
12011 and then consult a NIS database for user information or a DNS server
12012 for hostname information.</P
12014 >The NSS application programming interface allows winbind
12015 to present itself as a source of system information when
12016 resolving UNIX usernames and groups. Winbind uses this interface,
12017 and information obtained from a Windows NT server using MSRPC
12018 calls to provide a new source of account enumeration. Using standard
12019 UNIX library calls, one can enumerate the users and groups on
12020 a UNIX machine running winbind and see all users and groups in
12021 a NT domain plus any trusted domain as though they were local
12022 users and groups.</P
12024 >The primary control file for NSS is
12027 >/etc/nsswitch.conf</TT
12029 When a UNIX application makes a request to do a lookup
12030 the C library looks in <TT
12032 >/etc/nsswitch.conf</TT
12034 for a line which matches the service type being requested, for
12035 example the "passwd" service type is used when user or group names
12036 are looked up. This config line species which implementations
12037 of that service should be tried and in what order. If the passwd
12042 >passwd: files example</B
12045 >then the C library will first load a module called
12048 >/lib/libnss_files.so</TT
12052 >/lib/libnss_example.so</TT
12054 C library will dynamically load each of these modules in turn
12055 and call resolver functions within the modules to try to resolve
12056 the request. Once the request is resolved the C library returns the
12057 result to the application.</P
12059 >This NSS interface provides a very easy way for Winbind
12060 to hook into the operating system. All that needs to be done
12063 >libnss_winbind.so</TT
12068 then add "winbind" into <TT
12070 >/etc/nsswitch.conf</TT
12072 the appropriate place. The C library will then call Winbind to
12073 resolve user and group names.</P
12082 >16.4.3. Pluggable Authentication Modules</H3
12084 >Pluggable Authentication Modules, also known as PAM,
12085 is a system for abstracting authentication and authorization
12086 technologies. With a PAM module it is possible to specify different
12087 authentication methods for different system applications without
12088 having to recompile these applications. PAM is also useful
12089 for implementing a particular policy for authorization. For example,
12090 a system administrator may only allow console logins from users
12091 stored in the local password file but only allow users resolved from
12092 a NIS database to log in over the network.</P
12094 >Winbind uses the authentication management and password
12095 management PAM interface to integrate Windows NT users into a
12096 UNIX system. This allows Windows NT users to log in to a UNIX
12097 machine and be authenticated against a suitable Primary Domain
12098 Controller. These users can also change their passwords and have
12099 this change take effect directly on the Primary Domain Controller.
12102 >PAM is configured by providing control files in the directory
12106 > for each of the services that
12107 require authentication. When an authentication request is made
12108 by an application the PAM code in the C library looks up this
12109 control file to determine what modules to load to do the
12110 authentication check and in what order. This interface makes adding
12111 a new authentication service for Winbind very easy, all that needs
12112 to be done is that the <TT
12114 >pam_winbind.so</TT
12118 >/lib/security/</TT
12120 control files for relevant services are updated to allow
12121 authentication via winbind. See the PAM documentation
12122 for more details.</P
12131 >16.4.4. User and Group ID Allocation</H3
12133 >When a user or group is created under Windows NT
12134 is it allocated a numerical relative identifier (RID). This is
12135 slightly different to UNIX which has a range of numbers that are
12136 used to identify users, and the same range in which to identify
12137 groups. It is winbind's job to convert RIDs to UNIX id numbers and
12138 vice versa. When winbind is configured it is given part of the UNIX
12139 user id space and a part of the UNIX group id space in which to
12140 store Windows NT users and groups. If a Windows NT user is
12141 resolved for the first time, it is allocated the next UNIX id from
12142 the range. The same process applies for Windows NT groups. Over
12143 time, winbind will have mapped all Windows NT users and groups
12144 to UNIX user ids and group ids.</P
12146 >The results of this mapping are stored persistently in
12147 an ID mapping database held in a tdb database). This ensures that
12148 RIDs are mapped to UNIX IDs in a consistent way.</P
12157 >16.4.5. Result Caching</H3
12159 >An active system can generate a lot of user and group
12160 name lookups. To reduce the network cost of these lookups winbind
12161 uses a caching scheme based on the SAM sequence number supplied
12162 by NT domain controllers. User or group information returned
12163 by a PDC is cached by winbind along with a sequence number also
12164 returned by the PDC. This sequence number is incremented by
12165 Windows NT whenever any user or group information is modified. If
12166 a cached entry has expired, the sequence number is requested from
12167 the PDC and compared against the sequence number of the cached entry.
12168 If the sequence numbers do not match, then the cached information
12169 is discarded and up to date information is requested directly
12180 >16.5. Installation and Configuration</H2
12182 >Many thanks to John Trostel <A
12183 HREF="mailto:jtrostel@snapserver.com"
12185 >jtrostel@snapserver.com</A
12187 for providing the HOWTO for this section.</P
12189 >This HOWTO describes how to get winbind services up and running
12190 to control access and authenticate users on your Linux box using
12191 the winbind services which come with SAMBA 2.2.2.</P
12193 >There is also some Solaris specific information in
12196 >docs/textdocs/Solaris-Winbind-HOWTO.txt</TT
12198 Future revisions of this document will incorporate that
12207 >16.5.1. Introduction</H3
12209 >This HOWTO describes the procedures used to get winbind up and
12210 running on my RedHat 7.1 system. Winbind is capable of providing access
12211 and authentication control for Windows Domain users through an NT
12212 or Win2K PDC for 'regular' services, such as telnet a nd ftp, as
12213 well for SAMBA services.</P
12215 >This HOWTO has been written from a 'RedHat-centric' perspective, so if
12216 you are using another distribution, you may have to modify the instructions
12217 somewhat to fit the way your distribution works.</P
12227 >Why should I to this?</I
12232 >This allows the SAMBA administrator to rely on the
12233 authentication mechanisms on the NT/Win2K PDC for the authentication
12234 of domain members. NT/Win2K users no longer need to have separate
12235 accounts on the SAMBA server.
12244 >Who should be reading this document?</I
12249 > This HOWTO is designed for system administrators. If you are
12250 implementing SAMBA on a file server and wish to (fairly easily)
12251 integrate existing NT/Win2K users from your PDC onto the
12252 SAMBA server, this HOWTO is for you. That said, I am no NT or PAM
12253 expert, so you may find a better or easier way to accomplish
12266 >16.5.2. Requirements</H3
12268 >If you have a samba configuration file that you are currently
12275 > If your system already uses PAM,
12286 > If you haven't already made a boot disk,
12295 >Messing with the pam configuration files can make it nearly impossible
12296 to log in to yourmachine. That's why you want to be able to boot back
12297 into your machine in single user mode and restore your
12301 > back to the original state they were in if
12302 you get frustrated with the way things are going. ;-)</P
12304 >The latest version of SAMBA (version 3.0 as of this writing), now
12305 includes a functioning winbindd daemon. Please refer to the
12307 HREF="http://samba.org/"
12309 >main SAMBA web page</A
12311 better yet, your closest SAMBA mirror site for instructions on
12312 downloading the source code.</P
12314 >To allow Domain users the ability to access SAMBA shares and
12315 files, as well as potentially other services provided by your
12316 SAMBA machine, PAM (pluggable authentication modules) must
12317 be setup properly on your machine. In order to compile the
12318 winbind modules, you should have at least the pam libraries resident
12319 on your system. For recent RedHat systems (7.1, for instance), that
12323 >. For best results, it is helpful to also
12324 install the development packages in <TT
12326 >pam-devel-0.74-22</TT
12336 >16.5.3. Testing Things Out</H3
12338 >Before starting, it is probably best to kill off all the SAMBA
12339 related daemons running on your server. Kill off all <B
12349 > processes that may
12350 be running. To use PAM, you will want to make sure that you have the
12351 standard PAM package (for RedHat) which supplies the <TT
12355 directory structure, including the pam modules are used by pam-aware
12356 services, several pam libraries, and the <TT
12363 > entries for pam. Winbind built better
12364 in SAMBA if the pam-devel package was also installed. This package includes
12365 the header files needed to compile pam-aware applications. For instance,
12366 my RedHat system has both <TT
12372 >pam-devel-0.74-22</TT
12373 > RPMs installed.</P
12381 >16.5.3.1. Configure and compile SAMBA</H4
12383 >The configuration and compilation of SAMBA is pretty straightforward.
12384 The first three steps may not be necessary depending upon
12385 whether or not you have previously built the Samba binaries.</P
12388 CLASS="PROGRAMLISTING"
12408 >rm config.cache</B
12415 >./configure --with-winbind</B
12433 >This will, by default, install SAMBA in <TT
12435 >/usr/local/samba</TT
12437 See the main SAMBA documentation if you want to install SAMBA somewhere else.
12438 It will also build the winbindd executable and libraries. </P
12447 >16.5.3.2. Configure <TT
12451 winbind libraries</H4
12453 >The libraries needed to run the <B
12457 through nsswitch need to be copied to their proper locations, so</P
12464 >cp ../samba/source/nsswitch/libnss_winbind.so /lib</B
12467 >I also found it necessary to make the following symbolic link:</P
12474 >ln -s /lib/libnss_winbind.so /lib/libnss_winbind.so.2</B
12477 >And, in the case of Sun solaris:</P
12484 >ln -s /usr/lib/libnss_winbind.so /usr/lib/libnss_winbind.so.1</B
12491 >ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.1</B
12498 >ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.2</B
12501 >Now, as root you need to edit <TT
12503 >/etc/nsswitch.conf</TT
12505 allow user and group entries to be visible from the <B
12511 >/etc/nsswitch.conf</TT
12513 this after editing:</P
12516 CLASS="PROGRAMLISTING"
12517 > passwd: files winbind
12519 group: files winbind</PRE
12523 The libraries needed by the winbind daemon will be automatically
12524 entered into the <B
12527 > cache the next time
12528 your system reboots, but it
12529 is faster (and you don't need to reboot) if you do it manually:</P
12536 >/sbin/ldconfig -v | grep winbind</B
12541 >libnss_winbind</TT
12542 > available to winbindd
12543 and echos back a check to you.</P
12552 >16.5.3.3. Configure smb.conf</H4
12554 >Several parameters are needed in the smb.conf file to control
12562 > These are described in more detail in
12564 HREF="winbindd.8.html"
12571 > file was modified to
12572 include the following entries in the [global] section:</P
12575 CLASS="PROGRAMLISTING"
12578 # separate domain and username with '+', like DOMAIN+username
12580 HREF="winbindd.8.html#WINBINDSEPARATOR"
12582 >winbind separator</A
12584 # use uids from 10000 to 20000 for domain users
12586 HREF="winbindd.8.html#WINBINDUID"
12590 # use gids from 10000 to 20000 for domain groups
12592 HREF="winbindd.8.html#WINBINDGID"
12596 # allow enumeration of winbind users and groups
12598 HREF="winbindd.8.html#WINBINDENUMUSERS"
12600 >winbind enum users</A
12603 HREF="winbindd.8.html#WINBINDENUMGROUP"
12605 >winbind enum groups</A
12607 # give winbind users a real shell (only needed if they have telnet access)
12609 HREF="winbindd.8.html#TEMPLATEHOMEDIR"
12611 >template homedir</A
12612 > = /home/winnt/%D/%U
12614 HREF="winbindd.8.html#TEMPLATESHELL"
12627 >16.5.3.4. Join the SAMBA server to the PDC domain</H4
12629 >Enter the following command to make the SAMBA server join the
12630 PDC domain, where <TT
12631 CLASS="REPLACEABLE"
12636 your Windows domain and <TT
12637 CLASS="REPLACEABLE"
12642 a domain user who has administrative privileges in the domain.</P
12649 >/usr/local/samba/bin/net rpc join -S PDC -U Administrator</B
12652 >The proper response to the command should be: "Joined the domain
12654 CLASS="REPLACEABLE"
12659 CLASS="REPLACEABLE"
12664 is your DOMAIN name.</P
12673 >16.5.3.5. Start up the winbindd daemon and test it!</H4
12675 >Eventually, you will want to modify your smb startup script to
12676 automatically invoke the winbindd daemon when the other parts of
12677 SAMBA start, but it is possible to test out just the winbind
12678 portion first. To start up winbind services, enter the following
12679 command as root:</P
12686 >/usr/local/samba/bin/winbindd</B
12689 >I'm always paranoid and like to make sure the daemon
12690 is really running...</P
12697 >ps -ae | grep winbindd</B
12700 >This command should produce output like this, if the daemon is running</P
12702 >3025 ? 00:00:00 winbindd</P
12704 >Now... for the real test, try to get some information about the
12705 users on your PDC</P
12712 >/usr/local/samba/bin/wbinfo -u</B
12716 This should echo back a list of users on your Windows users on
12717 your PDC. For example, I get the following response:</P
12720 CLASS="PROGRAMLISTING"
12726 CEO+TsInternetUser</PRE
12729 >Obviously, I have named my domain 'CEO' and my <TT
12737 >You can do the same sort of thing to get group information from
12741 CLASS="PROGRAMLISTING"
12747 >/usr/local/samba/bin/wbinfo -g</B
12752 CEO+Domain Computers
12753 CEO+Domain Controllers
12754 CEO+Cert Publishers
12756 CEO+Enterprise Admins
12757 CEO+Group Policy Creator Owners</PRE
12760 >The function 'getent' can now be used to get unified
12761 lists of both local and PDC users and groups.
12762 Try the following command:</P
12772 >You should get a list that looks like your <TT
12776 list followed by the domain users with their new uids, gids, home
12777 directories and default shells.</P
12779 >The same thing can be done for groups with the command</P
12796 >16.5.3.6. Fix the init.d startup scripts</H4
12804 >16.5.3.6.1. Linux</H5
12809 > daemon needs to start up after the
12816 > daemons are running.
12817 To accomplish this task, you need to modify the startup scripts of your system. They are located at <TT
12819 >/etc/init.d/smb</TT
12823 >/etc/init.d/samba</TT
12825 script to add commands to invoke this daemon in the proper sequence. My
12826 startup script starts up <B
12839 >/usr/local/samba/bin</TT
12840 > directory directly. The 'start'
12841 function in the script looks like this:</P
12844 CLASS="PROGRAMLISTING"
12847 echo -n $"Starting $KIND services: "
12848 daemon /usr/local/samba/bin/smbd $SMBDOPTIONS
12852 echo -n $"Starting $KIND services: "
12853 daemon /usr/local/samba/bin/nmbd $NMBDOPTIONS
12857 echo -n $"Starting $KIND services: "
12858 daemon /usr/local/samba/bin/winbindd
12861 [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] && touch /var/lock/subsys/smb || \
12867 >The 'stop' function has a corresponding entry to shut down the
12868 services and look s like this:</P
12871 CLASS="PROGRAMLISTING"
12874 echo -n $"Shutting down $KIND services: "
12879 echo -n $"Shutting down $KIND services: "
12884 echo -n $"Shutting down $KIND services: "
12887 [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] && rm -f /var/lock/subsys/smb
12900 >16.5.3.6.2. Solaris</H5
12902 >On solaris, you need to modify the
12905 >/etc/init.d/samba.server</TT
12906 > startup script. It usually
12907 only starts smbd and nmbd but should now start winbindd too. If you
12908 have samba installed in <TT
12910 >/usr/local/samba/bin</TT
12912 the file could contains something like this:</P
12915 CLASS="PROGRAMLISTING"
12920 if [ ! -d /usr/bin ]
12921 then # /usr not mounted
12925 killproc() { # kill the named process(es)
12926 pid=`/usr/bin/ps -e |
12927 /usr/bin/grep -w $1 |
12928 /usr/bin/sed -e 's/^ *//' -e 's/ .*//'`
12929 [ "$pid" != "" ] && kill $pid
12932 # Start/stop processes required for samba server
12938 # Edit these lines to suit your installation (paths, workgroup, host)
12941 /usr/local/samba/bin/smbd -D -s \
12942 /usr/local/samba/smb.conf
12945 /usr/local/samba/bin/nmbd -D -l \
12946 /usr/local/samba/var/log -s /usr/local/samba/smb.conf
12948 echo Starting Winbind Daemon
12949 /usr/local/samba/bin/winbindd
12959 echo "Usage: /etc/init.d/samba.server { start | stop }"
12971 >16.5.3.6.3. Restarting</H5
12973 >If you restart the <B
12983 > daemons at this point, you
12984 should be able to connect to the samba server as a domain member just as
12985 if you were a local user.</P
12995 >16.5.3.7. Configure Winbind and PAM</H4
12997 >If you have made it this far, you know that winbindd and samba are working
12998 together. If you want to use winbind to provide authentication for other
12999 services, keep reading. The pam configuration files need to be altered in
13000 this step. (Did you remember to make backups of your original
13004 > files? If not, do it now.)</P
13006 >You will need a pam module to use winbindd with these other services. This
13007 module will be compiled in the <TT
13009 >../source/nsswitch</TT
13011 by invoking the command</P
13018 >make nsswitch/pam_winbind.so</B
13027 >pam_winbind.so</TT
13028 > file should be copied to the location of
13029 your other pam security modules. On my RedHat system, this was the
13033 > directory. On Solaris, the pam security
13034 modules reside in <TT
13036 >/usr/lib/security</TT
13044 >cp ../samba/source/nsswitch/pam_winbind.so /lib/security</B
13053 >16.5.3.7.1. Linux/FreeBSD-specific PAM configuration</H5
13057 >/etc/pam.d/samba</TT
13058 > file does not need to be changed. I
13059 just left this fileas it was:</P
13062 CLASS="PROGRAMLISTING"
13063 >auth required /lib/security/pam_stack.so service=system-auth
13064 account required /lib/security/pam_stack.so service=system-auth</PRE
13067 >The other services that I modified to allow the use of winbind
13068 as an authentication service were the normal login on the console (or a terminal
13069 session), telnet logins, and ftp service. In order to enable these
13070 services, you may first need to change the entries in
13076 >/etc/inetd.conf</TT
13078 RedHat 7.1 uses the new xinetd.d structure, in this case you need
13079 to change the lines in <TT
13081 >/etc/xinetd.d/telnet</TT
13085 >/etc/xinetd.d/wu-ftp</TT
13089 CLASS="PROGRAMLISTING"
13096 CLASS="PROGRAMLISTING"
13101 For ftp services to work properly, you will also need to either
13102 have individual directories for the domain users already present on
13103 the server, or change the home directory template to a general
13104 directory for all domain users. These can be easily set using
13111 >template homedir</B
13116 >/etc/pam.d/ftp</TT
13117 > file can be changed
13118 to allow winbind ftp access in a manner similar to the
13121 >/etc/pam.d/ftp</TT
13123 changed to look like this:</P
13126 CLASS="PROGRAMLISTING"
13127 >auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
13128 auth sufficient /lib/security/pam_winbind.so
13129 auth required /lib/security/pam_stack.so service=system-auth
13130 auth required /lib/security/pam_shells.so
13131 account sufficient /lib/security/pam_winbind.so
13132 account required /lib/security/pam_stack.so service=system-auth
13133 session required /lib/security/pam_stack.so service=system-auth</PRE
13138 >/etc/pam.d/login</TT
13139 > file can be changed nearly the
13140 same way. It now looks like this:</P
13143 CLASS="PROGRAMLISTING"
13144 >auth required /lib/security/pam_securetty.so
13145 auth sufficient /lib/security/pam_winbind.so
13146 auth sufficient /lib/security/pam_unix.so use_first_pass
13147 auth required /lib/security/pam_stack.so service=system-auth
13148 auth required /lib/security/pam_nologin.so
13149 account sufficient /lib/security/pam_winbind.so
13150 account required /lib/security/pam_stack.so service=system-auth
13151 password required /lib/security/pam_stack.so service=system-auth
13152 session required /lib/security/pam_stack.so service=system-auth
13153 session optional /lib/security/pam_console.so</PRE
13156 >In this case, I added the <B
13158 >auth sufficient /lib/security/pam_winbind.so</B
13160 lines as before, but also added the <B
13162 >required pam_securetty.so</B
13164 above it, to disallow root logins over the network. I also added a
13167 >sufficient /lib/security/pam_unix.so use_first_pass</B
13172 > line to get rid of annoying
13173 double prompts for passwords.</P
13182 >16.5.3.7.2. Solaris-specific configuration</H5
13184 >The /etc/pam.conf needs to be changed. I changed this file so that my Domain
13185 users can logon both locally as well as telnet.The following are the changes
13186 that I made.You can customize the pam.conf file as per your requirements,but
13187 be sure of those changes because in the worst case it will leave your system
13188 nearly impossible to boot.</P
13191 CLASS="PROGRAMLISTING"
13193 #ident "@(#)pam.conf 1.14 99/09/16 SMI"
13195 # Copyright (c) 1996-1999, Sun Microsystems, Inc.
13196 # All Rights Reserved.
13198 # PAM configuration
13200 # Authentication management
13202 login auth required /usr/lib/security/pam_winbind.so
13203 login auth required /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
13204 login auth required /usr/lib/security/$ISA/pam_dial_auth.so.1 try_first_pass
13206 rlogin auth sufficient /usr/lib/security/pam_winbind.so
13207 rlogin auth sufficient /usr/lib/security/$ISA/pam_rhosts_auth.so.1
13208 rlogin auth required /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
13210 dtlogin auth sufficient /usr/lib/security/pam_winbind.so
13211 dtlogin auth required /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
13213 rsh auth required /usr/lib/security/$ISA/pam_rhosts_auth.so.1
13214 other auth sufficient /usr/lib/security/pam_winbind.so
13215 other auth required /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
13217 # Account management
13219 login account sufficient /usr/lib/security/pam_winbind.so
13220 login account requisite /usr/lib/security/$ISA/pam_roles.so.1
13221 login account required /usr/lib/security/$ISA/pam_unix.so.1
13223 dtlogin account sufficient /usr/lib/security/pam_winbind.so
13224 dtlogin account requisite /usr/lib/security/$ISA/pam_roles.so.1
13225 dtlogin account required /usr/lib/security/$ISA/pam_unix.so.1
13227 other account sufficient /usr/lib/security/pam_winbind.so
13228 other account requisite /usr/lib/security/$ISA/pam_roles.so.1
13229 other account required /usr/lib/security/$ISA/pam_unix.so.1
13231 # Session management
13233 other session required /usr/lib/security/$ISA/pam_unix.so.1
13235 # Password management
13237 #other password sufficient /usr/lib/security/pam_winbind.so
13238 other password required /usr/lib/security/$ISA/pam_unix.so.1
13239 dtsession auth required /usr/lib/security/$ISA/pam_unix.so.1
13241 # Support for Kerberos V5 authentication (uncomment to use Kerberos)
13243 #rlogin auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
13244 #login auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
13245 #dtlogin auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
13246 #other auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
13247 #dtlogin account optional /usr/lib/security/$ISA/pam_krb5.so.1
13248 #other account optional /usr/lib/security/$ISA/pam_krb5.so.1
13249 #other session optional /usr/lib/security/$ISA/pam_krb5.so.1
13250 #other password optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass</PRE
13253 >I also added a try_first_pass line after the winbind.so line to get rid of
13254 annoying double prompts for passwords.</P
13256 >Now restart your Samba & try connecting through your application that you
13257 configured in the pam.conf.</P
13269 >16.6. Limitations</H2
13271 >Winbind has a number of limitations in its current
13272 released version that we hope to overcome in future
13279 >Winbind is currently only available for
13280 the Linux operating system, although ports to other operating
13281 systems are certainly possible. For such ports to be feasible,
13282 we require the C library of the target operating system to
13283 support the Name Service Switch and Pluggable Authentication
13284 Modules systems. This is becoming more common as NSS and
13285 PAM gain support among UNIX vendors.</P
13289 >The mappings of Windows NT RIDs to UNIX ids
13290 is not made algorithmically and depends on the order in which
13291 unmapped users or groups are seen by winbind. It may be difficult
13292 to recover the mappings of rid to UNIX id mapping if the file
13293 containing this information is corrupted or destroyed.</P
13297 >Currently the winbind PAM module does not take
13298 into account possible workstation and logon time restrictions
13299 that may be been set for Windows NT users.</P
13310 >16.7. Conclusion</H2
13312 >The winbind system, through the use of the Name Service
13313 Switch, Pluggable Authentication Modules, and appropriate
13314 Microsoft RPC calls have allowed us to provide seamless
13315 integration of Microsoft Windows NT domain users on a
13316 UNIX system. The result is a great reduction in the administrative
13317 cost of running a mixed UNIX and NT network.</P
13326 >Chapter 17. Passdb MySQL plugin</H1
13334 >17.1. Building</H2
13336 >To build the plugin, run <B
13338 >make bin/pdb_mysql.so</B
13343 > directory of samba distribution. </P
13345 >Next, copy pdb_mysql.so to any location you want. I
13346 strongly recommend installing it in $PREFIX/lib or /usr/lib/samba/</P
13355 >17.2. Configuring</H2
13357 >This plugin lacks some good documentation, but here is some short info:</P
13359 >Add a the following to the <B
13362 > variable in your <TT
13367 CLASS="PROGRAMLISTING"
13368 >passdb backend = [other-plugins] plugin:/location/to/pdb_mysql.so:identifier [other-plugins]</PRE
13371 >The identifier can be any string you like, as long as it doesn't collide with
13372 the identifiers of other plugins or other instances of pdb_mysql. If you
13373 specify multiple pdb_mysql.so entries in 'passdb backend', you also need to
13374 use different identifiers!</P
13376 >Additional options can be given thru the smb.conf file in the [global] section.</P
13379 CLASS="PROGRAMLISTING"
13380 >identifier:mysql host - host name, defaults to 'localhost'
13381 identifier:mysql password
13382 identifier:mysql user - defaults to 'samba'
13383 identifier:mysql database - defaults to 'samba'
13384 identifier:mysql port - defaults to 3306
13385 identifier:table - Name of the table containing users</PRE
13388 >Names of the columns in this table(I've added column types those columns should have first):</P
13391 CLASS="PROGRAMLISTING"
13392 >identifier:logon time column - int(9)
13393 identifier:logoff time column - int(9)
13394 identifier:kickoff time column - int(9)
13395 identifier:pass last set time column - int(9)
13396 identifier:pass can change time column - int(9)
13397 identifier:pass must change time column - int(9)
13398 identifier:username column - varchar(255) - unix username
13399 identifier:domain column - varchar(255) - NT domain user is part of
13400 identifier:nt username column - varchar(255) - NT username
13401 identifier:fullname column - varchar(255) - Full name of user
13402 identifier:home dir column - varchar(255) - Unix homedir path
13403 identifier:dir drive column - varchar(2) - Directory drive path (eg: 'H:')
13404 identifier:logon script column - varchar(255) - Batch file to run on client side when logging on
13405 identifier:profile path column - varchar(255) - Path of profile
13406 identifier:acct desc column - varchar(255) - Some ASCII NT user data
13407 identifier:workstations column - varchar(255) - Workstations user can logon to (or NULL for all)
13408 identifier:unknown string column - varchar(255) - unknown string
13409 identifier:munged dial column - varchar(255) - ?
13410 identifier:uid column - int(9) - Unix user ID (uid)
13411 identifier:gid column - int(9) - Unix user group (gid)
13412 identifier:user sid column - varchar(255) - NT user SID
13413 identifier:group sid column - varchar(255) - NT group ID
13414 identifier:lanman pass column - varchar(255) - encrypted lanman password
13415 identifier:nt pass column - varchar(255) - encrypted nt passwd
13416 identifier:plaintext pass column - varchar(255) - plaintext password
13417 identifier:acct control column - int(9) - nt user data
13418 identifier:unknown 3 column - int(9) - unknown
13419 identifier:logon divs column - int(9) - ?
13420 identifier:hours len column - int(9) - ?
13421 identifier:unknown 5 column - int(9) - unknown
13422 identifier:unknown 6 column - int(9) - unknown</PRE
13425 >Eventually, you can put a colon (:) after the name of each column, which
13426 should specify the column to update when updating the table. You can also
13427 specify nothing behind the colon - then the data from the field will not be
13437 >17.3. Using plaintext passwords or encrypted password</H2
13439 >I strongly discourage the use of plaintext passwords, however, you can use them:</P
13441 >If you would like to use plaintext passwords, set 'identifier:lanman pass column' and 'identifier:nt pass column' to 'NULL' (without the quotes) and 'identifier:plaintext pass column' to the name of the column containing the plaintext passwords. </P
13443 >If you use encrypted passwords, set the 'identifier:plaintext pass column' to 'NULL' (without the quotes). This is the default.</P
13452 >17.4. Getting non-column data from the table</H2
13454 >It is possible to have not all data in the database and making some 'constant'.</P
13456 >For example, you can set 'identifier:fullname column' to :
13459 >CONCAT(First_name,' ',Sur_name)</B
13462 >Or, set 'identifier:workstations column' to :
13468 >See the MySQL documentation for more language constructs.</P
13477 >Chapter 18. Passdb XML plugin</H1
13485 >18.1. Building</H2
13487 >This module requires libxml2 to be installed.</P
13489 >To build pdb_xml, run: <B
13491 >make bin/pdb_xml.so</B
13507 >The usage of pdb_xml is pretty straightforward. To export data, use:
13511 >pdbedit -e plugin:/usr/lib/samba/pdb_xml.so:filename</B
13514 (where filename is the name of the file to put the data in)</P
13516 >To import data, use:
13519 >pdbedit -i plugin:/usr/lib/samba/pdb_xml.so:filename -e current-pdb</B
13522 Where filename is the name to read the data from and current-pdb to put it in.</P
13529 NAME="SAMBA-LDAP-HOWTO"
13531 >Chapter 19. Storing Samba's User/Machine Account information in an LDAP Directory</H1
13541 >This document describes how to use an LDAP directory for storing Samba user
13542 account information traditionally stored in the smbpasswd(5) file. It is
13543 assumed that the reader already has a basic understanding of LDAP concepts
13544 and has a working directory server already installed. For more information
13545 on LDAP architectures and Directories, please refer to the following sites.</P
13552 HREF="http://www.openldap.org/"
13554 >http://www.openldap.org/</A
13559 >iPlanet Directory Server - <A
13560 HREF="http://iplanet.netscape.com/directory"
13562 >http://iplanet.netscape.com/directory</A
13568 HREF="http://www.ora.com/"
13570 >O'Reilly Publishing</A
13572 a guide to LDAP for System Administrators which has a planned release date of
13573 early summer, 2002.</P
13575 >Two additional Samba resources which may prove to be helpful are</P
13582 HREF="http://www.unav.es/cti/ldap-smb/ldap-smb-2_2-howto.html"
13584 >Samba-PDC-LDAP-HOWTO</A
13586 maintained by Ignacio Coupeau.</P
13590 >The NT migration scripts from <A
13591 HREF="http://samba.idealx.org/"
13595 geared to manage users and group in such a Samba-LDAP Domain Controller configuration.
13607 >19.2. Introduction</H2
13609 >Traditionally, when configuring <A
13610 HREF="smb.conf.5.html#ENCRYPTPASSWORDS"
13613 passwords = yes"</A
13617 > file, user account
13618 information such as username, LM/NT password hashes, password change times, and account
13619 flags have been stored in the <TT
13622 > file. There are several
13623 disadvantages to this approach for sites with very large numbers of users (counted
13624 in the thousands).</P
13630 >The first is that all lookups must be performed sequentially. Given that
13631 there are approximately two lookups per domain logon (one for a normal
13632 session connection such as when mapping a network drive or printer), this
13633 is a performance bottleneck for lareg sites. What is needed is an indexed approach
13634 such as is used in databases.</P
13638 >The second problem is that administrators who desired to replicate a
13639 smbpasswd file to more than one Samba server were left to use external
13647 and wrote custom, in-house scripts.</P
13651 >And finally, the amount of information which is stored in an
13652 smbpasswd entry leaves no room for additional attributes such as
13653 a home directory, password expiration time, or even a Relative
13654 Identified (RID).</P
13658 >As a result of these defeciencies, a more robust means of storing user attributes
13659 used by smbd was developed. The API which defines access to user accounts
13660 is commonly referred to as the samdb interface (previously this was called the passdb
13661 API, and is still so named in the CVS trees). In Samba 2.2.3, enabling support
13662 for a samdb backend (e.g. <TT
13673 >) requires compile time support.</P
13675 >When compiling Samba to include the <TT
13681 option, smbd (and associated tools) will store and lookup user accounts in
13682 an LDAP directory. In reality, this is very easy to understand. If you are
13683 comfortable with using an smbpasswd file, simply replace "smbpasswd" with
13684 "LDAP directory" in all the documentation.</P
13686 >There are a few points to stress about what the <TT
13692 does not provide. The LDAP support referred to in the this documentation does not
13699 >A means of retrieving user account information from
13700 an Windows 2000 Active Directory server.</P
13704 >A means of replacing /etc/passwd.</P
13708 >The second item can be accomplished by using LDAP NSS and PAM modules. LGPL
13709 versions of these libraries can be obtained from PADL Software
13711 HREF="http://www.padl.com/"
13713 >http://www.padl.com/</A
13715 the details of configuring these packages are beyond the scope of this document.</P
13724 >19.3. Supported LDAP Servers</H2
13726 >The LDAP samdb code in 2.2.3 has been developed and tested using the OpenLDAP
13727 2.0 server and client libraries. The same code should be able to work with
13728 Netscape's Directory Server and client SDK. However, due to lack of testing
13729 so far, there are bound to be compile errors and bugs. These should not be
13730 hard to fix. If you are so inclined, please be sure to forward all patches to
13732 HREF="samba-patches@samba.org"
13734 >samba-patches@samba.org</A
13737 HREF="jerry@samba.org"
13739 >jerry@samba.org</A
13749 >19.4. Schema and Relationship to the RFC 2307 posixAccount</H2
13751 >Samba 2.2.3 includes the necessary schema file for OpenLDAP 2.0 in
13754 >examples/LDAP/samba.schema</TT
13755 >. (Note that this schema
13756 file has been modified since the experimental support initially included
13757 in 2.2.2). The sambaAccount objectclass is given here:</P
13760 CLASS="PROGRAMLISTING"
13761 >objectclass ( 1.3.1.5.1.4.1.7165.2.2.2 NAME 'sambaAccount' SUP top STRUCTURAL
13762 DESC 'Samba Account'
13764 MAY ( cn $ lmPassword $ ntPassword $ pwdLastSet $ logonTime $
13765 logoffTime $ kickoffTime $ pwdCanChange $ pwdMustChange $ acctFlags $
13766 displayName $ smbHome $ homeDrive $ scriptPath $ profilePath $
13767 description $ userWorkstations $ primaryGroupID $ domain ))</PRE
13770 >The samba.schema file has been formatted for OpenLDAP 2.0. The OID's are
13771 owned by the Samba Team and as such is legal to be openly published.
13772 If you translate the schema to be used with Netscape DS, please
13773 submit the modified schema file as a patch to <A
13774 HREF="jerry@samba.org"
13776 >jerry@samba.org</A
13779 >Just as the smbpasswd file is mean to store information which supplements a
13783 > entry, so is the sambaAccount object
13784 meant to supplement the UNIX user account information. A sambaAccount is a
13788 > objectclass so it can be stored individually
13789 in the directory. However, there are several fields (e.g. uid) which overlap
13790 with the posixAccount objectclass outlined in RFC2307. This is by design.</P
13792 >In order to store all user account information (UNIX and Samba) in the directory,
13793 it is necessary to use the sambaAccount and posixAccount objectclasses in
13794 combination. However, smbd will still obtain the user's UNIX account
13795 information via the standard C library calls (e.g. getpwnam(), et. al.).
13796 This means that the Samba server must also have the LDAP NSS library installed
13797 and functioning correctly. This division of information makes it possible to
13798 store all Samba account information in LDAP, but still maintain UNIX account
13799 information in NIS while the network is transitioning to a full LDAP infrastructure.</P
13808 >19.5. Configuring Samba with LDAP</H2
13816 >19.5.1. OpenLDAP configuration</H3
13818 >To include support for the sambaAccount object in an OpenLDAP directory
13819 server, first copy the samba.schema file to slapd's configuration directory.</P
13826 >cp samba.schema /etc/openldap/schema/</B
13829 >Next, include the <TT
13836 The sambaAccount object contains two attributes which depend upon other schema
13837 files. The 'uid' attribute is defined in <TT
13841 the 'displayName' attribute is defined in the <TT
13843 >inetorgperson.schema</TT
13845 file. Both of these must be included before the <TT
13851 CLASS="PROGRAMLISTING"
13852 >## /etc/openldap/slapd.conf
13854 ## schema files (core.schema is required by default)
13855 include /etc/openldap/schema/core.schema
13857 ## needed for sambaAccount
13858 include /etc/openldap/schema/cosine.schema
13859 include /etc/openldap/schema/inetorgperson.schema
13860 include /etc/openldap/schema/samba.schema
13862 ## uncomment this line if you want to support the RFC2307 (NIS) schema
13863 ## include /etc/openldap/schema/nis.schema
13868 >It is recommended that you maintain some indices on some of the most usefull attributes,
13869 like in the following example, to speed up searches made on sambaAccount objectclasses
13870 (and possibly posixAccount and posixGroup as well).</P
13873 CLASS="PROGRAMLISTING"
13874 ># Indices to maintain
13875 ## required by OpenLDAP 2.0
13876 index objectclass eq
13878 ## support pb_getsampwnam()
13880 ## support pdb_getsambapwrid()
13883 ## uncomment these if you are storing posixAccount and
13884 ## posixGroup entries in the directory as well
13885 ##index uidNumber eq
13886 ##index gidNumber eq
13888 ##index memberUid eq</PRE
13898 >19.5.2. Configuring Samba</H3
13900 >The following parameters are available in smb.conf only with <TT
13906 was included with compiling Samba.</P
13913 HREF="smb.conf.5.html#LDAPSSL"
13921 HREF="smb.conf.5.html#LDAPSERVER"
13929 HREF="smb.conf.5.html#LDAPADMINDN"
13937 HREF="smb.conf.5.html#LDAPSUFFIX"
13945 HREF="smb.conf.5.html#LDAPFILTER"
13953 HREF="smb.conf.5.html#LDAPPORT"
13960 >These are described in the <A
13961 HREF="smb.conf.5.html"
13965 page and so will not be repeated here. However, a sample smb.conf file for
13966 use with an LDAP directory could appear as</P
13969 CLASS="PROGRAMLISTING"
13970 >## /usr/local/samba/lib/smb.conf
13973 encrypt passwords = yes
13975 netbios name = TASHTEGO
13978 # ldap related parameters
13980 # define the DN to use when binding to the directory servers
13981 # The password for this DN is not stored in smb.conf. Rather it
13982 # must be set by using 'smbpasswd -w <TT
13983 CLASS="REPLACEABLE"
13988 # passphrase in the secrets.tdb file. If the "ldap admin dn" values
13989 # changes, this password will need to be reset.
13990 ldap admin dn = "cn=Samba Manager,ou=people,dc=samba,dc=org"
13992 # specify the LDAP server's hostname (defaults to locahost)
13993 ldap server = ahab.samba.org
13995 # Define the SSL option when connecting to the directory
13996 # ('off', 'start tls', or 'on' (default))
13997 ldap ssl = start tls
13999 # define the port to use in the LDAP session (defaults to 636 when
14003 # specify the base DN to use when searching the directory
14004 ldap suffix = "ou=people,dc=samba,dc=org"
14006 # generally the default ldap search filter is ok
14007 # ldap filter = "(&(uid=%u)(objectclass=sambaAccount))"</PRE
14018 >19.6. Accounts and Groups management</H2
14020 >As users accounts are managed thru the sambaAccount objectclass, you should
14021 modify you existing administration tools to deal with sambaAccount attributes.</P
14023 >Machines accounts are managed with the sambaAccount objectclass, just
14024 like users accounts. However, it's up to you to stored thoses accounts
14025 in a different tree of you LDAP namespace: you should use
14026 "ou=Groups,dc=plainjoe,dc=org" to store groups and
14027 "ou=People,dc=plainjoe,dc=org" to store users. Just configure your
14028 NSS and PAM accordingly (usually, in the /etc/ldap.conf configuration
14031 >In Samba release 2.2.3, the group management system is based on posix
14032 groups. This meand that Samba make usage of the posixGroup objectclass.
14033 For now, there is no NT-like group system management (global and local
14043 >19.7. Security and sambaAccount</H2
14045 >There are two important points to remember when discussing the security
14046 of sambaAccount entries in the directory.</P
14058 > retrieve the lmPassword or
14059 ntPassword attribute values over an unencrypted LDAP session.</P
14069 > allow non-admin users to
14070 view the lmPassword or ntPassword attribute values.</P
14074 >These password hashes are clear text equivalents and can be used to impersonate
14075 the user without deriving the original clear text strings. For more information
14076 on the details of LM/NT password hashes, refer to the <A
14077 HREF="ENCRYPTION.html"
14079 >ENCRYPTION chapter</A
14080 > of the Samba-HOWTO-Collection.</P
14082 >To remedy the first security issue, the "ldap ssl" smb.conf parameter defaults
14083 to require an encrypted session (<B
14087 the default port of 636
14088 when contacting the directory server. When using an OpenLDAP 2.0 server, it
14089 is possible to use the use the StartTLS LDAP extended operation in the place of
14090 LDAPS. In either case, you are strongly discouraged to disable this security
14096 >Note that the LDAPS protocol is deprecated in favor of the LDAPv3 StartTLS
14097 extended operation. However, the OpenLDAP library still provides support for
14098 the older method of securing communication between clients and servers.</P
14100 >The second security precaution is to prevent non-administrative users from
14101 harvesting password hashes from the directory. This can be done using the
14102 following ACL in <TT
14108 CLASS="PROGRAMLISTING"
14109 >## allow the "ldap admin dn" access, but deny everyone else
14110 access to attrs=lmPassword,ntPassword
14111 by dn="cn=Samba Admin,ou=people,dc=plainjoe,dc=org" write
14122 >19.8. LDAP specials attributes for sambaAccounts</H2
14124 >The sambaAccount objectclass is composed of the following attributes:</P
14133 >: the LANMAN password 16-byte hash stored as a character
14134 representation of a hexidecimal string.</P
14141 >: the NT password hash 16-byte stored as a character
14142 representation of a hexidecimal string.</P
14149 >: The integer time in seconds since 1970 when the
14156 > attributes were last set.
14164 >: string of 11 characters surrounded by square brackets []
14165 representing account flags such as U (user), W(workstation), X(no password expiration), and
14173 >: Integer value currently unused</P
14180 >: Integer value currently unused</P
14187 >: Integer value currently unused</P
14194 >: Integer value currently unused</P
14201 >: Integer value currently unused</P
14208 >: specifies the drive letter to which to map the
14209 UNC path specified by homeDirectory. The drive letter must be specified in the form "X:"
14210 where X is the letter of the drive to map. Refer to the "logon drive" parameter in the
14211 smb.conf(5) man page for more information.</P
14218 >: The scriptPath property specifies the path of
14219 the user's logon script, .CMD, .EXE, or .BAT file. The string can be null. The path
14220 is relative to the netlogon share. Refer to the "logon script" parameter in the
14221 smb.conf(5) man page for more information.</P
14228 >: specifies a path to the user's profile.
14229 This value can be a null string, a local absolute path, or a UNC path. Refer to the
14230 "logon path" parameter in the smb.conf(5) man page for more information.</P
14237 >: The homeDirectory property specifies the path of
14238 the home directory for the user. The string can be null. If homeDrive is set and specifies
14239 a drive letter, homeDirectory should be a UNC path. The path must be a network
14240 UNC path of the form \\server\share\directory. This value can be a null string.
14241 Refer to the "logon home" parameter in the smb.conf(5) man page for more information.
14248 >userWorkstation</TT
14249 >: character string value currently unused.
14257 >: the integer representation of the user's relative identifier
14264 >primaryGroupID</TT
14265 >: the relative identifier (RID) of the primary group
14270 >The majority of these parameters are only used when Samba is acting as a PDC of
14271 a domain (refer to the <A
14272 HREF="Samba-PDC-HOWTO.html"
14274 >Samba-PDC-HOWTO</A
14276 how to configure Samba as a Primary Domain Controller). The following four attributes
14277 are only stored with the sambaAccount entry if the values are non-default values:</P
14299 >These attributes are only stored with the sambaAccount entry if
14300 the values are non-default values. For example, assume TASHTEGO has now been
14301 configured as a PDC and that <B
14303 >logon home = \\%L\%u</B
14308 > file. When a user named "becky" logons to the domain,
14314 > string is expanded to \\TASHTEGO\becky.
14315 If the smbHome attribute exists in the entry "uid=becky,ou=people,dc=samba,dc=org",
14316 this value is used. However, if this attribute does not exist, then the value
14322 > parameter is used in its place. Samba
14323 will only write the attribute value to the directory entry is the value is
14324 something other than the default (e.g. \\MOBY\becky).</P
14333 >19.9. Example LDIF Entries for a sambaAccount</H2
14335 >The following is a working LDIF with the inclusion of the posixAccount objectclass:</P
14338 CLASS="PROGRAMLISTING"
14339 >dn: uid=guest2, ou=people,dc=plainjoe,dc=org
14340 ntPassword: 878D8014606CDA29677A44EFA1353FC7
14341 pwdMustChange: 2147483647
14342 primaryGroupID: 1201
14343 lmPassword: 552902031BEDE9EFAAD3B435B51404EE
14344 pwdLastSet: 1010179124
14346 objectClass: sambaAccount
14348 kickoffTime: 2147483647
14350 logoffTime: 2147483647
14352 pwdCanChange: 0</PRE
14355 >The following is an LDIF entry for using both the sambaAccount and
14356 posixAccount objectclasses:</P
14359 CLASS="PROGRAMLISTING"
14360 >dn: uid=gcarter, ou=people,dc=plainjoe,dc=org
14362 displayName: Gerald Carter
14363 lmPassword: 552902031BEDE9EFAAD3B435B51404EE
14364 primaryGroupID: 1201
14365 objectClass: posixAccount
14366 objectClass: sambaAccount
14368 userPassword: {crypt}BpM2ej8Rkzogo
14372 loginShell: /bin/bash
14373 logoffTime: 2147483647
14375 kickoffTime: 2147483647
14376 pwdLastSet: 1010179230
14378 homeDirectory: /home/tashtego/gcarter
14380 pwdMustChange: 2147483647
14381 ntPassword: 878D8014606CDA29677A44EFA1353FC7</PRE
14391 >19.10. Comments</H2
14393 >Please mail all comments regarding this HOWTO to <A
14394 HREF="mailto:jerry@samba.org"
14396 >jerry@samba.org</A
14397 >. This documents was
14398 last updated to reflect the Samba 2.2.3 release. </P
14407 >Chapter 20. HOWTO Access Samba source code via CVS</H1
14415 >20.1. Introduction</H2
14417 >Samba is developed in an open environment. Developers use CVS
14418 (Concurrent Versioning System) to "checkin" (also known as
14419 "commit") new source code. Samba's various CVS branches can
14420 be accessed via anonymous CVS using the instructions
14421 detailed in this chapter.</P
14423 >This document is a modified version of the instructions found at
14425 HREF="http://samba.org/samba/cvs.html"
14427 >http://samba.org/samba/cvs.html</A
14437 >20.2. CVS Access to samba.org</H2
14439 >The machine samba.org runs a publicly accessible CVS
14440 repository for access to the source code of several packages,
14441 including samba, rsync and jitterbug. There are two main ways of
14442 accessing the CVS server on this host.</P
14450 >20.2.1. Access via CVSweb</H3
14452 >You can access the source code via your
14453 favourite WWW browser. This allows you to access the contents of
14454 individual files in the repository and also to look at the revision
14455 history and commit logs of individual files. You can also ask for a diff
14456 listing between any two versions on the repository.</P
14459 HREF="http://samba.org/cgi-bin/cvsweb"
14461 >http://samba.org/cgi-bin/cvsweb</A
14471 >20.2.2. Access via cvs</H3
14473 >You can also access the source code via a
14474 normal cvs client. This gives you much more control over you can
14475 do with the repository and allows you to checkout whole source trees
14476 and keep them up to date via normal cvs commands. This is the
14477 preferred method of access if you are a developer and not
14478 just a casual browser.</P
14480 >To download the latest cvs source code, point your
14481 browser at the URL : <A
14482 HREF="http://www.cyclic.com/"
14484 >http://www.cyclic.com/</A
14486 and click on the 'How to get cvs' link. CVS is free software under
14487 the GNU GPL (as is Samba). Note that there are several graphical CVS clients
14488 which provide a graphical interface to the sometimes mundane CVS commands.
14489 Links to theses clients are also available from http://www.cyclic.com.</P
14491 >To gain access via anonymous cvs use the following steps.
14492 For this example it is assumed that you want a copy of the
14493 samba source code. For the other source code repositories
14494 on this system just substitute the correct package name</P
14501 > Install a recent copy of cvs. All you really need is a
14502 copy of the cvs client binary.
14512 >cvs -d :pserver:cvs@samba.org:/cvsroot login</B
14516 > When it asks you for a password type <TT
14531 >cvs -d :pserver:cvs@samba.org:/cvsroot co samba</B
14535 > This will create a directory called samba containing the
14536 latest samba source code (i.e. the HEAD tagged cvs branch). This
14537 currently corresponds to the 3.0 development tree.
14540 > CVS branches other HEAD can be obtained by using the <TT
14546 and defining a tag name. A list of branch tag names can be found on the
14547 "Development" page of the samba web site. A common request is to obtain the
14548 latest 2.2 release code. This could be done by using the following command.
14553 >cvs -d :pserver:cvs@samba.org:/cvsroot co -r SAMBA_2_2 samba</B
14559 > Whenever you want to merge in the latest code changes use
14560 the following command from within the samba directory:
14565 >cvs update -d -P</B
14577 NAME="GROUPMAPPING"
14579 >Chapter 21. Group mapping HOWTO</H1
14582 Starting with Samba 3.0 alpha 2, a new group mapping function is available. The
14583 current method (likely to change) to manage the groups is a new command called
14589 >The first immediate reason to use the group mapping on a PDC, is that
14592 >domain admin group</B
14597 now gone. This parameter was used to give the listed users local admin rights
14598 on their workstations. It was some magic stuff that simply worked but didn't
14599 scale very well for complex setups.</P
14601 >Let me explain how it works on NT/W2K, to have this magic fade away.
14602 When installing NT/W2K on a computer, the installer program creates some users
14603 and groups. Notably the 'Administrators' group, and gives to that group some
14604 privileges like the ability to change the date and time or to kill any process
14605 (or close too) running on the local machine. The 'Administrator' user is a
14606 member of the 'Administrators' group, and thus 'inherit' the 'Administrators'
14607 group privileges. If a 'joe' user is created and become a member of the
14608 'Administrator' group, 'joe' has exactly the same rights as 'Administrator'.</P
14610 >When a NT/W2K machine is joined to a domain, during that phase, the "Domain
14611 Administrators' group of the PDC is added to the 'Administrators' group of the
14612 workstation. Every members of the 'Domain Administrators' group 'inherit' the
14613 rights of the 'Administrators' group when logging on the workstation.</P
14615 >You are now wondering how to make some of your samba PDC users members of the
14616 'Domain Administrators' ? That's really easy.</P
14623 >create a unix group (usually in <TT
14626 >), let's call it domadm</P
14630 >add to this group the users that must be Administrators. For example if you want joe,john and mary, your entry in <TT
14633 > will look like:</P
14636 CLASS="PROGRAMLISTING"
14637 >domadm:x:502:joe,john,mary</PRE
14642 >Map this domadm group to the <B
14645 > group by running the command:</P
14649 >smbgroupedit -c "Domain Admins" -u domadm</B
14654 >You're set, joe, john and mary are domain administrators !</P
14656 >Like the Domain Admins group, you can map any arbitrary Unix group to any NT
14657 group. You can also make any Unix group a domain group. For example, on a domain
14658 member machine (an NT/W2K or a samba server running winbind), you would like to
14659 give access to a certain directory to some users who are member of a group on
14660 your samba PDC. Flag that group as a domain group by running:</P
14664 >smbgroupedit -a unixgroup -td</B
14667 >You can list the various groups in the mapping database like this</P
14671 >smbgroupedit -v</B
14680 >Chapter 22. Samba performance issues</H1
14688 >22.1. Comparisons</H2
14690 >The Samba server uses TCP to talk to the client. Thus if you are
14691 trying to see if it performs well you should really compare it to
14692 programs that use the same protocol. The most readily available
14693 programs for file transfer that use TCP are ftp or another TCP based
14696 >If you want to test against something like a NT or WfWg server then
14697 you will have to disable all but TCP on either the client or
14698 server. Otherwise you may well be using a totally different protocol
14699 (such as Netbeui) and comparisons may not be valid.</P
14701 >Generally you should find that Samba performs similarly to ftp at raw
14702 transfer speed. It should perform quite a bit faster than NFS,
14703 although this very much depends on your system.</P
14705 >Several people have done comparisons between Samba and Novell, NFS or
14706 WinNT. In some cases Samba performed the best, in others the worst. I
14707 suspect the biggest factor is not Samba vs some other system but the
14708 hardware and drivers used on the various systems. Given similar
14709 hardware Samba should certainly be competitive in speed with other
14727 >22.2.1. Overview</H3
14729 >Oplocks are the way that SMB clients get permission from a server to
14730 locally cache file operations. If a server grants an oplock
14731 (opportunistic lock) then the client is free to assume that it is the
14732 only one accessing the file and it will agressively cache file
14733 data. With some oplock types the client may even cache file open/close
14734 operations. This can give enormous performance benefits.</P
14736 >With the release of Samba 1.9.18 we now correctly support opportunistic
14737 locks. This is turned on by default, and can be turned off on a share-
14738 by-share basis by setting the parameter :</P
14742 >oplocks = False</B
14745 >We recommend that you leave oplocks on however, as current benchmark
14746 tests with NetBench seem to give approximately a 30% improvement in
14747 speed with them on. This is on average however, and the actual
14748 improvement seen can be orders of magnitude greater, depending on
14749 what the client redirector is doing.</P
14751 >Previous to Samba 1.9.18 there was a 'fake oplocks' option. This
14752 option has been left in the code for backwards compatibility reasons
14753 but it's use is now deprecated. A short summary of what the old
14754 code did follows.</P
14763 >22.2.2. Level2 Oplocks</H3
14765 >With Samba 2.0.5 a new capability - level2 (read only) oplocks is
14766 supported (although the option is off by default - see the smb.conf
14767 man page for details). Turning on level2 oplocks (on a share-by-share basis)
14768 by setting the parameter :</P
14772 >level2 oplocks = true</B
14775 >should speed concurrent access to files that are not commonly written
14776 to, such as application serving shares (ie. shares that contain common
14777 .EXE files - such as a Microsoft Office share) as it allows clients to
14778 read-ahread cache copies of these files.</P
14787 >22.2.3. Old 'fake oplocks' option - deprecated</H3
14789 >Samba can also fake oplocks, by granting a oplock whenever a client
14790 asks for one. This is controlled using the smb.conf option "fake
14791 oplocks". If you set "fake oplocks = yes" then you are telling the
14792 client that it may agressively cache the file data for all opens.</P
14794 >Enabling 'fake oplocks' on all read-only shares or shares that you know
14795 will only be accessed from one client at a time you will see a big
14796 performance improvement on many operations. If you enable this option
14797 on shares where multiple clients may be accessing the files read-write
14798 at the same time you can get data corruption.</P
14808 >22.3. Socket options</H2
14810 >There are a number of socket options that can greatly affect the
14811 performance of a TCP based server like Samba.</P
14813 >The socket options that Samba uses are settable both on the command
14814 line with the -O option, or in the smb.conf file.</P
14816 >The "socket options" section of the smb.conf manual page describes how
14817 to set these and gives recommendations.</P
14819 >Getting the socket options right can make a big difference to your
14820 performance, but getting them wrong can degrade it by just as
14821 much. The correct settings are very dependent on your local network.</P
14823 >The socket option TCP_NODELAY is the one that seems to make the
14824 biggest single difference for most networks. Many people report that
14825 adding "socket options = TCP_NODELAY" doubles the read performance of
14826 a Samba drive. The best explanation I have seen for this is that the
14827 Microsoft TCP/IP stack is slow in sending tcp ACKs.</P
14836 >22.4. Read size</H2
14838 >The option "read size" affects the overlap of disk reads/writes with
14839 network reads/writes. If the amount of data being transferred in
14840 several of the SMB commands (currently SMBwrite, SMBwriteX and
14841 SMBreadbraw) is larger than this value then the server begins writing
14842 the data before it has received the whole packet from the network, or
14843 in the case of SMBreadbraw, it begins writing to the network before
14844 all the data has been read from disk.</P
14846 >This overlapping works best when the speeds of disk and network access
14847 are similar, having very little effect when the speed of one is much
14848 greater than the other.</P
14850 >The default value is 16384, but very little experimentation has been
14851 done yet to determine the optimal value, and it is likely that the best
14852 value will vary greatly between systems anyway. A value over 65536 is
14853 pointless and will cause you to allocate memory unnecessarily.</P
14862 >22.5. Max xmit</H2
14864 >At startup the client and server negotiate a "maximum transmit" size,
14865 which limits the size of nearly all SMB commands. You can set the
14866 maximum size that Samba will negotiate using the "max xmit = " option
14867 in smb.conf. Note that this is the maximum size of SMB request that
14868 Samba will accept, but not the maximum size that the *client* will accept.
14869 The client maximum receive size is sent to Samba by the client and Samba
14870 honours this limit.</P
14872 >It defaults to 65536 bytes (the maximum), but it is possible that some
14873 clients may perform better with a smaller transmit unit. Trying values
14874 of less than 2048 is likely to cause severe problems.</P
14876 >In most cases the default is the best option.</P
14887 >By default Samba does not implement strict locking on each read/write
14888 call (although it did in previous versions). If you enable strict
14889 locking (using "strict locking = yes") then you may find that you
14890 suffer a severe performance hit on some systems.</P
14892 >The performance hit will probably be greater on NFS mounted
14893 filesystems, but could be quite high even on local disks.</P
14902 >22.7. Share modes</H2
14904 >Some people find that opening files is very slow. This is often
14905 because of the "share modes" code needed to fully implement the dos
14906 share modes stuff. You can disable this code using "share modes =
14907 no". This will gain you a lot in opening and closing files but will
14908 mean that (in some cases) the system won't force a second user of a
14909 file to open the file read-only if the first has it open
14910 read-write. For many applications that do their own locking this
14911 doesn't matter, but for some it may. Most Windows applications
14912 depend heavily on "share modes" working correctly and it is
14913 recommended that the Samba share mode support be left at the
14914 default of "on".</P
14916 >The share mode code in Samba has been re-written in the 1.9.17
14917 release following tests with the Ziff-Davis NetBench PC Benchmarking
14918 tool. It is now believed that Samba 1.9.17 implements share modes
14919 similarly to Windows NT.</P
14921 >NOTE: In the most recent versions of Samba there is an option to use
14922 shared memory via mmap() to implement the share modes. This makes
14923 things much faster. See the Makefile for how to enable this.</P
14932 >22.8. Log level</H2
14934 >If you set the log level (also known as "debug level") higher than 2
14935 then you may suffer a large drop in performance. This is because the
14936 server flushes the log file after each operation, which can be very
14946 >22.9. Wide lines</H2
14948 >The "wide links" option is now enabled by default, but if you disable
14949 it (for better security) then you may suffer a performance hit in
14950 resolving filenames. The performance loss is lessened if you have
14951 "getwd cache = yes", which is now the default.</P
14960 >22.10. Read raw</H2
14962 >The "read raw" operation is designed to be an optimised, low-latency
14963 file read operation. A server may choose to not support it,
14964 however. and Samba makes support for "read raw" optional, with it
14965 being enabled by default.</P
14967 >In some cases clients don't handle "read raw" very well and actually
14968 get lower performance using it than they get using the conventional
14969 read operations. </P
14971 >So you might like to try "read raw = no" and see what happens on your
14972 network. It might lower, raise or not affect your performance. Only
14973 testing can really tell.</P
14982 >22.11. Write raw</H2
14984 >The "write raw" operation is designed to be an optimised, low-latency
14985 file write operation. A server may choose to not support it,
14986 however. and Samba makes support for "write raw" optional, with it
14987 being enabled by default.</P
14989 >Some machines may find "write raw" slower than normal write, in which
14990 case you may wish to change this option.</P
14999 >22.12. Read prediction</H2
15001 >Samba can do read prediction on some of the SMB commands. Read
15002 prediction means that Samba reads some extra data on the last file it
15003 read while waiting for the next SMB command to arrive. It can then
15004 respond more quickly when the next read request arrives.</P
15006 >This is disabled by default. You can enable it by using "read
15007 prediction = yes".</P
15009 >Note that read prediction is only used on files that were opened read
15012 >Read prediction should particularly help for those silly clients (such
15013 as "Write" under NT) which do lots of very small reads on a file.</P
15015 >Samba will not read ahead more data than the amount specified in the
15016 "read size" option. It always reads ahead on 1k block boundaries.</P
15025 >22.13. Memory mapping</H2
15027 >Samba supports reading files via memory mapping them. One some
15028 machines this can give a large boost to performance, on others it
15029 makes not difference at all, and on some it may reduce performance.</P
15031 >To enable you you have to recompile Samba with the -DUSE_MMAP option
15032 on the FLAGS line of the Makefile.</P
15034 >Note that memory mapping is only used on files opened read only, and
15035 is not used by the "read raw" operation. Thus you may find memory
15036 mapping is more effective if you disable "read raw" using "read raw =
15046 >22.14. Slow Clients</H2
15048 >One person has reported that setting the protocol to COREPLUS rather
15049 than LANMAN2 gave a dramatic speed improvement (from 10k/s to 150k/s).</P
15051 >I suspect that his PC's (386sx16 based) were asking for more data than
15052 they could chew. I suspect a similar speed could be had by setting
15053 "read raw = no" and "max xmit = 2048", instead of changing the
15054 protocol. Lowering the "read size" might also help.</P
15063 >22.15. Slow Logins</H2
15065 >Slow logins are almost always due to the password checking time. Using
15066 the lowest practical "password level" will improve things a lot. You
15067 could also enable the "UFC crypt" option in the Makefile.</P
15076 >22.16. Client tuning</H2
15078 >Often a speed problem can be traced to the client. The client (for
15079 example Windows for Workgroups) can often be tuned for better TCP
15082 >See your client docs for details. In particular, I have heard rumours
15083 that the WfWg options TCPWINDOWSIZE and TCPSEGMENTSIZE can have a
15084 large impact on performance.</P
15086 >Also note that some people have found that setting DefaultRcvWindow in
15087 the [MSTCP] section of the SYSTEM.INI file under WfWg to 3072 gives a
15088 big improvement. I don't know why.</P
15090 >My own experience wth DefaultRcvWindow is that I get much better
15091 performance with a large value (16384 or larger). Other people have
15092 reported that anything over 3072 slows things down enourmously. One
15093 person even reported a speed drop of a factor of 30 when he went from
15094 3072 to 8192. I don't know why.</P
15096 >It probably depends a lot on your hardware, and the type of unix box
15097 you have at the other end of the link.</P
15099 >Paul Cochrane has done some testing on client side tuning and come
15100 to the following conclusions:</P
15102 >Install the W2setup.exe file from www.microsoft.com. This is an
15103 update for the winsock stack and utilities which improve performance.</P
15105 >Configure the win95 TCPIP registry settings to give better
15106 perfomance. I use a program called MTUSPEED.exe which I got off the
15107 net. There are various other utilities of this type freely available.
15108 The setting which give the best performance for me are:</P
15123 >MTUAutoDiscover Disable</P
15127 >MTUBlackHoleDetect Disable</P
15131 >Time To Live Enabled</P
15135 >Time To Live - HOPS 32</P
15139 >NDI Cache Size 0</P
15143 >I tried virtually all of the items mentioned in the document and
15144 the only one which made a difference to me was the socket options. It
15145 turned out I was better off without any!!!!!</P
15147 >In terms of overall speed of transfer, between various win95 clients
15148 and a DX2-66 20MB server with a crappy NE2000 compatible and old IDE
15149 drive (Kernel 2.0.30). The transfer rate was reasonable for 10 baseT.</P
15152 The figures are: Put Get
15153 P166 client 3Com card: 420-440kB/s 500-520kB/s
15154 P100 client 3Com card: 390-410kB/s 490-510kB/s
15155 DX4-75 client NE2000: 370-380kB/s 330-350kB/s</P
15157 >I based these test on transfer two files a 4.5MB text file and a 15MB
15158 textfile. The results arn't bad considering the hardware Samba is
15159 running on. It's a crap machine!!!!</P
15161 >The updates mentioned in 1 and 2 brought up the transfer rates from
15162 just over 100kB/s in some clients.</P
15164 >A new client is a P333 connected via a 100MB/s card and hub. The
15165 transfer rates from this were good: 450-500kB/s on put and 600+kB/s
15168 >Looking at standard FTP throughput, Samba is a bit slower (100kB/s
15169 upwards). I suppose there is more going on in the samba protocol, but
15170 if it could get up to the rate of FTP the perfomance would be quite
15180 >22.17. My Results</H2
15182 >Some people want to see real numbers in a document like this, so here
15183 they are. I have a 486sx33 client running WfWg 3.11 with the 3.11b
15184 tcp/ip stack. It has a slow IDE drive and 20Mb of ram. It has a SMC
15185 Elite-16 ISA bus ethernet card. The only WfWg tuning I've done is to
15186 set DefaultRcvWindow in the [MSTCP] section of system.ini to 16384. My
15187 server is a 486dx3-66 running Linux. It also has 20Mb of ram and a SMC
15188 Elite-16 card. You can see my server config in the examples/tridge/
15189 subdirectory of the distribution.</P
15191 >I get 490k/s on reading a 8Mb file with copy.
15192 I get 441k/s writing the same file to the samba server.</P
15194 >Of course, there's a lot more to benchmarks than 2 raw throughput
15195 figures, but it gives you a ballpark figure.</P
15197 >I've also tested Win95 and WinNT, and found WinNT gave me the best
15198 speed as a samba client. The fastest client of all (for me) is
15199 smbclient running on another linux box. Maybe I'll add those results
15200 here someday ...</P
15213 >IV. Appendixes</H1
15219 >Table of Contents</B
15223 HREF="#PORTABILITY"
15246 >RedHat Linux Rembrandt-II</A
15252 HREF="#OTHER-CLIENTS"
15253 >Samba and other CIFS clients</A
15260 >Macintosh clients?</A
15272 >How can I configure OS/2 Warp Connect or
15273 OS/2 Warp 4 as a client for Samba?</A
15278 >How can I configure OS/2 Warp 3 (not Connect),
15279 OS/2 1.2, 1.3 or 2.x for Samba?</A
15284 >Are there any other issues when OS/2 (any version)
15285 is used as a client?</A
15290 >How do I get printer driver download working
15291 for OS/2 clients?</A
15298 >Windows for Workgroups</A
15305 >Use latest TCP/IP stack from Microsoft</A
15310 >Delete .pwl files after password change</A
15315 >Configure WfW password handling</A
15320 >Case handling of passwords</A
15327 >Windows '95/'98</A
15332 >Windows 2000 Service Pack 2</A
15361 >Internal errors</A
15366 >Attaching to a running process</A
15378 >Diagnosing your samba server</A
15459 >Still having troubles?</A
15472 >Chapter 23. Portability</H1
15474 >Samba works on a wide range of platforms but the interface all the
15475 platforms provide is not always compatible. This chapter contains
15476 platform-specific information about compiling and using samba.</P
15486 >HP's implementation of supplementary groups is, er, non-standard (for
15487 hysterical reasons). There are two group files, /etc/group and
15488 /etc/logingroup; the system maps UIDs to numbers using the former, but
15489 initgroups() reads the latter. Most system admins who know the ropes
15490 symlink /etc/group to /etc/logingroup (hard link doesn't work for reasons
15491 too stupid to go into here). initgroups() will complain if one of the
15492 groups you're in in /etc/logingroup has what it considers to be an invalid
15493 ID, which means outside the range [0..UID_MAX], where UID_MAX is (I think)
15494 60000 currently on HP-UX. This precludes -2 and 65534, the usual 'nobody'
15497 >If you encounter this problem, make sure that the programs that are failing
15498 to initgroups() be run as users not in any groups with GIDs outside the
15501 >This is documented in the HP manual pages under setgroups(2) and passwd(4).</P
15503 >On HPUX you must use gcc or the HP Ansi compiler. The free compiler
15504 that comes with HP-UX is not Ansi compliant and cannot compile
15514 >23.2. SCO Unix</H2
15517 If you run an old version of SCO Unix then you may need to get important
15518 TCP/IP patches for Samba to work correctly. Without the patch, you may
15519 encounter corrupt data transfers using samba.</P
15521 >The patch you need is UOD385 Connection Drivers SLS. It is available from
15522 SCO (ftp.sco.com, directory SLS, files uod385a.Z and uod385a.ltr.Z).</P
15533 >DNIX has a problem with seteuid() and setegid(). These routines are
15534 needed for Samba to work correctly, but they were left out of the DNIX
15535 C library for some reason.</P
15537 >For this reason Samba by default defines the macro NO_EID in the DNIX
15538 section of includes.h. This works around the problem in a limited way,
15539 but it is far from ideal, some things still won't work right.</P
15542 To fix the problem properly you need to assemble the following two
15543 functions and then either add them to your C library or link them into
15547 put this in the file <TT
15553 CLASS="PROGRAMLISTING"
15568 >put this in the file <TT
15574 CLASS="PROGRAMLISTING"
15589 >after creating the above files you then assemble them using</P
15601 >that should produce the files <TT
15610 >then you need to add these to the LIBSM line in the DNIX section of
15611 the Samba Makefile. Your LIBSM line will then look something like this:</P
15614 CLASS="PROGRAMLISTING"
15615 >LIBSM = setegid.o seteuid.o -ln</PRE
15619 You should then remove the line:</P
15622 CLASS="PROGRAMLISTING"
15623 >#define NO_EID</PRE
15626 >from the DNIX section of <TT
15638 >23.4. RedHat Linux Rembrandt-II</H2
15640 >By default RedHat Rembrandt-II during installation adds an
15641 entry to /etc/hosts as follows:
15643 CLASS="PROGRAMLISTING"
15644 > 127.0.0.1 loopback "hostname"."domainname"</PRE
15647 >This causes Samba to loop back onto the loopback interface.
15648 The result is that Samba fails to communicate correctly with
15649 the world and therefor may fail to correctly negotiate who
15650 is the master browse list holder and who is the master browser.</P
15652 >Corrective Action: Delete the entry after the word loopback
15653 in the line starting 127.0.0.1</P
15660 NAME="OTHER-CLIENTS"
15662 >Chapter 24. Samba and other CIFS clients</H1
15664 >This chapter contains client-specific information.</P
15672 >24.1. Macintosh clients?</H2
15675 HREF="http://www.thursby.com/"
15678 > now have a CIFS Client / Server called DAVE - see</P
15680 >They test it against Windows 95, Windows NT and samba for
15681 compatibility issues. At the time of writing, DAVE was at version
15682 1.0.1. The 1.0.0 to 1.0.1 update is available as a free download from
15683 the Thursby web site (the speed of finder copies has been greatly
15684 enhanced, and there are bug-fixes included).</P
15687 Alternatives - There are two free implementations of AppleTalk for
15688 several kinds of UNIX machnes, and several more commercial ones.
15689 These products allow you to run file services and print services
15690 natively to Macintosh users, with no additional support required on
15691 the Macintosh. The two free omplementations are
15693 HREF="http://www.umich.edu/~rsug/netatalk/"
15698 HREF="http://www.cs.mu.oz.au/appletalk/atalk.html"
15702 What Samba offers MS
15703 Windows users, these packages offer to Macs. For more info on these
15704 packages, Samba, and Linux (and other UNIX-based systems) see
15706 HREF="http://www.eats.com/linux_mac_win.html"
15708 >http://www.eats.com/linux_mac_win.html</A
15718 >24.2. OS2 Client</H2
15726 >24.2.1. How can I configure OS/2 Warp Connect or
15727 OS/2 Warp 4 as a client for Samba?</H3
15729 >A more complete answer to this question can be
15731 HREF="http://carol.wins.uva.nl/~leeuw/samba/warp.html"
15733 > http://carol.wins.uva.nl/~leeuw/samba/warp.html</A
15736 >Basically, you need three components:</P
15742 >The File and Print Client ('IBM Peer')
15747 >TCP/IP ('Internet support')
15752 >The "NetBIOS over TCP/IP" driver ('TCPBEUI')
15757 >Installing the first two together with the base operating
15758 system on a blank system is explained in the Warp manual. If Warp
15759 has already been installed, but you now want to install the
15760 networking support, use the "Selective Install for Networking"
15761 object in the "System Setup" folder.</P
15763 >Adding the "NetBIOS over TCP/IP" driver is not described
15764 in the manual and just barely in the online documentation. Start
15765 MPTS.EXE, click on OK, click on "Configure LAPS" and click
15766 on "IBM OS/2 NETBIOS OVER TCP/IP" in 'Protocols'. This line
15767 is then moved to 'Current Configuration'. Select that line,
15768 click on "Change number" and increase it from 0 to 1. Save this
15771 >If the Samba server(s) is not on your local subnet, you
15772 can optionally add IP names and addresses of these servers
15773 to the "Names List", or specify a WINS server ('NetBIOS
15774 Nameserver' in IBM and RFC terminology). For Warp Connect you
15775 may need to download an update for 'IBM Peer' to bring it on
15776 the same level as Warp 4. See the webpage mentioned above.</P
15785 >24.2.2. How can I configure OS/2 Warp 3 (not Connect),
15786 OS/2 1.2, 1.3 or 2.x for Samba?</H3
15788 >You can use the free Microsoft LAN Manager 2.2c Client
15791 HREF="ftp://ftp.microsoft.com/BusSys/Clients/LANMAN.OS2/"
15793 > ftp://ftp.microsoft.com/BusSys/Clients/LANMAN.OS2/</A
15796 HREF="http://carol.wins.uva.nl/~leeuw/lanman.html"
15798 > http://carol.wins.uva.nl/~leeuw/lanman.html</A
15800 more information on how to install and use this client. In
15801 a nutshell, edit the file \OS2VER in the root directory of
15802 the OS/2 boot partition and add the lines:</P
15805 CLASS="PROGRAMLISTING"
15812 >before you install the client. Also, don't use the
15813 included NE2000 driver because it is buggy. Try the NE2000
15814 or NS2000 driver from
15816 HREF="ftp://ftp.cdrom.com/pub/os2/network/ndis/"
15818 > ftp://ftp.cdrom.com/pub/os2/network/ndis/</A
15829 >24.2.3. Are there any other issues when OS/2 (any version)
15830 is used as a client?</H3
15832 >When you do a NET VIEW or use the "File and Print
15833 Client Resource Browser", no Samba servers show up. This can
15834 be fixed by a patch from <A
15835 HREF="http://carol.wins.uva.nl/~leeuw/samba/fix.html"
15837 > http://carol.wins.uva.nl/~leeuw/samba/fix.html</A
15839 The patch will be included in a later version of Samba. It also
15840 fixes a couple of other problems, such as preserving long
15841 filenames when objects are dragged from the Workplace Shell
15842 to the Samba server. </P
15851 >24.2.4. How do I get printer driver download working
15852 for OS/2 clients?</H3
15854 >First, create a share called [PRINTDRV] that is
15855 world-readable. Copy your OS/2 driver files there. Note
15856 that the .EA_ files must still be separate, so you will need
15857 to use the original install files, and not copy an installed
15858 driver from an OS/2 system.</P
15860 >Install the NT driver first for that printer. Then,
15861 add to your smb.conf a parameter, os2 driver map =
15863 CLASS="REPLACEABLE"
15867 >". Then, in the file
15869 CLASS="REPLACEABLE"
15874 name of the NT driver name to the OS/2 driver name as
15879 >nt driver name = os2 "driver
15880 name"."device name"</B
15882 HP LaserJet 5L = LASERJET.HP LaserJet 5L</P
15884 >You can have multiple drivers mapped in this file.</P
15886 >If you only specify the OS/2 driver name, and not the
15887 device name, the first attempt to download the driver will
15888 actually download the files, but the OS/2 client will tell
15889 you the driver is not available. On the second attempt, it
15890 will work. This is fixed simply by adding the device name
15891 to the mapping, after which it will work on the first attempt.
15902 >24.3. Windows for Workgroups</H2
15910 >24.3.1. Use latest TCP/IP stack from Microsoft</H3
15912 >Use the latest TCP/IP stack from microsoft if you use Windows
15915 >The early TCP/IP stacks had lots of bugs.</P
15918 Microsoft has released an incremental upgrade to their TCP/IP 32-Bit
15919 VxD drivers. The latest release can be found on their ftp site at
15920 ftp.microsoft.com, located in /peropsys/windows/public/tcpip/wfwt32.exe.
15921 There is an update.txt file there that describes the problems that were
15922 fixed. New files include WINSOCK.DLL, TELNET.EXE, WSOCK.386, VNBT.386,
15923 WSTCP.386, TRACERT.EXE, NETSTAT.EXE, and NBTSTAT.EXE.</P
15932 >24.3.2. Delete .pwl files after password change</H3
15934 >WfWg does a lousy job with passwords. I find that if I change my
15935 password on either the unix box or the PC the safest thing to do is to
15936 delete the .pwl files in the windows directory. The PC will complain about not finding the files, but will soon get over it, allowing you to enter the new password.</P
15939 If you don't do this you may find that WfWg remembers and uses the old
15940 password, even if you told it a new one.</P
15943 Often WfWg will totally ignore a password you give it in a dialog box.</P
15952 >24.3.3. Configure WfW password handling</H3
15954 >There is a program call admincfg.exe
15955 on the last disk (disk 8) of the WFW 3.11 disk set. To install it
15956 type EXPAND A:\ADMINCFG.EX_ C:\WINDOWS\ADMINCFG.EXE Then add an icon
15957 for it via the "Progam Manager" "New" Menu. This program allows you
15958 to control how WFW handles passwords. ie disable Password Caching etc
15961 >security = user</B
15971 >24.3.4. Case handling of passwords</H3
15973 >Windows for Workgroups uppercases the password before sending it to the server. Unix passwords can be case-sensitive though. Check the <A
15974 HREF="smb.conf.5.html"
15977 > information on <B
15980 > to specify what characters samba should try to uppercase when checking.</P
15990 >24.4. Windows '95/'98</H2
15992 >When using Windows 95 OEM SR2 the following updates are recommended where Samba
15993 is being used. Please NOTE that the above change will affect you once these
15994 updates have been installed.</P
15997 There are more updates than the ones mentioned here. You are referred to the
15998 Microsoft Web site for all currently available updates to your specific version
16006 >Kernel Update: KRNLUPD.EXE</P
16010 >Ping Fix: PINGUPD.EXE</P
16014 >RPC Update: RPCRTUPD.EXE</P
16018 >TCP/IP Update: VIPUPD.EXE</P
16022 >Redirector Update: VRDRUPD.EXE</P
16026 >Also, if using MS OutLook it is desirable to install the OLEUPD.EXE fix. This
16027 fix may stop your machine from hanging for an extended period when exiting
16028 OutLook and you may also notice a significant speedup when accessing network
16029 neighborhood services.</P
16038 >24.5. Windows 2000 Service Pack 2</H2
16041 There are several annoyances with Windows 2000 SP2. One of which
16042 only appears when using a Samba server to host user profiles
16043 to Windows 2000 SP2 clients in a Windows domain. This assumes
16044 that Samba is a member of the domain, but the problem will
16045 likely occur if it is not.</P
16048 In order to server profiles successfully to Windows 2000 SP2
16049 clients (when not operating as a PDC), Samba must have
16052 >nt acl support = no</B
16054 added to the file share which houses the roaming profiles.
16055 If this is not done, then the Windows 2000 SP2 client will
16056 complain about not being able to access the profile (Access
16057 Denied) and create multiple copies of it on disk (DOMAIN.user.001,
16058 DOMAIN.user.002, etc...). See the
16060 HREF="smb.conf.5.html"
16064 for more details on this option. Also note that the
16068 > parameter was formally a global parameter in
16069 releases prior to Samba 2.2.2.</P
16072 The following is a minimal profile share:</P
16075 CLASS="PROGRAMLISTING"
16077 path = /export/profile
16079 directory mask = 0700
16080 nt acl support = no
16081 read only = no</PRE
16084 >The reason for this bug is that the Win2k SP2 client copies
16085 the security descriptor for the profile which contains
16086 the Samba server's SID, and not the domain SID. The client
16087 compares the SID for SAMBA\user and realizes it is
16088 different that the one assigned to DOMAIN\user. Hence the reason
16089 for the "access denied" message.</P
16091 >By disabling the <B
16094 > parameter, Samba will send
16095 the Win2k client a response to the QuerySecurityDescriptor
16096 trans2 call which causes the client to set a default ACL
16097 for the profile. This default ACL includes </P
16101 >DOMAIN\user "Full Control"</B
16108 >NOTE : This bug does not occur when using winbind to
16109 create accounts on the Samba host for Domain users.</I
16120 >Chapter 25. Reporting Bugs</H1
16128 >25.1. Introduction</H2
16130 >The email address for bug reports for stable releases is <A
16131 HREF="samba@samba.org"
16133 >samba@samba.org</A
16135 Bug reports for alpha releases should go to <A
16136 HREF="mailto:samba-technical@samba.org"
16138 >samba-technical@samba.org</A
16141 >Please take the time to read this file before you submit a bug
16142 report. Also, please see if it has changed between releases, as we
16143 may be changing the bug reporting mechanism at some time.</P
16145 >Please also do as much as you can yourself to help track down the
16146 bug. Samba is maintained by a dedicated group of people who volunteer
16147 their time, skills and efforts. We receive far more mail about it than
16148 we can possibly answer, so you have a much higher chance of an answer
16149 and a fix if you send us a "developer friendly" bug report that lets
16150 us fix it fast. </P
16152 >Do not assume that if you post the bug to the comp.protocols.smb
16153 newsgroup or the mailing list that we will read it. If you suspect that your
16154 problem is not a bug but a configuration problem then it is better to send
16155 it to the Samba mailing list, as there are (at last count) 5000 other users on
16156 that list that may be able to help you.</P
16158 >You may also like to look though the recent mailing list archives,
16159 which are conveniently accessible on the Samba web pages
16161 HREF="http://samba.org/samba/"
16163 >http://samba.org/samba/</A
16173 >25.2. General info</H2
16175 >Before submitting a bug report check your config for silly
16176 errors. Look in your log files for obvious messages that tell you that
16177 you've misconfigured something and run testparm to test your config
16178 file for correct syntax.</P
16180 >Have you run through the <A
16181 HREF="Diagnosis.html"
16185 This is very important.</P
16187 >If you include part of a log file with your bug report then be sure to
16188 annotate it with exactly what you were doing on the client at the
16189 time, and exactly what the results were.</P
16198 >25.3. Debug levels</H2
16200 >If the bug has anything to do with Samba behaving incorrectly as a
16201 server (like refusing to open a file) then the log files will probably
16202 be very useful. Depending on the problem a log level of between 3 and
16203 10 showing the problem may be appropriate. A higher level givesmore
16204 detail, but may use too much disk space.</P
16206 >To set the debug level use <B
16213 >. You may also find it useful to set the log
16214 level higher for just one machine and keep separate logs for each machine.
16218 CLASS="PROGRAMLISTING"
16220 log file = /usr/local/samba/lib/log.%m
16221 include = /usr/local/samba/lib/smb.conf.%m</PRE
16224 >then create a file
16227 >/usr/local/samba/lib/smb.conf.machine</TT
16229 "machine" is the name of the client you wish to debug. In that file
16230 put any smb.conf commands you want, for example
16234 > may be useful. This also allows you to
16235 experiment with different security systems, protocol levels etc on just
16245 is synonymous with the entry <B
16249 used in older versions of Samba and is being retained for backwards
16250 compatibility of smb.conf files.</P
16255 > value is increased you will record
16256 a significantly increasing level of debugging information. For most
16257 debugging operations you may not need a setting higher than 3. Nearly
16258 all bugs can be tracked at a setting of 10, but be prepared for a VERY
16259 large volume of log data.</P
16268 >25.4. Internal errors</H2
16270 >If you get a "INTERNAL ERROR" message in your log files it means that
16271 Samba got an unexpected signal while running. It is probably a
16272 segmentation fault and almost certainly means a bug in Samba (unless
16273 you have faulty hardware or system software)</P
16275 >If the message came from smbd then it will probably be accompanied by
16276 a message which details the last SMB message received by smbd. This
16277 info is often very useful in tracking down the problem so please
16278 include it in your bug report.</P
16280 >You should also detail how to reproduce the problem, if
16281 possible. Please make this reasonably detailed.</P
16283 >You may also find that a core file appeared in a "corefiles"
16284 subdirectory of the directory where you keep your samba log
16285 files. This file is the most useful tool for tracking down the bug. To
16286 use it you do this:</P
16293 >adding appropriate paths to smbd and core so gdb can find them. If you
16294 don't have gdb then try "dbx". Then within the debugger use the
16295 command "where" to give a stack trace of where the problem
16296 occurred. Include this in your mail.</P
16298 >If you known any assembly language then do a "disass" of the routine
16299 where the problem occurred (if its in a library routine then
16300 disassemble the routine that called it) and try to work out exactly
16301 where the problem is by looking at the surrounding code. Even if you
16302 don't know assembly then incuding this info in the bug report can be
16312 >25.5. Attaching to a running process</H2
16314 >Unfortunately some unixes (in particular some recent linux kernels)
16315 refuse to dump a core file if the task has changed uid (which smbd
16316 does often). To debug with this sort of system you could try to attach
16317 to the running process using "gdb smbd PID" where you get PID from
16318 smbstatus. Then use "c" to continue and try to cause the core dump
16319 using the client. The debugger should catch the fault and tell you
16320 where it occurred.</P
16331 >The best sort of bug report is one that includes a fix! If you send us
16332 patches please use <B
16335 > format if your version of
16336 diff supports it, otherwise use <B
16340 your do the diff against a clean version of the source and let me know
16341 exactly what version you used. </P
16350 >Chapter 26. Diagnosing your samba server</H1
16358 >26.1. Introduction</H2
16360 >This file contains a list of tests you can perform to validate your
16361 Samba server. It also tells you what the likely cause of the problem
16362 is if it fails any one of these steps. If it passes all these tests
16363 then it is probably working fine.</P
16365 >You should do ALL the tests, in the order shown. We have tried to
16366 carefully choose them so later tests only use capabilities verified in
16367 the earlier tests.</P
16369 >If you send one of the samba mailing lists an email saying "it doesn't work"
16370 and you have not followed this test procedure then you should not be surprised
16371 your email is ignored.</P
16380 >26.2. Assumptions</H2
16382 >In all of the tests it is assumed you have a Samba server called
16383 BIGSERVER and a PC called ACLIENT both in workgroup TESTGROUP.</P
16385 >The procedure is similar for other types of clients.</P
16387 >It is also assumed you know the name of an available share in your
16388 smb.conf. I will assume this share is called "tmp". You can add a
16389 "tmp" share like by adding the following to smb.conf:</P
16392 CLASS="PROGRAMLISTING"
16394 comment = temporary files
16396 read only = yes </PRE
16399 >THESE TESTS ASSUME VERSION 3.0.0 OR LATER OF THE SAMBA SUITE. SOME
16400 COMMANDS SHOWN DID NOT EXIST IN EARLIER VERSIONS</P
16402 >Please pay attention to the error messages you receive. If any error message
16403 reports that your server is being unfriendly you should first check that you
16404 IP name resolution is correctly set up. eg: Make sure your /etc/resolv.conf
16405 file points to name servers that really do exist.</P
16407 >Also, if you do not have DNS server access for name resolution please check
16408 that the settings for your smb.conf file results in "dns proxy = no". The
16409 best way to check this is with "testparm smb.conf"</P
16426 >26.3.1. Test 1</H3
16428 >In the directory in which you store your smb.conf file, run the command
16429 "testparm smb.conf". If it reports any errors then your smb.conf
16430 configuration file is faulty.</P
16432 >Note: Your smb.conf file may be located in: <TT
16438 >/usr/local/samba/lib</TT
16448 >26.3.2. Test 2</H3
16450 >Run the command "ping BIGSERVER" from the PC and "ping ACLIENT" from
16451 the unix box. If you don't get a valid response then your TCP/IP
16452 software is not correctly installed. </P
16454 >Note that you will need to start a "dos prompt" window on the PC to
16457 >If you get a message saying "host not found" or similar then your DNS
16458 software or /etc/hosts file is not correctly setup. It is possible to
16459 run samba without DNS entries for the server and client, but I assume
16460 you do have correct entries for the remainder of these tests. </P
16462 >Another reason why ping might fail is if your host is running firewall
16463 software. You will need to relax the rules to let in the workstation
16464 in question, perhaps by allowing access from another subnet (on Linux
16465 this is done via the ipfwadm program.)</P
16474 >26.3.3. Test 3</H3
16476 >Run the command "smbclient -L BIGSERVER" on the unix box. You
16477 should get a list of available shares back. </P
16479 >If you get a error message containing the string "Bad password" then
16480 you probably have either an incorrect "hosts allow", "hosts deny" or
16481 "valid users" line in your smb.conf, or your guest account is not
16482 valid. Check what your guest account is using "testparm" and
16483 temporarily remove any "hosts allow", "hosts deny", "valid users" or
16484 "invalid users" lines.</P
16486 >If you get a "connection refused" response then the smbd server may
16487 not be running. If you installed it in inetd.conf then you probably edited
16488 that file incorrectly. If you installed it as a daemon then check that
16489 it is running, and check that the netbios-ssn port is in a LISTEN
16490 state using "netstat -a".</P
16492 >If you get a "session request failed" then the server refused the
16493 connection. If it says "Your server software is being unfriendly" then
16494 its probably because you have invalid command line parameters to smbd,
16495 or a similar fatal problem with the initial startup of smbd. Also
16496 check your config file (smb.conf) for syntax errors with "testparm"
16497 and that the various directories where samba keeps its log and lock
16500 >There are a number of reasons for which smbd may refuse or decline
16501 a session request. The most common of these involve one or more of
16502 the following smb.conf file entries:</P
16505 CLASS="PROGRAMLISTING"
16507 hosts allow = xxx.xxx.xxx.xxx/yy
16508 bind interfaces only = Yes</PRE
16511 >In the above, no allowance has been made for any session requests that
16512 will automatically translate to the loopback adaptor address 127.0.0.1.
16513 To solve this problem change these lines to:</P
16516 CLASS="PROGRAMLISTING"
16518 hosts allow = xxx.xxx.xxx.xxx/yy 127.</PRE
16521 >Do NOT use the "bind interfaces only" parameter where you may wish to
16522 use the samba password change facility, or where smbclient may need to
16523 access local service for name resolution or for local resource
16524 connections. (Note: the "bind interfaces only" parameter deficiency
16525 where it will not allow connections to the loopback address will be
16528 >Another common cause of these two errors is having something already running
16529 on port 139, such as Samba (ie: smbd is running from inetd already) or
16530 something like Digital's Pathworks. Check your inetd.conf file before trying
16531 to start smbd as a daemon, it can avoid a lot of frustration!</P
16533 >And yet another possible cause for failure of TEST 3 is when the subnet mask
16534 and / or broadcast address settings are incorrect. Please check that the
16535 network interface IP Address / Broadcast Address / Subnet Mask settings are
16536 correct and that Samba has correctly noted these in the log.nmb file.</P
16545 >26.3.4. Test 4</H3
16547 >Run the command "nmblookup -B BIGSERVER __SAMBA__". You should get the
16548 IP address of your Samba server back.</P
16550 >If you don't then nmbd is incorrectly installed. Check your inetd.conf
16551 if you run it from there, or that the daemon is running and listening
16552 to udp port 137.</P
16554 >One common problem is that many inetd implementations can't take many
16555 parameters on the command line. If this is the case then create a
16556 one-line script that contains the right parameters and run that from
16566 >26.3.5. Test 5</H3
16568 >run the command <B
16570 >nmblookup -B ACLIENT '*'</B
16573 >You should get the PCs IP address back. If you don't then the client
16574 software on the PC isn't installed correctly, or isn't started, or you
16575 got the name of the PC wrong. </P
16577 >If ACLIENT doesn't resolve via DNS then use the IP address of the
16578 client in the above test.</P
16587 >26.3.6. Test 6</H3
16589 >Run the command <B
16591 >nmblookup -d 2 '*'</B
16594 >This time we are trying the same as the previous test but are trying
16595 it via a broadcast to the default broadcast address. A number of
16596 Netbios/TCPIP hosts on the network should respond, although Samba may
16597 not catch all of the responses in the short time it listens. You
16598 should see "got a positive name query response" messages from several
16601 >If this doesn't give a similar result to the previous test then
16602 nmblookup isn't correctly getting your broadcast address through its
16603 automatic mechanism. In this case you should experiment use the
16604 "interfaces" option in smb.conf to manually configure your IP
16605 address, broadcast and netmask. </P
16607 >If your PC and server aren't on the same subnet then you will need to
16608 use the -B option to set the broadcast address to the that of the PCs
16611 >This test will probably fail if your subnet mask and broadcast address are
16612 not correct. (Refer to TEST 3 notes above).</P
16621 >26.3.7. Test 7</H3
16623 >Run the command <B
16625 >smbclient //BIGSERVER/TMP</B
16627 then be prompted for a password. You should use the password of the account
16628 you are logged into the unix box with. If you want to test with
16629 another account then add the -U >accountname< option to the end of
16630 the command line. eg:
16633 >smbclient //bigserver/tmp -Ujohndoe</B
16636 >Note: It is possible to specify the password along with the username
16640 >smbclient //bigserver/tmp -Ujohndoe%secret</B
16643 >Once you enter the password you should get the "smb>" prompt. If you
16644 don't then look at the error message. If it says "invalid network
16645 name" then the service "tmp" is not correctly setup in your smb.conf.</P
16647 >If it says "bad password" then the likely causes are:</P
16654 > you have shadow passords (or some other password system) but didn't
16655 compile in support for them in smbd
16660 > your "valid users" configuration is incorrect
16665 > you have a mixed case password and you haven't enabled the "password
16666 level" option at a high enough level
16671 > the "path =" line in smb.conf is incorrect. Check it with testparm
16676 > you enabled password encryption but didn't create the SMB encrypted
16682 >Once connected you should be able to use the commands
16695 >help >command<</B
16696 > for instructions. You should
16697 especially check that the amount of free disk space shown is correct
16710 >26.3.8. Test 8</H3
16712 >On the PC type the command <B
16714 >net view \\BIGSERVER</B
16716 need to do this from within a "dos prompt" window. You should get back a
16717 list of available shares on the server.</P
16719 >If you get a "network name not found" or similar error then netbios
16720 name resolution is not working. This is usually caused by a problem in
16721 nmbd. To overcome it you could do one of the following (you only need
16722 to choose one of them):</P
16729 > fixup the nmbd installation</P
16733 > add the IP address of BIGSERVER to the "wins server" box in the
16734 advanced tcp/ip setup on the PC.</P
16738 > enable windows name resolution via DNS in the advanced section of
16739 the tcp/ip setup</P
16743 > add BIGSERVER to your lmhosts file on the PC.</P
16747 >If you get a "invalid network name" or "bad password error" then the
16748 same fixes apply as they did for the "smbclient -L" test above. In
16749 particular, make sure your "hosts allow" line is correct (see the man
16752 >Also, do not overlook that fact that when the workstation requests the
16753 connection to the samba server it will attempt to connect using the
16754 name with which you logged onto your Windows machine. You need to make
16755 sure that an account exists on your Samba server with that exact same
16756 name and password.</P
16758 >If you get "specified computer is not receiving requests" or similar
16759 it probably means that the host is not contactable via tcp services.
16760 Check to see if the host is running tcp wrappers, and if so add an entry in
16761 the hosts.allow file for your client (or subnet, etc.)</P
16770 >26.3.9. Test 9</H3
16772 >Run the command <B
16774 >net use x: \\BIGSERVER\TMP</B
16776 be prompted for a password then you should get a "command completed
16777 successfully" message. If not then your PC software is incorrectly
16778 installed or your smb.conf is incorrect. make sure your "hosts allow"
16779 and other config lines in smb.conf are correct.</P
16781 >It's also possible that the server can't work out what user name to
16782 connect you as. To see if this is the problem add the line "user =
16783 USERNAME" to the [tmp] section of smb.conf where "USERNAME" is the
16784 username corresponding to the password you typed. If you find this
16785 fixes things you may need the username mapping option. </P
16787 >It might also be the case that your client only sends encrypted passwords
16790 >encrypt passwords = no</B
16795 Turn it back on to fix.</P
16804 >26.3.10. Test 10</H3
16806 >Run the command <B
16808 >nmblookup -M TESTGROUP</B
16810 TESTGROUP is the name of the workgroup that your Samba server and
16811 Windows PCs belong to. You should get back the IP address of the
16812 master browser for that workgroup.</P
16814 >If you don't then the election process has failed. Wait a minute to
16815 see if it is just being slow then try again. If it still fails after
16816 that then look at the browsing options you have set in smb.conf. Make
16819 >preferred master = yes</B
16821 an election is held at startup.</P
16830 >26.3.11. Test 11</H3
16832 >From file manager try to browse the server. Your samba server should
16833 appear in the browse list of your local workgroup (or the one you
16834 specified in smb.conf). You should be able to double click on the name
16835 of the server and get a list of shares. If you get a "invalid
16836 password" error when you do then you are probably running WinNT and it
16837 is refusing to browse a server that has no encrypted password
16838 capability and is in user level security mode. In this case either set
16841 >security = server</B
16845 >password server = Windows_NT_Machine</B
16847 smb.conf file, or enable encrypted passwords AFTER compiling in support
16848 for encrypted passwords (refer to the Makefile).</P
16858 >26.4. Still having troubles?</H2
16860 >Try the mailing list or newsgroup, or use the ethereal utility to
16861 sniff the problem. The official samba mailing list can be reached at
16863 HREF="mailto:samba@samba.org"
16865 >samba@samba.org</A
16867 out more about samba and how to subscribe to the mailing list check
16868 out the samba web page at
16870 HREF="http://samba.org/samba"
16872 >http://samba.org/samba</A
16875 >Also look at the other docs in the Samba package!</P