1 <chapter id="diagnosis">
5 <pubdate>Wed Jan 15</pubdate>
8 <title>The Samba checklist</title>
11 <title>Introduction</title>
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.
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
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.
37 <title>Assumptions</title>
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.
45 The procedure is similar for other types of clients.
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;:
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>
65 These tests assume version 3.0 or later of the samba suite.
66 Some commands shown did not exist in earlier versions.
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.
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>.
82 <indexterm><primary>log files</primary><secondary>monitoring</secondary></indexterm>
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.
95 If you make changes to your &smb.conf; file while going through these test,
96 don't forget to restart &smbd; and &nmbd;.
102 <title>The tests</title>
104 <title>Diagnosing your samba server</title>
106 <indexterm><primary>testparm</primary></indexterm>
108 <step performance="required">
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.
116 Your &smb.conf; file may be located in: <filename>/etc/samba</filename>
117 Or in: <filename>/usr/local/samba/lib</filename>
121 <step performance="required">
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.
130 Note that you will need to start a "dos prompt" window on the PC to
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.
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.
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.)
151 Modern Linux distributions install ipchains/iptables by default.
152 This is a common problem that is often overlooked.
157 <step performance="required">
159 Run the command <userinput>smbclient -L BIGSERVER</userinput> on the unix box. You
160 should get a list of available shares back.
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.
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>.
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.
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
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:
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>
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:
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>
223 Do <emphasis>not</emphasis> use the <smbconfoption><name>bind interfaces only</name></smbconfoption> parameter where you
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
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!
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.
250 <step performance="required">
253 Run the command <userinput>nmblookup -B BIGSERVER __SAMBA__</userinput>. You should get the
254 IP address of your Samba server back.
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
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
272 <step performance="required">
274 <para>run the command <userinput>nmblookup -B ACLIENT '*'</userinput></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.
283 If ACLIENT doesn't resolve via DNS then use the IP address of the
284 client in the above test.
289 <step performance="required">
292 Run the command <userinput>nmblookup -d 2 '*'</userinput>
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.
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.
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
319 This test will probably fail if your subnet mask and broadcast address are
320 not correct. (Refer to TEST 3 notes above).
325 <step performance="required">
327 <indexterm><primary>smbclient</primary></indexterm>
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>
339 It is possible to specify the password along with the username
341 <userinput>smbclient //bigserver/tmp -Ujohndoe%secret</userinput>
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;.
351 If it says <errorname>bad password</errorname> then the likely causes are:
357 you have shadow passwords (or some other password system) but didn't
358 compile in support for them in &smbd;
364 your <smbconfoption><name>valid users</name></smbconfoption> configuration is incorrect
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
376 the <smbconfoption><name>path</name></smbconfoption> line in &smb.conf; is incorrect. Check it with &testparm;
382 you enabled password encryption but didn't map unix to samba users. Run <screen><userinput>smbpasswd -a <replaceable>username</replaceable></userinput></screen>.
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>.
397 <step performance="required">
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.
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):
414 fixup the &nmbd; installation
418 add the IP address of BIGSERVER to the <command>wins server</command> box in the
419 advanced TCP/IP setup on the PC.
423 enable windows name resolution via DNS in the advanced section of
428 add BIGSERVER to your lmhosts file on the PC.
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
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
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.)
456 <step performance="required">
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.
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.
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.
482 <step performance="required">
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.
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.
501 <step performance="required">
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