1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
5 <!-- entities files to use -->
6 <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
11 <chapter id="install">
18 <!-- Isn't some of this written by others as well? -->
22 <title>How to Install and Test SAMBA</title>
25 <title>Obtaining and Installing Samba</title>
28 Binary packages of Samba are included in almost any Linux or
29 UNIX distribution. There are also some packages available at
30 <ulink url="http://samba.org/">the Samba home-page</ulink>. Refer to
31 the manual of your operating system for details on installing packages
32 for your specific operating system.
35 <para>If you need to compile Samba from source, check
36 <link linkend="compiling">How to compile Samba</link> chapter.</para>
41 <title>Configuring Samba (smb.conf)</title>
44 Samba's configuration is stored in the &smb.conf; file, which
45 usually resides in <filename>/etc/samba/smb.conf</filename>
46 or <filename>/usr/local/samba/lib/smb.conf</filename>. You can either
47 edit this file yourself or do it using one of the many graphical
48 tools that are available, such as the Web-based interface SWAT, that
49 is included with Samba.
53 <title>Configuration file syntax</title>
55 <para>The &smb.conf; file uses the same syntax as the various old
56 .ini files in Windows 3.1: Each file consists of various sections,
57 which are started by putting the section name between brackets ([])
58 on a new line. Each contains zero or more key/value-pairs separated by an
59 equality sign (=). The file is just a plain-text file, so you can
60 open and edit it with your favorite editing tool.</para>
62 <para>Each section in the &smb.conf; file represents a share
63 on the Samba server. The section <quote>global</quote> is special, since it
64 contains settings that apply to the whole Samba server and not
65 to one share in particular.</para>
67 <para><link linkend="smbconfminimal">Following example</link> contains a very minimal &smb.conf;.
68 <indexterm><primary>minimal configuration</primary></indexterm>
71 <smbconfexample id="smbconfminimal">
72 <title>A minimal smb.conf</title>
74 <smbconfsection>[global]</smbconfsection>
75 <smbconfoption><name>workgroup</name><value>WKG</value></smbconfoption>
76 <smbconfoption><name>netbios name</name><value>MYNAME</value></smbconfoption>
77 <smbconfsection>[share1]</smbconfsection>
78 <smbconfoption><name>path</name><value>/tmp</value></smbconfoption>
80 <smbconfsection>[share2]</smbconfsection>
81 <smbconfoption><name>path</name><value>/my_shared_folder</value></smbconfoption>
82 <smbconfoption><name>comment</name><value>Some random files</value></smbconfoption>
88 <title>Starting Samba</title>
91 Samba essentially consists of two or three daemons. A daemon is a UNIX application that runs in the background and provides services.
92 An example of a service is the Apache Web server for which the daemon is called <command>httpd</command>. In the case of Samba there
93 are three daemons, two of which are needed as a minimum.
97 The Samba server is made up of the following daemons:
101 <varlistentry><term>nmbd</term>
103 <indexterm><primary>smbd</primary></indexterm>
104 <indexterm><primary>starting samba</primary><secondary>smbd</secondary></indexterm>
105 This daemon handles all name registration and resolution requests. It is the primary vehicle involved
106 in network browsing. It handles all UDP based protocols. The <command>nmbd</command> daemon should
107 be the first command started as part of the Samba start-up process.
111 <varlistentry><term>smbd</term>
113 <indexterm><primary>nmbd</primary></indexterm>
114 <indexterm><primary>starting samba</primary><secondary>nmbd</secondary></indexterm>
115 This daemon handles all TCP/IP based connection services for file and print based operations. It also
116 manages local authentication. It should be started immediately following the start-up of <command>nmbd</command>.
120 <varlistentry><term>winbindd</term>
122 <indexterm><primary>winbindd</primary></indexterm>
123 <indexterm><primary>starting samba</primary><secondary>winbindd</secondary></indexterm>
124 This daemon should be started when Samba is a member of a Windows NT4 or ADS Domain. IT is also needed when
125 Samba has trust relationships with another Domain. The <command>winbindd</command> daemon will check the
126 &smb.conf; file for the presence of the <parameter>idmap uid</parameter> and <parameter>idmap gid</parameter>
127 parameters. If they are not found <command>winbindd</command> will bail-out and refuse to start.
133 When Samba has been packages by an operating system vendor the start-up process is typically a custom feature of its
134 integration into the platform as a whole. Please refer to your operating system platform administration manuals for
135 specific information pertaining to correct management of Samba start-up.
141 <title>Example Configuration</title>
144 There are sample configuration files in the examples subdirectory in the
145 distribution. It is suggested you read them carefully so you can see how the options
146 go together in practice. See the man page for all the options.
147 It might be worthwhile to start out with the smb.conf.default
148 configuration file and adapt it to your needs. It contains plenty of
153 The simplest useful configuration file would contain something like shown in
154 <link linkend="simple-example">the next example</link>.
158 <indexterm><primary>simple configuration</primary></indexterm>
159 <smbconfexample id="simple-example">
160 <title>Another simple smb.conf File</title>
161 <smbconfsection>[global]</smbconfsection>
162 <smbconfoption><name>workgroup</name><value>&example.workgroup;</value></smbconfoption>
164 <smbconfsection>[homes]</smbconfsection>
165 <smbconfoption><name>guest ok</name><value>no</value></smbconfoption>
166 <smbconfoption><name>read only</name><value>no</value></smbconfoption>
171 This will allow connections by anyone with an account on the server, using either
172 their login name or <smbconfsection>homes</smbconfsection> as the service name.
173 (Note: The workgroup that Samba should appear in must also be set. The default
174 workgroup name is WORKGROUP.)
178 Make sure you put the &smb.conf; file in the correct place.
182 For more information about security settings for the
183 <smbconfsection>[homes]</smbconfsection> share please refer to
184 <link linkend="securing-samba">Securing Samba</link> chapter.
188 <title>Test Your Config File with <command>testparm</command></title>
191 It's important to validate the contents of the &smb.conf; file using the &testparm; program.
192 If testparm runs correctly, it will list the loaded services. If not, it will give an error message.
193 Make sure it runs correctly and that the services look reasonable before proceeding. Enter the command:
197 &rootprompt; testparm /etc/samba/smb.conf
200 <para>Testparm will parse your configuration file and report
201 any unknown parameters or incorrect syntax. </para>
206 Always run testparm again whenever the &smb.conf; file is changed!
216 <indexterm><primary>swat</primary></indexterm>
217 SWAT is a Web-based interface that can be used to facilitate the configuration of Samba.
218 SWAT might not be available in the Samba package that shipped with your platform,
219 but in a separate package. Please read the SWAT man page
220 on compiling, installing and configuring SWAT from source.
224 To launch SWAT, just run your favorite Web browser and point it to
225 <ulink url="http://localhost:901/" noescape="1">http://localhost:901/</ulink>.
226 Replace <replaceable>localhost</replaceable> with the name of the computer on which
227 Samba is running if that is a different computer than your browser.
231 SWAT can be used from a browser on any IP-connected machine, but be aware that connecting from a remote
232 machine leaves your connection open to password sniffing as passwords will be sent over the wire in the clear.
235 <para>More information about SWAT can be found in <link linkend="SWAT">corresponding chapter</link>.</para>
242 <title>List Shares Available on the Server</title>
245 To list shares that are available from the configured Samba server execute the
250 &prompt;<userinput>smbclient -L <replaceable>yourhostname</replaceable></userinput>
253 <para>You should see a list of shares available on your server. If you do not, then
254 something is incorrectly configured. This method can also be used to see what shares
255 are available on other SMB servers, such as Windows 2000.</para>
257 <para>If you choose user-level security you may find that Samba requests a password
258 before it will list the shares. See the <command>smbclient</command> man page for details.
259 You can force it to list the shares without a password by adding the option
260 <option>-N</option> to the command line. </para>
264 <title>Connect with a UNIX Client</title>
267 Enter the following command:
269 &prompt;<userinput>smbclient <replaceable> //yourhostname/aservice</replaceable></userinput>
272 <para>Typically <replaceable>yourhostname</replaceable> is the name of the host on which &smbd;
273 has been installed. The <replaceable>aservice</replaceable> is any service that has been defined in the &smb.conf;
274 file. Try your user name if you just have a <smbconfsection>[homes]</smbconfsection> section in the &smb.conf; file.</para>
276 <para>Example: If the UNIX host is called <replaceable>bambi</replaceable> and a valid login name
277 is <replaceable>fred</replaceable>, you would type:</para>
280 &prompt;<userinput>smbclient //<replaceable>bambi</replaceable>/<replaceable>fred</replaceable></userinput>
285 <title>Connect from a Remote SMB Client</title>
287 <para>Now that Samba is working correctly locally, you can try to
288 access it from other clients. Within a few minutes, the Samba host
289 should be listed in the Network Neighborhood on all Windows
290 clients of its subnet. Try browsing the server from another client
291 or 'mounting' it.</para>
293 <para>Mounting disks from a DOS, Windows or OS/2 client can be done by running a command such as:</para>
296 &dosprompt;<userinput>net use d: \\servername\service</userinput>
299 <para>Try printing, e.g.</para>
303 &dosprompt;<userinput>net use lpt1: \\servername\spoolservice</userinput>
307 <screen>&dosprompt;<userinput>print filename</userinput>
312 <title>What If Things Don't Work?</title>
314 <para>You might want to read <link linkend="diagnosis">The Samba Checklist</link>.
315 If you are still stuck, refer to <link linkend="problems">Analyzing and Solving Samba Problems</link> chapter.
316 Samba has been successfully installed at thousands of sites worldwide.
317 It is unlikely that your particular problem is unique, so it might be
318 productive to perform an Internet search to see if someone else has encountered
319 your problem and has found a way to overcome it.</para>
324 <title>Common Errors</title>
327 The following questions and issues are raised repeatedly on the Samba mailing list.
331 <title>Large Number of smbd Processes</title>
334 Samba consists of three core programs: &nmbd;, &smbd;, and &winbindd;. &nmbd; is the name server message daemon,
335 &smbd; is the server message daemon, and &winbindd; is the daemon that handles communication with Domain Controllers.
339 If Samba is <emphasis>not</emphasis> running as a WINS server, then there will be one single instance of
340 &nmbd; running on your system. If it is running as a WINS server then there will be
341 two instances &smbmdash; one to handle the WINS requests.
345 &smbd; handles all connection requests. It spawns a new process for each client
346 connection made. That is why you may see so many of them, one per client connection.
350 &winbindd; will run as one or two daemons, depending on whether or not it is being
351 run in <emphasis>split mode</emphasis> (in which case there will be two instances).
357 <title>Error Message: open_oplock_ipc</title>
359 <para>An error message is observed in the log files when &smbd; is started: <quote>open_oplock_ipc: Failed to get local UDP socket
360 for address 100007f. Error was Cannot assign requested.</quote></para>
362 <para>Your loopback device isn't working correctly. Make sure it is configured correctly. The loopback
363 device is an internal (virtual) network device with the IP address <emphasis>127.0.0.1</emphasis>.
364 Read your OS documentation for details on how to configure the loopback on your system.</para>
369 <title><quote><errorname>The network name cannot be found</errorname></quote></title>
372 This error can be caused by one of these mis-configurations:
376 <listitem><para>You specified an non-existing path
377 for the share in &smb.conf;.</para></listitem>
379 <listitem><para>The user you are trying to access the share with does not
380 have sufficient permissions to access the path for
381 the share. Both read (r) and access (x) should be possible.</para></listitem>
383 <listitem><para>The share you are trying to access does not exist.</para></listitem>