More updates.
[Samba.git] / docs / Samba-HOWTO-Collection / TOSHARG-Install.xml
blob60266274af39a3395d562116b506c99f14d9b402
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <chapter id="install">
4 <chapterinfo>
5         &author.tridge;
6         &author.jelmer;
7         &author.jht;
8         &author.kauer;
9         &author.danshearer;
10         <!-- Isn't some of this written by others as well? -->
12 </chapterinfo>
14 <title>How to Install and Test SAMBA</title>
16 <sect1>
17         <title>Obtaining and Installing Samba</title>
19         <para>
20         Binary packages of Samba are included in almost any Linux or
21         UNIX distribution. There are also some packages available at 
22         <ulink url="http://samba.org/">the Samba home-page</ulink>. Refer to 
23         the manual of your operating system for details on installing packages 
24         for your specific operating system.
25         </para>
27         <para>If you need to compile Samba from source, check 
28         <link linkend="compiling">How to compile Samba</link> chapter.</para>
30 </sect1>
32 <sect1>
33         <title>Configuring Samba (smb.conf)</title>
35         <para>
36         Samba's configuration is stored in the &smb.conf; file, which
37         usually resides in <filename>/etc/samba/smb.conf</filename> 
38         or <filename>/usr/local/samba/lib/smb.conf</filename>. You can either 
39         edit this file yourself or do it using one of the many graphical 
40         tools that are available, such as the Web-based interface SWAT, that 
41         is included with Samba.
42         </para>
44         <sect2>
45         <title>Configuration file syntax</title>
47         <para>The &smb.conf; file uses the same syntax as the various old 
48         .ini files in Windows 3.1: Each file consists of various sections, 
49         which are started by putting the section name between brackets ([]) 
50         on a new line. Each contains zero or more key/value-pairs separated by an 
51         equality sign (=). The file is just a plain-text file, so you can 
52         open and edit it with your favorite editing tool.</para>
54         <para>Each section in the &smb.conf; file represents a share 
55         on the Samba server. The section <quote>global</quote> is special, since it 
56         contains settings that apply to the whole Samba server and not 
57         to one share in particular.</para>
59 <para><link linkend="smbconfminimal">Following example</link> contains a very minimal &smb.conf;.
60         <indexterm><primary>minimal configuration</primary></indexterm>
61 </para>
63         <smbconfexample id="smbconfminimal">
64                 <title>A minimal smb.conf</title>
66                 <smbconfsection name="[global]"/>
67                 <smbconfoption name="workgroup">WKG</smbconfoption>
68                 <smbconfoption name="netbios name">MYNAME</smbconfoption>
69                 <smbconfsection name="[share1]"/>
70                 <smbconfoption name="path">/tmp</smbconfoption>
72                 <smbconfsection name="[share2]"/>
73                 <smbconfoption name="path">/my_shared_folder</smbconfoption>
74                 <smbconfoption name="comment">Some random files</smbconfoption>
75         </smbconfexample>
77 </sect2>
79 <sect2>
80         <title>Starting Samba</title>
82         <para>
83         Samba essentially consists of two or three daemons. A daemon is a UNIX application that runs in the background and provides services.
84         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
85         are three daemons, two of which are needed as a minimum.
86         </para>
88         <para>
89         The Samba server is made up of the following daemons:
90         </para>
92         <variablelist>
93                 <varlistentry><term>nmbd</term>
94                         <listitem><para>
95                         <indexterm><primary>smbd</primary></indexterm>
96                         <indexterm><primary>starting samba</primary><secondary>smbd</secondary></indexterm>
97                         This daemon handles all name registration and resolution requests. It is the primary vehicle involved
98                         in network browsing. It handles all UDP based protocols. The <command>nmbd</command> daemon should
99                         be the first command started as part of the Samba start-up process.
100                         </para></listitem>
101                 </varlistentry>
103                 <varlistentry><term>smbd</term>
104                         <listitem><para>
105                         <indexterm><primary>nmbd</primary></indexterm>
106                         <indexterm><primary>starting samba</primary><secondary>nmbd</secondary></indexterm>
107                         This daemon handles all TCP/IP based connection services for file and print based operations. It also
108                         manages local authentication. It should be started immediately following the start-up of <command>nmbd</command>.
109                         </para></listitem>
110                 </varlistentry>
112                 <varlistentry><term>winbindd</term>
113                         <listitem><para>
114                         <indexterm><primary>winbindd</primary></indexterm>
115                         <indexterm><primary>starting samba</primary><secondary>winbindd</secondary></indexterm>
116                         This daemon should be started when Samba is a member of a Windows NT4 or ADS Domain. It is also needed when
117                         Samba has trust relationships with another Domain. The <command>winbindd</command> daemon will check the
118                         &smb.conf; file for the presence of the <parameter>idmap uid</parameter> and <parameter>idmap gid</parameter>
119                         parameters. If they are not found <command>winbindd</command> will bail-out and refuse to start.
120                         </para></listitem>
121                 </varlistentry>
122         </variablelist>
124         <para>
125         When Samba has been packaged by an operating system vendor the start-up process is typically a custom feature of its
126         integration into the platform as a whole. Please refer to your operating system platform administration manuals for
127         specific information pertaining to correct management of Samba start-up.
128         </para>
130 </sect2>
131         
132 <sect2>
133         <title>Example Configuration</title>
134         
135         <para>
136         There are sample configuration files in the examples subdirectory in the
137         distribution. It is suggested you read them carefully so you can see how the options
138         go together in practice. See the man page for all the options. 
139         It might be worthwhile to start out with the smb.conf.default 
140         configuration file and adapt it to your needs. It contains plenty of 
141         comments.
142         </para>
144         <para>
145         The simplest useful configuration file would contain something like shown in
146         <link linkend="simple-example">the next example</link>.
147         </para>
149         <para>
150         <indexterm><primary>simple configuration</primary></indexterm>
151         <smbconfexample id="simple-example">
152                 <title>Another simple smb.conf File</title>
153 <smbconfsection name="[global]"/>
154 <smbconfoption name="workgroup">&example.workgroup;</smbconfoption>
156 <smbconfsection name="[homes]"/>
157 <smbconfoption name="guest ok">no</smbconfoption>
158 <smbconfoption name="read only">no</smbconfoption>
159         </smbconfexample>
160         </para>
161         
162         <para>
163         This will allow connections by anyone with an account on the server, using either
164         their login name or <smbconfsection name="homes"/> as the service name.
165         (Note: The workgroup that Samba should appear in must also be set. The default
166         workgroup name is WORKGROUP.)
167         </para>
168         
169         <para>
170         Make sure you put the &smb.conf; file in the correct place.
171         </para>
173         <para>
174         For more information about security settings for the 
175         <smbconfsection name="[homes]"/> share please refer to 
176         <link linkend="securing-samba">Securing Samba</link> chapter.
177         </para>
179 <sect3>
180         <title>Test Your Config File with <command>testparm</command></title>
182         <para>
183         It's important to validate the contents of the &smb.conf; file using the &testparm; program.
184         If testparm runs correctly, it will list the loaded services. If not, it will give an error message.
185         Make sure it runs correctly and that the services look reasonable before proceeding. Enter the command: 
186         </para>
188         <screen>
189         &rootprompt; testparm /etc/samba/smb.conf
190         </screen>
192         <para>Testparm will parse your configuration file and report 
193         any unknown parameters or incorrect syntax. </para>
195         
197         <para>
198         Always run testparm again whenever the &smb.conf; file is changed!
199         </para>
201 </sect3>
202 </sect2>
204 <sect2>
205         <title>SWAT</title>
207         <para>
208         <indexterm><primary>swat</primary></indexterm>
209         SWAT is a Web-based interface that can be used to facilitate the configuration of Samba. 
210         SWAT might not be available in the Samba package that shipped with your platform, 
211         but in a separate package. Please read the SWAT man page 
212         on compiling, installing and configuring SWAT from source.
213         </para>
215         <para>
216         To launch SWAT, just run your favorite Web browser and point it to
217         <ulink url="http://localhost:901/" noescape="1">http://localhost:901/</ulink>.
218         Replace <replaceable>localhost</replaceable> with the name of the computer on which
219         Samba is running if that is a different computer than your browser.
220         </para>
222         <para>
223         SWAT can be used from a browser on any IP-connected machine, but be aware that connecting from a remote
224         machine leaves your connection open to password sniffing as passwords will be sent over the wire in the clear. 
225         </para>
227         <para>More information about SWAT can be found in <link linkend="SWAT">corresponding chapter</link>.</para>
229 </sect2>
231 </sect1>
233 <sect1>
234         <title>List Shares Available on the Server</title>
236         <para>
237         To list shares that are available from the configured Samba server execute the
238         following command:
239         </para>
241 <para><screen>
242 &prompt;<userinput>smbclient -L <replaceable>yourhostname</replaceable></userinput>
243 </screen></para>
245         <para>You should see a list of shares available on your server. If you do not, then
246         something is incorrectly configured. This method can also be used to see what shares 
247         are available on other SMB servers, such as Windows 2000.</para>
249         <para>If you choose user-level security you may find that Samba requests a password
250         before it will list the shares. See the <command>smbclient</command> man page for details.
251         You can force it to list the shares without a password by adding the option
252         <option>-N</option> to the command line. </para>
253 </sect1>
255 <sect1>
256         <title>Connect with a UNIX Client</title>
257         
258         <para>
259         Enter the following command:
260 <screen>
261 &prompt;<userinput>smbclient <replaceable> //yourhostname/aservice</replaceable></userinput>
262 </screen></para>
263         
264         <para>Typically <replaceable>yourhostname</replaceable> is the name of the host on which &smbd;
265         has been installed. The <replaceable>aservice</replaceable> is any service that has been defined in the &smb.conf;
266         file. Try your user name if you just have a <smbconfsection name="[homes]"/> section in the &smb.conf; file.</para>
268         <para>Example: If the UNIX host is called <replaceable>bambi</replaceable> and a valid login name
269         is <replaceable>fred</replaceable>, you would type:</para>
271 <para><screen>
272 &prompt;<userinput>smbclient //<replaceable>bambi</replaceable>/<replaceable>fred</replaceable></userinput>
273 </screen></para>
274 </sect1>
276 <sect1>
277         <title>Connect from a Remote SMB Client</title>
279         <para>Now that Samba is working correctly locally, you can try to 
280         access it from other clients. Within a few minutes, the Samba host 
281         should be listed in the Network Neighborhood on all Windows 
282         clients of its subnet. Try browsing the server from another client
283         or 'mounting' it.</para>
285         <para>Mounting disks from a DOS, Windows or OS/2 client can be done by running a command such as:</para>
287         <para><screen>
288 &dosprompt;<userinput>net use d: \\servername\service</userinput>
289 </screen></para>
291         <para>Try printing, e.g.</para>
293         <para>
294 <screen>
295 &dosprompt;<userinput>net use lpt1:     \\servername\spoolservice</userinput>
296 </screen></para>
298 <para>
299 <screen>&dosprompt;<userinput>print filename</userinput>
300 </screen></para>
301 </sect1>
303 <sect1>
304         <title>What If Things Don't Work?</title>
305         
306         <para>You might want to read <link linkend="diagnosis">The Samba Checklist</link>.
307         If you are still stuck, refer to <link linkend="problems">Analyzing and Solving Samba Problems</link> chapter.
308         Samba has been successfully installed at thousands of sites worldwide.
309         It is unlikely that your particular problem is unique, so it might be
310         productive to perform an Internet search to see if someone else has encountered
311         your problem and has found a way to overcome it.</para>
313 </sect1>
315 <sect1>
316 <title>Common Errors</title>
318 <para>
319 The following questions and issues are raised repeatedly on the Samba mailing list.
320 </para>
322 <sect2>
323         <title>Large Number of smbd Processes</title>
325 <para>
326 Samba consists of three core programs: &nmbd;, &smbd;, and &winbindd;. &nmbd; is the name server message daemon,
327 &smbd; is the server message daemon, and &winbindd; is the daemon that handles communication with Domain Controllers.
328 </para>
330 <para>
331 If Samba is <emphasis>not</emphasis> running as a WINS server, then there will be one single instance of
332  &nmbd; running on your system. If it is running as a WINS server then there will be
333 two instances &smbmdash; one to handle the WINS requests.
334 </para>
336 <para>
337 &smbd; handles all connection requests. It spawns a new process for each client
338 connection made. That is why you may see so many of them, one per client connection.
339 </para>
341 <para>
342 &winbindd; will run as one or two daemons, depending on whether or not it is being
343 run in <emphasis>split mode</emphasis> (in which case there will be two instances).
344 </para>
346 </sect2>
348         <sect2>
349                 <title>Error Message: open_oplock_ipc</title>
351         <para>An error message is observed in the log files when &smbd; is started: <quote>open_oplock_ipc: Failed to get local UDP socket
352         for address 100007f. Error was Cannot assign requested.</quote></para>
354         <para>Your loopback device isn't working correctly. Make sure it is configured correctly. The loopback
355         device is an internal (virtual) network device with the IP address <emphasis>127.0.0.1</emphasis>.
356         Read your OS documentation for details on how to configure the loopback on your system.</para>
358         </sect2>
360         <sect2>
361                 <title><quote><errorname>The network name cannot be found</errorname></quote></title>
363                 <para>
364                 This error can be caused by one of these mis-configurations:
365                 </para>
367                 <itemizedlist>
368                         <listitem><para>You specified an non-existing path
369                         for the share in &smb.conf;.</para></listitem>
371                         <listitem><para>The user you are trying to access the share with does not 
372                         have sufficient permissions to access the path for
373                         the share. Both read (r) and access (x) should be possible.</para></listitem>
375                         <listitem><para>The share you are trying to access does not exist.</para></listitem>
376         </itemizedlist>
378         </sect2>
379 </sect1>
381 </chapter>