Last set of syntax fixes
[Samba/gebeck_regimport.git] / docs / docbook / projdoc / Diagnosis.xml
blob76984f30765450bd9a7a8463c0c5aaa71b043bd7
1 <chapter id="diagnosis">
2 <chapterinfo>
3         &author.tridge;
4         &author.jelmer;
5         <pubdate>Wed Jan 15</pubdate>
6 </chapterinfo>
8 <title>The Samba checklist</title>
10 <sect1>
11 <title>Introduction</title>
13 <para>
14 This file contains a list of tests you can perform to validate your
15 Samba server. It also tells you what the likely cause of the problem
16 is if it fails any one of these steps. If it passes all these tests
17 then it is probably working fine.
18 </para>
20 <para>
21 You should do ALL the tests, in the order shown. We have tried to
22 carefully choose them so later tests only use capabilities verified in
23 the earlier tests.  However, do not stop at the first error as there
24 have been some instances when continuing with the tests has helped
25 to solve a problem.
26 </para>
28 <para>
29 If you send one of the samba mailing lists  an email saying "it doesn't work"
30 and you have not followed this test procedure then you should not be surprised
31 if your email is ignored.
32 </para>
34 </sect1>
36 <sect1>
37 <title>Assumptions</title>
39 <para>
40 In all of the tests it is assumed you have a Samba server called 
41 BIGSERVER and a PC called ACLIENT both in workgroup TESTGROUP.
42 </para>
44 <para>
45 The procedure is similar for other types of clients.
46 </para>
48 <para>
49 It is also assumed you know the name of an available share in your
50 &smb.conf;. I will assume this share is called <replaceable>tmp</replaceable>.
51 You can add a <replaceable>tmp</replaceable> share like this by adding the
52 following to &smb.conf;:
53 </para>
55 <para><smbconfexample>
56                 <title>smb.conf with [tmp] share</title>
57 <smbconfsection>[tmp]</smbconfsection>
58 <smbconfoption><name>comment</name><value>temporary files </value></smbconfoption>
59 <smbconfoption><name>path</name><value>/tmp</value></smbconfoption>
60 <smbconfoption><name>read only</name><value>yes</value></smbconfoption>
61 </smbconfexample>
62 </para>
64 <note><para>
65 These tests assume version 3.0 or later of the samba suite.
66 Some commands shown did not exist in earlier versions. 
67 </para></note>
69 <para>
70 Please pay attention to the error messages you receive. If any error message
71 reports that your server is being unfriendly you should first check that your
72 IP name resolution is correctly set up. eg: Make sure your <filename>/etc/resolv.conf</filename>
73 file points to name servers that really do exist.
74 </para>
76 <para>
77 Also, if you do not have DNS server access for name resolution please check
78 that the settings for your &smb.conf; file results in <command>dns proxy = no</command>. The
79 best way to check this is with <userinput>testparm smb.conf</userinput>.
80 </para>
82 <indexterm><primary>log files</primary><secondary>monitoring</secondary></indexterm>
84 <para>
85 It is helpful to monitor the log files during testing by using the
86 <command>tail -F <replaceable>log_file_name</replaceable></command> in a separate
87 terminal console (use ctrl-alt-F1 through F6 or multiple terminals in X). 
88 Relevant log files can be found (for default installations) in
89 <filename>/usr/local/samba/var</filename>.  Also, connection logs from
90 machines can be found here or possibly in <filename>/var/log/samba</filename>
91 depending on how or if you specified logging in your &smb.conf; file.
92 </para>
94 <para>
95 If you make changes to your &smb.conf; file while going through these test,
96 don't forget to restart &smbd; and &nmbd;.
97 </para>
99 </sect1>
101 <sect1>
102 <title>The tests</title>
103 <procedure>
104 <title>Diagnosing your samba server</title>
106 <indexterm><primary>testparm</primary></indexterm>
108 <step performance="required">
109 <para>
110 In the directory in which you store your &smb.conf; file, run the command
111 <userinput>testparm smb.conf</userinput>. If it reports any errors then your &smb.conf;
112 configuration file is faulty.
113 </para>
115 <note><para>
116 Your &smb.conf; file may be located in: <filename>/etc/samba</filename>
117 Or in:   <filename>/usr/local/samba/lib</filename>
118 </para></note>
119 </step>
121 <step performance="required">
122 <para>
123 Run the command <userinput>ping BIGSERVER</userinput> from the PC and 
124 <userinput>ping ACLIENT</userinput> from
125 the unix box. If you don't get a valid response then your TCP/IP
126 software is not correctly installed. 
127 </para>
129 <para>
130 Note that you will need to start a "dos prompt" window on the PC to
131 run ping.
132 </para>
134 <para>
135 If you get a message saying <errorname>host not found</errorname> or similar then your DNS
136 software or <filename>/etc/hosts</filename> file is not correctly setup.
137 It is possible to
138 run samba without DNS entries for the server and client, but I assume
139 you do have correct entries for the remainder of these tests. 
140 </para>
142 <para>
143 Another reason why ping might fail is if your host is running firewall 
144 software. You will need to relax the rules to let in the workstation
145 in question, perhaps by allowing access from another subnet (on Linux
146 this is done via the <application>ipfwadm</application> program.)
147 </para>
149 <note>
150 <para>
151 Modern Linux distributions install ipchains/iptables by default. 
152 This is a common problem that is often overlooked.
153 </para>
154 </note>
155 </step>
157 <step performance="required">
158 <para>
159 Run the command <userinput>smbclient -L BIGSERVER</userinput> on the unix box. You
160 should get a list of available shares back. 
161 </para>
163 <para>
164 If you get a error message containing the string "Bad password" then
165 you probably have either an incorrect <command>hosts allow</command>, 
166 <command>hosts deny</command> or <command>valid users</command> line in your 
167 &smb.conf;, or your guest account is not
168 valid. Check what your guest account is using &testparm; and
169 temporarily remove any <command>hosts allow</command>, <command>hosts deny</command>, <command>valid users</command> or <command>invalid users</command> lines.
170 </para>
172 <para>
173 If you get a <errorname>connection refused</errorname> response then the smbd server may
174 not be running. If you installed it in inetd.conf then you probably edited
175 that file incorrectly. If you installed it as a daemon then check that
176 it is running, and check that the netbios-ssn port is in a LISTEN
177 state using <userinput>netstat -a</userinput>.
178 </para>
180 <note><para>
181 <indexterm><primary>inetd</primary></indexterm>
182 <indexterm><primary>xinetd</primary><see>inetd</see></indexterm>
183 Some Unix / Linux systems use <command>xinetd</command> in place of
184 <command>inetd</command>. Check your system documentation for the location
185 of the control file/s for your particular system implementation of
186 this network super daemon.
187 </para></note>
189 <para>
190 If you get a <errorname>session request failed</errorname> then the server refused the
191 connection. If it says "Your server software is being unfriendly" then
192 its probably because you have invalid command line parameters to &smbd;,
193 or a similar fatal problem with the initial startup of &smbd;. Also
194 check your config file (&smb.conf;) for syntax errors with &testparm;
195 and that the various directories where samba keeps its log and lock
196 files exist.
197 </para>
199 <para>
200 There are a number of reasons for which smbd may refuse or decline
201 a session request. The most common of these involve one or more of
202 the following &smb.conf; file entries:
203 </para>
205 <para><smbconfblock>
206 <smbconfoption><name>hosts deny</name><value>ALL</value></smbconfoption>
207 <smbconfoption><name>hosts allow</name><value>xxx.xxx.xxx.xxx/yy</value></smbconfoption>
208 <smbconfoption><name>bind interfaces only</name><value>Yes</value></smbconfoption>
209 </smbconfblock></para>
211 <para>
212 In the above, no allowance has been made for any session requests that
213 will automatically translate to the loopback adapter address 127.0.0.1.
214 To solve this problem change these lines to:
215 </para>
217 <para><smbconfblock>
218 <smbconfoption><name>hosts deny</name><value>ALL</value></smbconfoption>
219 <smbconfoption><name>hosts allow</name><value>xxx.xxx.xxx.xxx/yy 127.</value></smbconfoption>
220 </smbconfblock></para>
222 <para>
223 Do <emphasis>not</emphasis> use the <smbconfoption><name>bind interfaces only</name></smbconfoption> parameter where you 
224 may wish to
225 use the samba password change facility, or where &smbclient; may need to
226 access a local service for name resolution or for local resource
227 connections. (Note: the <smbconfoption><name>bind interfaces only</name></smbconfoption> parameter deficiency
228 where it will not allow connections to the loopback address will be
229 fixed soon).
230 </para>
232 <para>
233 <indexterm><primary>inetd</primary></indexterm>
234 Another common cause of these two errors is having something already running 
235 on port <constant>139</constant>, such as Samba 
236 (ie: &smbd; is running from <application>inetd</application> already) or
237 something like Digital's Pathworks. Check your <filename>inetd.conf</filename> file before trying
238 to start &smbd; as a daemon, it can avoid a lot of frustration!
239 </para>
241 <para>
242 And yet another possible cause for failure of this test is when the subnet mask
243 and / or broadcast address settings are incorrect. Please check that the
244 network interface IP Address / Broadcast Address / Subnet Mask settings are
245 correct and that Samba has correctly noted these in the <filename>log.nmbd</filename> file.
246 </para>
248 </step>
250 <step performance="required">
252 <para>
253 Run the command <userinput>nmblookup -B BIGSERVER __SAMBA__</userinput>. You should get the
254 IP address of your Samba server back.
255 </para>
257 <para>
258 If you don't then nmbd is incorrectly installed. Check your <filename>inetd.conf</filename>
259 if you run it from there, or that the daemon is running and listening
260 to udp port 137.
261 </para>
263 <para>
264 One common problem is that many inetd implementations can't take many
265 parameters on the command line. If this is the case then create a
266 one-line script that contains the right parameters and run that from
267 inetd.
268 </para>
270 </step>
272 <step performance="required">
274 <para>run the command <userinput>nmblookup -B ACLIENT '*'</userinput></para>
276 <para>
277 You should get the PCs IP address back. If you don't then the client
278 software on the PC isn't installed correctly, or isn't started, or you
279 got the name of the PC wrong. 
280 </para>
282 <para>
283 If ACLIENT doesn't resolve via DNS then use the IP address of the
284 client in the above test.
285 </para>
287 </step>
289 <step performance="required">
291 <para>
292 Run the command <userinput>nmblookup -d 2 '*'</userinput>
293 </para>
295 <para>
296 This time we are trying the same as the previous test but are trying
297 it via a broadcast to the default broadcast address. A number of
298 NetBIOS / TCP/IP hosts on the network should respond, although Samba may
299 not catch all of the responses in the short time it listens. You
300 should see <errorname>got a positive name query response</errorname>
301 messages from several hosts.
302 </para>
304 <para>
305 If this doesn't give a similar result to the previous test then
306 nmblookup isn't correctly getting your broadcast address through its
307 automatic mechanism. In this case you should experiment with the
308 <smbconfoption><name>interfaces</name></smbconfoption> option in &smb.conf; to manually configure your IP
309 address, broadcast and netmask. 
310 </para>
312 <para>
313 If your PC and server aren't on the same subnet then you will need to
314 use the <option>-B</option> option to set the broadcast address to that of the PCs
315 subnet.
316 </para>
318 <para>
319 This test will probably fail if your subnet mask and broadcast address are
320 not correct. (Refer to TEST 3 notes above).
321 </para>
323 </step>
325 <step performance="required">
327 <indexterm><primary>smbclient</primary></indexterm>
329 <para>
330 Run the command <userinput>smbclient //BIGSERVER/TMP</userinput>. You should 
331 then be prompted for a password. You should use the password of the account
332 you are logged into the unix box with. If you want to test with
333 another account then add the <option>-U <replaceable>accountname</replaceable></option> option to the end of
334 the command line.  eg: 
335 <userinput>smbclient //bigserver/tmp -Ujohndoe</userinput>
336 </para>
338 <note><para>
339 It is possible to specify the password along with the username
340 as follows:
341 <userinput>smbclient //bigserver/tmp -Ujohndoe%secret</userinput>
342 </para></note>
344 <para>
345 Once you enter the password you should get the <prompt>smb></prompt> prompt. If you
346 don't then look at the error message. If it says <errorname>invalid network
347 name</errorname> then the service <emphasis>"tmp"</emphasis> is not correctly setup in your &smb.conf;.
348 </para>
350 <para>
351 If it says <errorname>bad password</errorname> then the likely causes are:
352 </para>
354 <orderedlist>
355 <listitem>
356         <para>
357         you have shadow passwords (or some other password system) but didn't
358         compile in support for them in &smbd;
359         </para>
360 </listitem>
362 <listitem>
363         <para>
364         your <smbconfoption><name>valid users</name></smbconfoption> configuration is incorrect
365         </para>
366 </listitem>
368 <listitem>
369         <para>
370         you have a mixed case password and you haven't enabled the <smbconfoption><name>password level</name></smbconfoption> option at a high enough level
371         </para>
372 </listitem>
374 <listitem>
375         <para>
376         the <smbconfoption><name>path</name></smbconfoption> line in &smb.conf; is incorrect. Check it with &testparm;
377         </para>
378 </listitem>
380 <listitem>
381         <para>
382                 you enabled password encryption but didn't map unix to samba users. Run <screen><userinput>smbpasswd -a <replaceable>username</replaceable></userinput></screen>.
383         </para>
384 </listitem>
385 </orderedlist>
387 <para>
388 Once connected you should be able to use the commands 
389 <command>dir</command> <command>get</command> <command>put</command> etc. 
390 Type <command>help <replaceable>command</replaceable></command> for instructions. You should
391 especially check that the amount of free disk space shown is correct
392 when you type <command>dir</command>.
393 </para>
395 </step>
397 <step performance="required">
399 <para>
400 On the PC, type the command <userinput>net view \\BIGSERVER</userinput>. You will 
401 need to do this from within a "dos prompt" window. You should get back a 
402 list of available shares on the server.
403 </para>
405 <para>
406 If you get a <errorname>network name not found</errorname> or similar error then netbios
407 name resolution is not working. This is usually caused by a problem in
408 nmbd. To overcome it you could do one of the following (you only need
409 to choose one of them):
410 </para>
412 <orderedlist>
413 <listitem><para>
414         fixup the &nmbd; installation
415 </para></listitem>
417 <listitem><para>
418         add the IP address of BIGSERVER to the <command>wins server</command> box in the
419         advanced TCP/IP setup on the PC.
420 </para></listitem>
422 <listitem><para>
423         enable windows name resolution via DNS in the advanced section of
424         the TCP/IP setup
425 </para></listitem>
427 <listitem><para>
428         add BIGSERVER to your lmhosts file on the PC.
429 </para></listitem>
430 </orderedlist>
432 <para>
433 If you get a <errorname>invalid network name</errorname> or <errorname>bad password error</errorname> then the
434 same fixes apply as they did for the <userinput>smbclient -L</userinput> test above. In
435 particular, make sure your <command>hosts allow</command> line is correct (see the man
436 pages)
437 </para>
439 <para>
440 Also, do not overlook that fact that when the workstation requests the
441 connection to the samba server it will attempt to connect using the 
442 name with which you logged onto your Windows machine. You need to make
443 sure that an account exists on your Samba server with that exact same
444 name and password.
445 </para>
447 <para>
448 If you get <errorname>specified computer is not receiving requests</errorname> or similar
449 it probably means that the host is not contactable via tcp services.
450 Check to see if the host is running tcp wrappers, and if so add an entry in
451 the <filename>hosts.allow</filename> file for your client (or subnet, etc.)
452 </para>
454 </step>
456 <step performance="required">
458 <para>
459 Run the command <userinput>net use x: \\BIGSERVER\TMP</userinput>. You should 
460 be prompted for a password then you should get a <computeroutput>command completed 
461 successfully</computeroutput> message. If not then your PC software is incorrectly 
462 installed or your smb.conf is incorrect. make sure your <command>hosts allow</command>
463 and other config lines in &smb.conf; are correct.
464 </para>
466 <para>
467 It's also possible that the server can't work out what user name to
468 connect you as. To see if this is the problem add the line <smbconfoption><name>user</name><value>username</value></smbconfoption> to the <smbconfsection>[tmp]</smbconfsection> section of 
469 &smb.conf; where <replaceable>username</replaceable> is the
470 username corresponding to the password you typed. If you find this
471 fixes things you may need the username mapping option. 
472 </para>
474 <para>
475 It might also be the case that your client only sends encrypted passwords 
476 and you have <smbconfoption><name>encrypt passwords</name><value>no</value></smbconfoption> in &smb.conf;
477 Turn it back on to fix.
478 </para>
480 </step>
482 <step performance="required">
484 <para>
485 Run the command <userinput>nmblookup -M <replaceable>testgroup</replaceable></userinput> where 
486 <replaceable>testgroup</replaceable> is the name of the workgroup that your Samba server and 
487 Windows PCs belong to. You should get back the IP address of the 
488 master browser for that workgroup.
489 </para>
491 <para>
492 If you don't then the election process has failed. Wait a minute to
493 see if it is just being slow then try again. If it still fails after
494 that then look at the browsing options you have set in &smb.conf;. Make
495 sure you have <smbconfoption><name>preferred master</name><value>yes</value></smbconfoption> to ensure that 
496 an election is held at startup.
497 </para>
499 </step>
501 <step performance="required">
503 <para>
504 From file manager try to browse the server. Your samba server should
505 appear in the browse list of your local workgroup (or the one you
506 specified in &smb.conf;). You should be able to double click on the name
507 of the server and get a list of shares. If you get a "invalid
508 password" error when you do then you are probably running WinNT and it
509 is refusing to browse a server that has no encrypted password
510 capability and is in user level security mode. In this case either set
511 <smbconfoption><name>security</name><value>server</value></smbconfoption> AND 
512 <smbconfoption><name>password server</name><value>Windows_NT_Machine</value></smbconfoption> in your
513 &smb.conf; file, or make sure <smbconfoption><name>encrypt passwords</name></smbconfoption> is
514 set to "yes".
515 </para>
517 </step>
518 </procedure>
519 </sect1>
521 </chapter>