* merge fixes for SGML syntax errors (does no one ever regenerate the docs?)
[gd/samba-autobuild/.git] / docs / docbook / projdoc / Diagnosis.sgml
1 <chapter id="diagnosis">
2 <chapterinfo>
3         <author>
4                 <firstname>Andrew</firstname><surname>Tridgell</surname>
5                 <affiliation>
6                         <orgname>Samba Team</orgname>
7                         <address><email>tridge@samba.org</email></address>
8                 </affiliation>
9         </author>
10         <author>
11                 <firstname>Jelmer</firstname><surname>Vernooij</surname>
12                 <affiliation>
13                         <orgname>Samba Team</orgname>
14                         <address><email>jelmer@samba.org</email></address>
15                 </affiliation>
16         </author>
17         <pubdate>Wed Jan 15</pubdate>
18 </chapterinfo>
19
20 <title>Diagnosing your samba server</title>
21
22 <sect1>
23 <title>Introduction</title>
24
25 <para>
26 This file contains a list of tests you can perform to validate your
27 Samba server. It also tells you what the likely cause of the problem
28 is if it fails any one of these steps. If it passes all these tests
29 then it is probably working fine.
30 </para>
31
32 <para>
33 You should do ALL the tests, in the order shown. We have tried to
34 carefully choose them so later tests only use capabilities verified in
35 the earlier tests.
36 </para>
37
38 <para>
39 If you send one of the samba mailing lists  an email saying "it doesn't work"
40 and you have not followed this test procedure then you should not be surprised
41 your email is ignored.
42 </para>
43
44 </sect1>
45
46 <sect1>
47 <title>Assumptions</title>
48
49 <para>
50 In all of the tests it is assumed you have a Samba server called 
51 BIGSERVER and a PC called ACLIENT both in workgroup TESTGROUP.
52 </para>
53
54 <para>
55 The procedure is similar for other types of clients.
56 </para>
57
58 <para>
59 It is also assumed you know the name of an available share in your
60 smb.conf. I will assume this share is called "tmp". You can add a
61 "tmp" share like by adding the following to smb.conf:
62 </para>
63
64 <para><programlisting>
65
66 [tmp]
67  comment = temporary files 
68  path = /tmp
69  read only = yes
70
71 </programlisting>
72 </para>
73
74 <para>
75 THESE TESTS ASSUME VERSION 3.0.0 OR LATER OF THE SAMBA SUITE. SOME
76 COMMANDS SHOWN DID NOT EXIST IN EARLIER VERSIONS
77 </para>
78
79 <para>
80 Please pay attention to the error messages you receive. If any error message
81 reports that your server is being unfriendly you should first check that you
82 IP name resolution is correctly set up. eg: Make sure your /etc/resolv.conf
83 file points to name servers that really do exist.
84 </para>
85
86 <para>
87 Also, if you do not have DNS server access for name resolution please check
88 that the settings for your smb.conf file results in "dns proxy = no". The
89 best way to check this is with "testparm smb.conf"
90 </para>
91
92 </sect1>
93
94 <sect1>
95 <title>Tests</title>
96
97 <sect2>
98 <title>Test 1</title>
99 <para>
100 In the directory in which you store your smb.conf file, run the command
101 "testparm smb.conf". If it reports any errors then your smb.conf
102 configuration file is faulty.
103 </para>
104
105 <para>
106 Note:   Your smb.conf file may be located in: <filename>/etc/samba</filename>
107         Or in:   <filename>/usr/local/samba/lib</filename>
108 </para>
109 </sect2>
110
111 <sect2>
112 <title>Test 2</title>
113
114 <para>
115 Run the command "ping BIGSERVER" from the PC and "ping ACLIENT" from
116 the unix box. If you don't get a valid response then your TCP/IP
117 software is not correctly installed. 
118 </para>
119
120 <para>
121 Note that you will need to start a "dos prompt" window on the PC to
122 run ping.
123 </para>
124
125 <para>
126 If you get a message saying "host not found" or similar then your DNS
127 software or /etc/hosts file is not correctly setup. It is possible to
128 run samba without DNS entries for the server and client, but I assume
129 you do have correct entries for the remainder of these tests. 
130 </para>
131
132 <para>
133 Another reason why ping might fail is if your host is running firewall 
134 software. You will need to relax the rules to let in the workstation
135 in question, perhaps by allowing access from another subnet (on Linux
136 this is done via the ipfwadm program.)
137 </para>
138 </sect2>
139
140 <sect2>
141 <title>Test 3</title>
142
143 <para>
144 Run the command "smbclient -L BIGSERVER" on the unix box. You
145 should get a list of available shares back. 
146 </para>
147
148 <para>
149 If you get a error message containing the string "Bad password" then
150 you probably have either an incorrect "hosts allow", "hosts deny" or
151 "valid users" line in your smb.conf, or your guest account is not
152 valid. Check what your guest account is using "testparm" and
153 temporarily remove any "hosts allow", "hosts deny", "valid users" or
154 "invalid users" lines.
155 </para>
156
157 <para>
158 If you get a "connection refused" response then the smbd server may
159 not be running. If you installed it in inetd.conf then you probably edited
160 that file incorrectly. If you installed it as a daemon then check that
161 it is running, and check that the netbios-ssn port is in a LISTEN
162 state using "netstat -a".
163 </para>
164
165 <para>
166 If you get a "session request failed" then the server refused the
167 connection. If it says "Your server software is being unfriendly" then
168 its probably because you have invalid command line parameters to smbd,
169 or a similar fatal problem with the initial startup of smbd. Also
170 check your config file (smb.conf) for syntax errors with "testparm"
171 and that the various directories where samba keeps its log and lock
172 files exist.
173 </para>
174
175 <para>
176 There are a number of reasons for which smbd may refuse or decline
177 a session request. The most common of these involve one or more of
178 the following smb.conf file entries:
179 </para>
180
181 <para><programlisting>
182         hosts deny = ALL
183         hosts allow = xxx.xxx.xxx.xxx/yy
184         bind interfaces only = Yes
185 </programlisting></para>
186
187 <para>
188 In the above, no allowance has been made for any session requests that
189 will automatically translate to the loopback adaptor address 127.0.0.1.
190 To solve this problem change these lines to:
191 </para>
192
193 <para><programlisting>
194         hosts deny = ALL
195         hosts allow = xxx.xxx.xxx.xxx/yy 127.
196 </programlisting></para>
197
198 <para>
199 Do NOT use the "bind interfaces only" parameter where you may wish to
200 use the samba password change facility, or where smbclient may need to
201 access local service for name resolution or for local resource
202 connections. (Note: the "bind interfaces only" parameter deficiency
203 where it will not allow connections to the loopback address will be
204 fixed soon).
205 </para>
206
207 <para>
208 Another common cause of these two errors is having something already running 
209 on port 139, such as Samba (ie: smbd is running from inetd already) or
210 something like Digital's Pathworks. Check your inetd.conf file before trying
211 to start smbd as a daemon, it can avoid a lot of frustration!
212 </para>
213
214 <para>
215 And yet another possible cause for failure of TEST 3 is when the subnet mask
216 and / or broadcast address settings are incorrect. Please check that the
217 network interface IP Address / Broadcast Address / Subnet Mask settings are
218 correct and that Samba has correctly noted these in the log.nmb file.
219 </para>
220
221 </sect2>
222
223 <sect2>
224 <title>Test 4</title>
225
226 <para>
227 Run the command "nmblookup -B BIGSERVER __SAMBA__". You should get the
228 IP address of your Samba server back.
229 </para>
230
231 <para>
232 If you don't then nmbd is incorrectly installed. Check your inetd.conf
233 if you run it from there, or that the daemon is running and listening
234 to udp port 137.
235 </para>
236
237 <para>
238 One common problem is that many inetd implementations can't take many
239 parameters on the command line. If this is the case then create a
240 one-line script that contains the right parameters and run that from
241 inetd.
242 </para>
243
244 </sect2>
245
246 <sect2>
247 <title>Test 5</title>
248
249 <para>run the command <command>nmblookup -B ACLIENT '*'</command></para>
250
251 <para>
252 You should get the PCs IP address back. If you don't then the client
253 software on the PC isn't installed correctly, or isn't started, or you
254 got the name of the PC wrong. 
255 </para>
256
257 <para>
258 If ACLIENT doesn't resolve via DNS then use the IP address of the
259 client in the above test.
260 </para>
261
262 </sect2>
263
264 <sect2>
265 <title>Test 6</title>
266
267 <para>
268 Run the command <command>nmblookup -d 2 '*'</command>
269 </para>
270
271 <para>
272 This time we are trying the same as the previous test but are trying
273 it via a broadcast to the default broadcast address. A number of
274 Netbios/TCPIP hosts on the network should respond, although Samba may
275 not catch all of the responses in the short time it listens. You
276 should see "got a positive name query response" messages from several
277 hosts.
278 </para>
279
280 <para>
281 If this doesn't give a similar result to the previous test then
282 nmblookup isn't correctly getting your broadcast address through its
283 automatic mechanism. In this case you should experiment use the
284 "interfaces" option in smb.conf to manually configure your IP
285 address, broadcast and netmask. 
286 </para>
287
288 <para>
289 If your PC and server aren't on the same subnet then you will need to
290 use the -B option to set the broadcast address to the that of the PCs
291 subnet.
292 </para>
293
294 <para>
295 This test will probably fail if your subnet mask and broadcast address are
296 not correct. (Refer to TEST 3 notes above).
297 </para>
298
299 </sect2>
300
301 <sect2>
302 <title>Test 7</title>
303
304 <para>
305 Run the command <command>smbclient //BIGSERVER/TMP</command>. You should 
306 then be prompted for a password. You should use the password of the account
307 you are logged into the unix box with. If you want to test with
308 another account then add the -U &gt;accountname&lt; option to the end of
309 the command line.  eg: 
310 <command>smbclient //bigserver/tmp -Ujohndoe</command>
311 </para>
312
313 <para>
314 Note: It is possible to specify the password along with the username
315 as follows:
316 <command>smbclient //bigserver/tmp -Ujohndoe%secret</command>
317 </para>
318
319 <para>
320 Once you enter the password you should get the "smb>" prompt. If you
321 don't then look at the error message. If it says "invalid network
322 name" then the service "tmp" is not correctly setup in your smb.conf.
323 </para>
324
325 <para>
326 If it says "bad password" then the likely causes are:
327 </para>
328
329 <orderedlist>
330 <listitem>
331         <para>
332         you have shadow passords (or some other password system) but didn't
333         compile in support for them in smbd
334         </para>
335 </listitem>
336
337 <listitem>
338         <para>
339         your "valid users" configuration is incorrect
340         </para>
341 </listitem>
342
343 <listitem>
344         <para>
345         you have a mixed case password and you haven't enabled the "password
346         level" option at a high enough level
347         </para>
348 </listitem>
349
350 <listitem>
351         <para>
352         the "path =" line in smb.conf is incorrect. Check it with testparm
353         </para>
354 </listitem>
355
356 <listitem>
357         <para>
358         you enabled password encryption but didn't create the SMB encrypted
359         password file
360         </para>
361 </listitem>
362 </orderedlist>
363
364 <para>
365 Once connected you should be able to use the commands 
366 <command>dir</command> <command>get</command> <command>put</command> etc. 
367 Type <command>help &gt;command&lt;</command> for instructions. You should
368 especially check that the amount of free disk space shown is correct
369 when you type <command>dir</command>.
370 </para>
371
372 </sect2>
373
374 <sect2>
375 <title>Test 8</title>
376
377 <para>
378 On the PC type the command <command>net view \\BIGSERVER</command>. You will 
379 need to do this from within a "dos prompt" window. You should get back a 
380 list of available shares on the server.
381 </para>
382
383 <para>
384 If you get a "network name not found" or similar error then netbios
385 name resolution is not working. This is usually caused by a problem in
386 nmbd. To overcome it you could do one of the following (you only need
387 to choose one of them):
388 </para>
389
390 <orderedlist>
391 <listitem><para>
392         fixup the nmbd installation
393 </para></listitem>
394
395 <listitem><para>
396         add the IP address of BIGSERVER to the "wins server" box in the
397         advanced tcp/ip setup on the PC.
398 </para></listitem>
399
400 <listitem><para>
401         enable windows name resolution via DNS in the advanced section of
402         the tcp/ip setup
403 </para></listitem>
404
405 <listitem><para>
406         add BIGSERVER to your lmhosts file on the PC.
407 </para></listitem>
408 </orderedlist>
409
410 <para>
411 If you get a "invalid network name" or "bad password error" then the
412 same fixes apply as they did for the "smbclient -L" test above. In
413 particular, make sure your "hosts allow" line is correct (see the man
414 pages)
415 </para>
416
417 <para>
418 Also, do not overlook that fact that when the workstation requests the
419 connection to the samba server it will attempt to connect using the 
420 name with which you logged onto your Windows machine. You need to make
421 sure that an account exists on your Samba server with that exact same
422 name and password.
423 </para>
424
425 <para>
426 If you get "specified computer is not receiving requests" or similar
427 it probably means that the host is not contactable via tcp services.
428 Check to see if the host is running tcp wrappers, and if so add an entry in
429 the hosts.allow file for your client (or subnet, etc.)
430 </para>
431
432 </sect2>
433
434 <sect2>
435 <title>Test 9</title>
436
437 <para>
438 Run the command <command>net use x: \\BIGSERVER\TMP</command>. You should 
439 be prompted for a password then you should get a "command completed 
440 successfully" message. If not then your PC software is incorrectly 
441 installed or your smb.conf is incorrect. make sure your "hosts allow" 
442 and other config lines in smb.conf are correct.
443 </para>
444
445 <para>
446 It's also possible that the server can't work out what user name to
447 connect you as. To see if this is the problem add the line "user =
448 USERNAME" to the [tmp] section of smb.conf where "USERNAME" is the
449 username corresponding to the password you typed. If you find this
450 fixes things you may need the username mapping option. 
451 </para>
452
453 <para>
454 It might also be the case that your client only sends encrypted passwords 
455 and you have <command>encrypt passwords = no</command> in <filename>smb.conf</filename>.
456 Turn it back on to fix.
457 </para>
458
459 </sect2>
460
461 <sect2>
462 <title>Test 10</title>
463
464 <para>
465 Run the command <command>nmblookup -M TESTGROUP</command> where 
466 TESTGROUP is the name of the workgroup that your Samba server and 
467 Windows PCs belong to. You should get back the IP address of the 
468 master browser for that workgroup.
469 </para>
470
471 <para>
472 If you don't then the election process has failed. Wait a minute to
473 see if it is just being slow then try again. If it still fails after
474 that then look at the browsing options you have set in smb.conf. Make
475 sure you have <command>preferred master = yes</command> to ensure that 
476 an election is held at startup.
477 </para>
478
479 </sect2>
480
481 <sect2>
482 <title>Test 11</title>
483
484 <para>
485 From file manager try to browse the server. Your samba server should
486 appear in the browse list of your local workgroup (or the one you
487 specified in smb.conf). You should be able to double click on the name
488 of the server and get a list of shares. If you get a "invalid
489 password" error when you do then you are probably running WinNT and it
490 is refusing to browse a server that has no encrypted password
491 capability and is in user level security mode. In this case either set
492 <command>security = server</command> AND 
493 <command>password server = Windows_NT_Machine</command> in your
494 smb.conf file, or enable encrypted passwords AFTER compiling in support
495 for encrypted passwords (refer to the Makefile).
496 </para>
497
498 </sect2>
499 </sect1>
500
501 <sect1>
502 <title>Still having troubles?</title>
503
504 <para>
505 Try the mailing list or newsgroup, or use the ethereal utility to
506 sniff the problem. The official samba mailing list can be reached at
507 <ulink url="mailto:samba@samba.org">samba@samba.org</ulink>. To find 
508 out more about samba and how to subscribe to the mailing list check 
509 out the samba web page at 
510 <ulink url="http://samba.org/samba">http://samba.org/samba</ulink>
511 </para>
512
513 <para>
514 Also look at the other docs in the Samba package!
515 </para>
516
517 </sect1>
518
519 </chapter>