Software: Apache/2.0.54 (Fedora). PHP/5.0.4 uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 uid=48(apache) gid=48(apache) groups=48(apache) Safe-mode: OFF (not secure) /usr/share/doc/samba-3.0.23a/htmldocs/using_samba/ drwxr-xr-x |
Viewing file: Select action/file-type: ![]() Chapter 12. Troubleshooting SambaSamba is extremely robust. Once you have everything set up the way you want, you'll probably forget that it is running. When trouble occurs, it's typically during installation or when you're trying to reconfigure the server. Fortunately, a wide variety of resources are available to diagnose these troubles. While we can't describe in detail the solution to every problem you might encounter, you should be able to get a good start at resolving the problem by following the advice given in this chapter. The first section of this chapter lists the tool bag, a collection of tools available for troubleshooting Samba; the second section is a detailed how-to; the last section lists extra resources to track down particularly stubborn problems. The Tool BoxSometimes Unix seems to be made up of a grab bag of applications and tools. There are tools to troubleshoot tools. And of course, there are several ways to accomplish the same task. When trying to solve a problem related to Samba, a good plan of attack is to use the following:
Let's go over each of these one-by-one in the following sections. Samba LogsYour first line of attack should always be to check the log files. The Samba log files can help diagnose the vast majority of the problems faced by beginning- to intermediate-level Samba administrators. Samba is quite flexible when it comes to logging. You can set up the server to log as little or as much information as you want. Using substitution variables in the Samba configuration file allows you to isolate individual logs for each system, share, or combination thereof. Logs are placed in /usr/local/samba/var/smbd.log and /usr/local/samba/var/nmbd.log by default. You can specify a log directory to use with the -l flag on the command line when starting the Samba daemons. For example: # smbd -l /var/log/samba # nmbd -l /var/log/samba Alternatively, you can override the location and name using the log file configuration option in smb.conf. This option accepts all the substitution variables, so you could easily have the server keep a separate log for each connecting client system by specifying the following: [global] log file = %m.log Another useful trick is to have the server keep a log for each service (share) that is offered, especially if you suspect a particular share is causing trouble. To do this, use the %S variable, like this: [global] log file = %S.log Log levelsThe level of logging that Samba uses can be set in the smb.conf file using the global log level or debug level option; they are equivalent. The logging level is an integer that can range from 0 to 10. At level 0, no logging is done. Higher values result in more voluminous logging. For example, let's assume that we will use a Windows client to browse a directory on a Samba server. For a small amount of log information, you can use log level = 1, which instructs Samba to show only cursory information, in this case only the connection itself: 05/25/02 22:02:11 server (192.168.236.86) connect to service public as user pcguest (uid=503,gid=100) (pid 3377) Higher debug levels produce more detailed information. Usually, you won't need more than level 3, which is fully adequate for most Samba administrators. Levels above 3 are used by the developers and dump enormous amounts of cryptic information. Here is an example of output at levels 2 and 3 for the same operation. Don't worry if you don't understand the intricacies of an SMB connection; the point is simply to show you what types of information are shown at the different logging levels: /* Level 2 */ Got SIGHUP Processing section "[homes]" Processing section "[public]" Processing section "[temp]" Allowed connection from 192.168.236.86 (192.168.236.86) to IPC$ Allowed connection from 192.168.236.86 (192.168.236.86) to IPC/ /* Level 3 */ 05/25/02 22:15:09 Transaction 63 of length 67 switch message SMBtconX (pid 3377) Allowed connection from 192.168.236.86 (192.168.236.86) to IPC$ ACCEPTED: guest account and guest ok found free connection number 105 Connect path is /tmp chdir to /tmp chdir to / 05/25/02 22:15:09 server (192.168.236.86) connect to service IPC$ as user pcguest (uid=503,gid=100) (pid 3377) 05/25/02 22:15:09 tconX service=ipc$ user=pcguest cnum=105 05/25/02 22:15:09 Transaction 64 of length 99 switch message SMBtrans (pid 3377) chdir to /tmp trans <\PIPE\LANMAN> data=0 params=19 setup=0 Got API command 0 of form <WrLeh> <B13BWz> (tdscnt=0,tpscnt=19,mdrcnt=4096,mprcnt=8) Doing RNetShareEnum RNetShareEnum gave 4 entries of 4 (1 4096 126 4096) 05/25/02 22:15:11 Transaction 65 of length 99 switch message SMBtrans (pid 3377) chdir to / chdir to /tmp trans <\PIPE\LANMAN> data=0 params=19 setup=0 Got API command 0 of form <WrLeh> <B13BWz> (tdscnt=0,tpscnt=19,mdrcnt=4096,mprcnt=8) Doing RNetShareEnum RNetShareEnum gave 4 entries of 4 (1 4096 126 4096) 05/25/02 22:15:11 Transaction 66 of length 95 switch message SMBtrans2 (pid 3377) chdir to / chdir to /pcdisk/public call_trans2findfirst: dirtype = 0, maxentries = 6, close_after_first=0, close_if_end = 0 requires_resume_key = 0 level = 260, max_data_bytes = 2432 unix_clean_name [./DESKTOP.INI] unix_clean_name [desktop.ini] unix_clean_name [./] creating new dirptr 1 for path ./, expect_close = 1 05/25/02 22:15:11 Transaction 67 of length 53 switch message SMBgetatr (pid 3377) chdir to / [... deleted ...] We cut off this listing after the first packet because it runs on for many pages. However, be aware that log levels above 3 will quickly consume disk space with megabytes of excruciating detail concerning Samba's internal operations. Log level 3 is extremely useful for following exactly what the server is doing, and most of the time it will be obvious where an error occurs by glancing through the log file. Using a high log level (3 or above) will seriously slow down the Samba server. Remember that every log message generated causes a write to disk (an inherently slow operation) and log levels greater than 2 produce massive amounts of data. Essentially, you should turn on logging level 3 only when you're actively tracking a problem in the Samba server. Activating and deactivating loggingTo turn logging on and off, set the appropriate level in the [global] section of smb.conf. Then, you can either restart Samba or force the current daemon to reprocess the configuration file by sending it a hangup (HUP) signal. You also can send the smbd process a SIGUSR1 signal to increase its log level by one while it's running, like this: # kill -SIGUSR1 1234 or a SIGUSR2 signal to decrease it by one: # kill -SIGUSR2 1234 Logging by individual client systems or usersAn effective way to diagnose problems without hampering other users is to assign different log levels for different systems in the [global] section of the smb.conf file. We can do this by building on the strategy we presented earlier: [global] log level = 0 log file = /usr/local/samba/var/log.%m include = /usr/local/samba/lib/smb.conf.%m These options instruct Samba to use unique configuration and log files for each client that connects. Now all you have to do is create an smb.conf file for a specific client system with a log level = 3 entry in it (the others will pick up the default log level of 0) and use that log file to track down the problem. Similarly, if only particular users are experiencing a problem—and it travels from system to system with them—you can isolate logging to a specific user by adding the following to the smb.conf file: [global] log level = 0 log file = /usr/local/samba/var/log.%u include = /usr/local/samba/lib/smb.conf.%u Then you can create a unique smb.conf file for each user you wish to monitor (e.g., /usr/local/samba/lib/smb.conf.tim). Files containing the configuration option log level = 3 and only those users will get more detailed logging. Samba Test UtilitiesA rigorous set of tests that exercise the major parts of Samba are described in various files in the /docs/textdocs directory of the Samba distribution kit, starting with DIAGNOSIS.txt. The fault tree in this chapter is a more detailed version of the basic tests suggested by the Samba Team, but it covers only installation and reconfiguration diagnosis, such as DIAGNOSIS.txt. The other files in the /docs subdirectories address specific problems and instruct you how to troubleshoot items not included in this book. If the fault tree doesn't suffice, be sure to look at DIAGNOSIS.txt and its friends. Unix UtilitiesSometimes it's useful to use a tool outside the Samba suite to examine what's happening inside the server. Three diagnostic tools can be of particular help in debugging Samba troubles: trace, tcpdump, and Ethereal. Using traceThe trace command masquerades under several different names, depending on the operating system you are using. On Linux it will be strace; on Solaris you'll use truss; SGI will have padc and par; and HP-UX will have trace or tusc. All have essentially the same function, which is to display each operating system function call as it is executed. This allows you to follow the execution of a program, such as the Samba server, and often pinpoints the exact call that is causing the difficulty. One problem that trace can highlight is an incorrect version of a dynamically linked library. This can happen if you've downloaded prebuilt binaries of Samba. You'll typically see the offending call at the end of the trace, just before the program terminates. A sample strace output for the Linux operating system follows. This is a small section of a larger file created during the opening of a directory on the Samba server. Each line lists a system call and includes its parameters and the return value. If there was an error, the error value (e.g., ENOENT) and its explanation are also shown. You can look up the parameter types and the errors that can occur in the appropriate trace manual page for the operating system you are using. chdir("/pcdisk/public") = 0 stat("mini/desktop.ini", 0xbffff7ec) = -1 ENOENT (No such file or directory) stat("mini", {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0 stat("mini/desktop.ini", 0xbffff7ec) = -1 ENOENT (No such file or directory) open("mini", O_RDONLY) = 5 fcntl(5, F_SETFD, FD_CLOEXEC) = 0 fstat(5, {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0 lseek(5, 0, SEEK_CUR) = 0 SYS_141(0x5, 0xbfffdbbc, 0xedc, 0xbfffdbbc, 0x80ba708) = 196 lseek(5, 0, SEEK_CUR) = 1024 SYS_141(0x5, 0xbfffdbbc, 0xedc, 0xbfffdbbc, 0x80ba708) = 0 close(5) = 0 stat("mini/desktop.ini", 0xbffff86c) = -1 ENOENT (No such file or directory) write(3, "\0\0\0#\377SMB\10\1\0\2\0\200\1\0"..., 39) = 39 SYS_142(0xff, 0xbffffc3c, 0, 0, 0xbffffc08) = 1 read(3, "\0\0\0?", 4) = 4 read(3, "\377SMBu\0\0\0\0\0\0\0\0\0\0\0\0"..., 63) = 63 time(NULL) = 896143871 This example shows several stat() calls failing to find the files they were expecting. You don't have to be an expert to see that the file desktop.ini is missing from that directory. In fact, many difficult problems can be identified by looking for obvious, repeatable errors with trace. Often, you need not look further than the last message before a crash. Using tcpdumpThe tcpdump program, as extended by Andrew Tridgell, allows you to monitor SMB network traffic in real time. A variety of output formats are available, and you can filter the output to look at only a particular type of traffic. You can examine all conversations between client and server, including SMB and NMB broadcast messages. While its troubleshooting capabilities lie mainly at the OSI network layer, you can still use its output to get a general idea of what the server and client are attempting to do. A sample tcpdump log follows. In this instance, the client has requested a directory listing, and the server has responded appropriately, giving the directory names homes, public, IPC$, and temp (we've added a few explanations on the right): $ tcpdump -v -s 255 -i eth0 port not telnet SMB PACKET: SMBtrans (REQUEST) Request packet SMB Command = 0x25 Request was ls or dir [000] 01 00 00 10 .... >>> NBT Packet Outer frame of SMB packet NBT Session Packet Flags=0x0 Length=226 [lines skipped] SMB PACKET: SMBtrans (REPLY) Beginning of a reply to request SMB Command = 0x25 Command was an ls or dir Error class = 0x0 Error code = 0 No errors Flags1 = 0x80 Flags2 = 0x1 Tree ID = 105 Proc ID = 6075 UID = 100 MID = 30337 Word Count = 10 TotParamCnt=8 TotDataCnt=163 Res1=0 ParamCnt=8 ParamOff=55 Res2=0 DataCnt=163 DataOff=63 Res3=0 Lsetup=0 Param Data: (8 bytes) [000] 00 00 00 00 05 00 05 00 ........ Data Data: (135 bytes) Actual directory contents: [000] 68 6F 6D 65 73 00 00 00 00 00 00 00 00 00 00 00 homes... ........ [010] 64 00 00 00 70 75 62 6C 69 63 00 00 00 00 00 00 d...publ ic...... [020] 00 00 00 00 75 00 00 00 74 65 6D 70 00 00 00 00 ....u... temp.... [030] 00 00 00 00 00 00 00 00 76 00 00 00 49 50 43 24 ........ v...IPC$ [040] 00 00 00 00 00 00 00 00 00 00 03 00 77 00 00 00 ........ ....w... [050] 64 6F 6E 68 61 6D 00 00 00 00 00 00 00 00 00 00 donham.. ........ [060] 92 00 00 00 48 6F 6D 65 20 44 69 72 65 63 74 6F ....Home Directo [070] 72 69 65 73 00 00 00 49 50 43 20 53 65 72 76 69 ries...I PC Servi [080] 63 65 20 28 53 61 6D ce (Sam This is more of the same debugging session as we saw before with the trace command: the listing of a directory. The options we used were -v (verbose), -i eth0 to tell tcpdump on which interface to listen (an Ethernet port), and -s 255 to tell it to save the first 255 bytes of each packet instead of the default: the first 68. The option port not telnet is used to avoid screens of telnet traffic, because we were logged in to the server remotely. The tcpdump program actually has quite a number of options to filter just the traffic you want to look at. If you've used snoop or etherdump, it will look vaguely familiar. You can download the modified tcpdump from the Samba FTP server, located at ftp://samba.anu.edu.au/pub/samba/tcpdump-smb. Other versions might not include support for the SMB protocol; if you don't see output such as that shown in the example, you'll need to use the SMB-enabled version. Using EtherealEthereal (http://www.ethereal.com) is a GUI-based utility that performs the same basic function as tcpdump. You might prefer Ethereal because it is much easier to use. Once you have Ethereal running, just do the following:
Ethereal does a good job of translating the content of the packets it encounters into human-readable format, and you should have little trouble seeing what happened on the network during the capture period. The Fault TreeThe fault tree presented in this section is for diagnosing and fixing problems that occur when you're installing and reconfiguring Samba. It's an expanded form of the trouble and diagnostic document DIAGNOSIS.txt, which is part of the Samba distribution. Before you set out to troubleshoot any part of the Samba suite, you should know the following information:
For clarity, we've renamed the server in the following examples to server.example.com, and the client system to client.example.com. How to Use the Fault TreeStart the tests here, without skipping forward; it won't take long (about 5 minutes) and might actually save you time backtracking. Whenever a test succeeds, you will be given a name of a section to which you can safely skip. Troubleshooting Low-Level IPThe first series of tests is that of the low-level services that Samba needs to run. The tests in this section verify that:
Subsequent sections add TCP software, the Samba daemons smbd and nmbd, host-based access control, authentication and per-user access control, file services, and browsing. The tests are described in considerable detail to make them understandable by both technically oriented end users and experienced systems and network administrators. Testing the networking software with pingThe first command to enter on both the server and the client is ping 127.0.0.1. This pings the loopback address and indicates whether any networking support is functioning. On Unix, you can use ping 127.0.0.1 with the statistics option and interrupt it after a few lines. On Sun workstations, the command is typically /usr/etc/ping -s 127.0.0.1; on Linux, just ping 127.0.0.1. On Windows clients, run ping 127.0.0.1 in an MS-DOS (command prompt) window, and it will stop by itself after four lines. Here is an example on a Linux server: $ ping 127.0.0.1 PING localhost: 56 data bytes 64 bytes from localhost (127.0.0.1): icmp-seq=0. time=1. ms 64 bytes from localhost (127.0.0.1): icmp-seq=1. time=0. ms 64 bytes from localhost (127.0.0.1): icmp-seq=2. time=1. ms ^C ----127.0.0.1 PING Statistics---- 3 packets transmitted, 3 packets received, 0% packet loss round-trip (ms) min/avg/max = 0/0/1 If you get "ping: no answer from . . . " or "100% packet loss," you have no IP networking installed on the system. The address 127.0.0.1 is the internal loopback address and doesn't depend on the computer being physically connected to a network. If this test fails, you have a serious local problem. TCP/IP either isn't installed or is seriously misconfigured. See your operating system documentation if it's a Unix server. If it's a Windows client, follow the instructions in Chapter 3 to install networking support.
Testing local name services with pingNext, try to ping localhost on the Samba server. The localhost hostname is the conventional hostname for the 127.0.0.1 loopback interface, and it should resolve to that address. After typing ping localhost, you should see output similar to the following: $ ping localhost PING localhost: 56 data bytes 64 bytes from localhost (127.0.0.1): icmp-seq=0. time=0. ms 64 bytes from localhost (127.0.0.1): icmp-seq=1. time=0. ms 64 bytes from localhost (127.0.0.1): icmp-seq=2. time=0. ms ^C If this succeeds, try the same test on the client. Otherwise:
Testing the networking hardware with pingNext, ping the server's network IP address from itself. This should get you exactly the same results as pinging 127.0.0.1: $ ping 192.168.236.86 PING 192.168.236.86: 56 data bytes 64 bytes from 192.168.236.86 (192.168.236.86): icmp-seq=0. time=1. ms 64 bytes from 192.168.236.86 (192.168.236.86): icmp-seq=1. time=0. ms 64 bytes from 192.168.236.86 (192.168.236.86): icmp-seq=2. time=1. ms ^C ----192.168.236.86 PING Statistics---- 3 packets transmitted, 3 packets received, 0% packet loss round-trip (ms) min/avg/max = 0/0/1 If this works on the server, repeat it for the client. Otherwise:
Testing connections with pingNow, ping the server by name (instead of its IP address)—once from the server and once from the client. This is the general test for working network hardware: $ ping server PING server.example.com: 56 data bytes 64 bytes from server.example.com (192.168.236.86): icmp-seq=0. time=1. ms 64 bytes from server.example.com (192.168.236.86): icmp-seq=1. time=0. ms 64 bytes from server.example.com (192.168.236.86): icmp-seq=2. time=1. ms ^C ----server.example.com PING Statistics---- 3 packets transmitted, 3 packets received, 0% packet loss round-trip (ms) min/avg/max = 0/0/1 If successful, this test tells us five things:
If this test isn't successful, one of several things can be wrong with the network:
Troubleshooting TCPNow that you've tested IP, UDP, and a name service with ping, it's time to test TCP. Browsing and ping use ICMP and UDP; file and print services (shares) use TCP. Both depend on IP as a lower layer, and all four depend on name services. Testing TCP is most conveniently done using the FTP program. Testing TCP with FTPTry connecting via FTP, once from the server to itself, and once from the client to the server: $ ftp server Connected to server.example.com. 220 server.example.com FTP server (Version 6.2/OpenBSD/Linux-0.10) ready. Name (server:davecb): 331 Password required for davecb. Password: 230 User davecb logged in. ftp> quit 221 Goodbye. If this worked, skip to the next section, Section 12.2.4. Otherwise:
Troubleshooting Server DaemonsOnce you've confirmed that TCP networking is working properly, the next step is to make sure the daemons are running on the server. This takes three separate tests because no single one of the following will decisively prove that they're working correctly. To be sure they're running, you need to find out whether the daemons:
Tracking daemon startupFirst, check the Samba logs. If you've started the daemons, the message smbd version number started should appear. If it doesn't, you need to restart the Samba daemons. If the daemon reports that it has indeed started, look out for bind failed on port 139 socket_addr=0 (Address already in use). This means another daemon has been started on port 139 (smbd ). Also, nmbd will report a similar failure if it cannot bind to port 137. Either you've started them twice, or the inetd server has tried to provide a daemon for you. If it's the latter, we'll diagnose that in a moment. Looking for daemon processes with psAnother way to make sure the daemons are running is to check their processes on the system. Use the ps command on the server with the "long" option for your system type (commonly ps ax or ps -ef), and see whether smbd and nmbd are already running. This often looks like the following: $ ps ax PID TTY STAT TIME COMMAND 1 ? S 0:03 init [2] 2 ? SW 0:00 (kflushd) (...many lines of processes...) 234 ? S 0:14 nmbd -D3 237 ? S 0:11 smbd -D3 (...more lines, possibly including more smbd lines...) This example illustrates that smbd and nmbd have already started as standalone daemons (the -D option) at log level 3. Looking for daemons bound to portsNext, the daemons have to be registered with the operating system so that they can get access to TCP/IP ports. The netstat command will tell you if this has been done. Run the command netstat -a on the server, and look for lines mentioning netbios, 137, or 139: $ netstat -a Active Internet connections (including servers) Proto Recv-Q Send-Q Local Address Foreign Address (state) udp 0 0 *.137 *.* tcp 0 0 *.139 *.* LISTEN tcp 8370 8760 server.139 client.1439 ESTABLISHED Among similar lines, there should be at least one UDP line for *.netbios- or *.137. This indicates that the nmbd server is registered and (we hope) is waiting to answer requests. There should also be at least one TCP line mentioning *.netbios- or *.139, and it will probably be in the LISTEN state. This means that smbd is up and listening for connections. There might be other TCP lines indicating connections from smbd to clients, one for each client. These are usually in the ESTABLISHED state. If there are smbd lines in the ESTABLISHED state, smbd is definitely running. If there is only one line in the LISTEN state, we're not sure yet. If both of the lines are missing, a daemon has not succeeded in starting, so it's time to check the logs and then go back to Chapter 2. If there is a line for each client, it might be coming either from a Samba daemon or from the master IP daemon, inetd. It's quite possible that your inetd startup file contains lines that start Samba daemons without your realizing it; for instance, the lines might have been placed there if you installed Samba as part of a Linux distribution. The daemons started by inetd prevent ours from running. This problem typically produces log messages such as bind failed on port 139 socket addr=0 (Address already in use). Check your /etc/inetd.conf ; unless you're intentionally starting the daemons from there, netbios-ns (UDP port 137) or netbios-ssn (tcp port 139) servers should be mentioned there. If your system is providing an SMB daemon via inetd, lines such as the following will appear in the inetd.conf file: netbios-ssn stream tcp nowait root /usr/local/samba/bin/smbd smbd netbios-ns dgram udp wait root /usr/local/samba/bin/nmbd nmbd If your system uses xinetd instead of inetd, see Chapter 2 for details concerning its configuration. Checking smbd with telnetIronically, the easiest way to test that the smbd server is actually working is to send it a meaningless message and see if it is rejected. Try something such as the following: $ echo "hello" | telnet localhost 139 Trying Trying 192.168.236.86 ... Connected to localhost. Escape character is '^]'. Connection closed by foreign host. This sends an erroneous but harmless message to smbd. If you get a Connected message followed by a Connection closed message, the test was a success. You have an smbd daemon listening on the port and rejecting improper connection messages. On the other hand, if you get telnet: connect: Connection refused, most likely no daemon is present. Check the logs and go back to Chapter 2. Regrettably, there isn't an easy test for nmbd. If the telnet test and the netstat test both say that an smbd is running, there is a good chance that netstat will also be correct about nmbd running. Testing daemons with testparmOnce you know there's a daemon, you should always run testparm, in hopes of getting something such as the following: $ testparm Load smb config files from /opt/samba/lib/smb.conf Processing section "[homes]" Processing section "[printers]" ... Processing section "[tmp]" Loaded services file OK. ... The testparm program normally reports the processing of a series of sections and responds with Loaded services file OK if it succeeds. If not, it reports one or more of the following messages, which also appear in the logs as noted:
After the testparm test, repeat it with (exactly) three parameters: the name of your smb.conf file, the name of your client, and its IP address: # testparm /usr/local/samba/lib/smb.conf client 192.168.236.10 This will run one more test that checks the hostname and address against hosts allow and hosts deny options and might produce the Allow connection from hostname to service and/or Deny connection from hostname to service messages for the client system. These messages indicate that you have hosts allow and/or hosts deny options in your smb.conf, and they prohibit access from the client system. Troubleshooting SMB ConnectionsNow that you know the servers are up, you need to make sure they're running properly. We start by placing a simple smb.conf file in the /usr/local/samba/lib directory. A minimal smb.conf fileIn the following tests, we assume you have a [temp] share suitable for testing, plus at least one account. An smb.conf file that includes just these is as follows: [global] workgroup = EXAMPLE security = user browsable = yes local master = yes [homes] guest ok = no browsable = no [temp] path = /tmp public = yes
Testing locally with smbclientThe first test is to ensure that the server can list its own services (shares). Run the command smbclient -L localhost -U% to connect to the server from itself, and specify the guest user. You should see the following: $ smbclient -L localhost -U% Server time is Wed May 27 17:57:40 2002 Timezone is UTC-4.0 Server=[localhost] User=[davecb] Workgroup=[EXAMPLE] Domain=[EXAMPLE] Sharename Type Comment --------- ----- ---------- temp Disk IPC$ IPC IPC Service (Samba 1.9.18) homes Disk Home directories This machine does not have a browse list If you received this output, move on to the next section, Section 12.2.5.3. On the other hand, if you receive an error, check the following:
Testing connections with smbclientRun the command smbclient \\server\temp to connect to the server's [temp] share and to see if you can connect to a file service. You should get the following response: $ smbclient '\\server\temp' Server time is Tue May 5 09:49:32 2002 Timezone is UTC-4.0 Password: smb: \> quit You might receive the following errors:
Now, provide your Unix account password to the Password: prompt. If you then get an smb: \> prompt, it worked. Enter quit and continue on to the next section, Section 12.2.5.4. If you got SMBtconX failed. ERRSRV--ERRinvnetname, the problem can be any of the following:
There is one more reason for this failure that has nothing at all to do with passwords: the path parameter in your smb.conf file might point somewhere that doesn't exist. This will not be diagnosed by testparm, and most SMB clients can't distinguish it from other types of bad user accounts. You will have to check it manually. Once you have connected to [temp] successfully, repeat the test, this time logging in to your home directory (e.g., map network drive server\davecb). If you have to change anything to get that to work, retest [temp] again afterward. Testing connections with net useRun the command net use * \server\temp on the Windows client to see if it can connect to the server. You should be prompted for a password, then receive the response The command was completed successfully. If that worked, continue with the steps in the next section, Section 12.2.5.5. Otherwise:
Testing connections with Windows ExplorerStart Windows Explorer (not Internet Explorer), select Map Network Drive from the Tools menu, and specify the UNC for one of your shares on the Samba server to see if you can make Explorer connect to it. If so, you've succeeded and can skip to the next section, Section 12.2.6. Windows Explorer is a rather poor diagnostic tool: it tells you that something's wrong, but rarely what it is. If you get a failure, you'll need to track it down with the Windows net use command, which has far superior error reporting:
Once you can reliably connect to the share, try again, this time using your home directory. If you have to change something to get home directories working, retest with the first share, and vice versa, as we showed in the earlier section, "Testing connections with net use." As always, if Explorer fails, drop back to that section and debug the connection there. Troubleshooting BrowsingFinally, we come to browsing. We've left this for last, not because it is the most difficult, but because it's both optional and partially dependent on a protocol that doesn't guarantee delivery of a packet. Browsing is hard to diagnose if you don't already know that all the other services are running. Browsing is purely optional: it's just a way to find the servers on your network and the shares that they provide. Unix has nothing of the sort and happily does without. Browsing also assumes all your systems are on a local area network (LAN) where broadcasts are allowable. First, the browsing mechanism identifies a system using the unreliable UDP protocol; it then makes a normal (reliable) TCP/IP connection to list the shares the system provides. Testing browsing with smbclientWe'll start with testing the reliable connection first. From the server, try listing its own shares using smbclient with a -L option and your server's name. You should get something resembling the following: $ smbclient -L server Added interface ip=192.168.236.86 bcast=192.168.236.255 nmask=255.255.255.0 Server time is Tue Apr 28 09:57:28 2002 Timezone is UTC-4.0 Password: Domain=[EXAMPLE] OS=[Unix] Server=[Samba 2.2.5] Sharename Type Comment --------- ---- ------- cdrom Disk CD-ROM cl Printer Color Printer 1 davecb Disk Home Directories Server Comment --------- ------- SERVER Samba 2.2.5 Workgroup Master --------- ------- EXAMPLE SERVER
If you're still getting nothing, you shouldn't have gotten this far; double back to at least Section 12.2.3.1, or perhaps Section 12.2.2.4. On the other hand:
Testing the server with nmblookupThis will test the "advertising" system used for Windows name services and browsing. Advertising works by broadcasting one's presence or willingness to provide services. It is the part of browsing that uses an unreliable protocol (UDP) and works only on broadcast networks such as Ethernets. The nmblookup program broadcasts name queries for the hostname you provide and returns its IP address and the name of the system, much as nslookup does with DNS. Here, the -d (debug or log-level) and -B (broadcast address) options direct queries to specific systems. First, we check the server from itself. Run nmblookup with a -B option of your server's name (to tell it to send the query to the Samba server) and a parameter of _ _SAMBA_ _ as the symbolic name to look up. You should get: $ nmblookup -B server _ _SAMBA_ _ Added interface ip=192.168.236.86 bcast=192.168.236.255 nmask=255.255.255.0 Sending queries to 192.168.236.86 192.168.236.86 _ _SAMBA_ _ You should get the IP address of the server, followed by the name _ _SAMBA_ _ , which means that the server has successfully advertised that it has a service called _ _SAMBA_ _ , and therefore at least part of NetBIOS name service works.
Testing the client with nmblookupNext, check the IP address of the client from the server with nmblookup using the -B option for the client's name and a parameter of '*' meaning "anything," as shown here: $ nmblookup -B client '*' Sending queries to 192.168.236.10 192.168.236.10 * Got a positive name query response from 192.168.236.10 (192.168.236.10) You might get the following error:
Repeat the command with the following options if you had any failures:
Testing the network with nmblookupRun the command nmblookup again with a -d2 option (for a debug level of 2) and a parameter of '*'. This time we are testing the ability of programs (such as nmbd ) to use broadcast. It's essentially a connectivity test, done via a broadcast to the default broadcast address. A number of NetBIOS over TCP/IP hosts on the network should respond with got a positive name query response messages. Samba might not catch all the responses in the short time it listens, so you won't always see all the SMB clients on the network. However, you should see most of them: $ nmblookup -d 2 '*' Added interface ip=192.168.236.86 bcast=192.168.236.255 nmask=255.255.255.0 Sending queries to 192.168.236.255 Got a positive name query response from 192.168.236.191 (192.168.236.191) Got a positive name query response from 192.168.236.228 (192.168.236.228) Got a positive name query response from 192.168.236.75 (192.168.236.75) Got a positive name query response from 192.168.236.79 (192.168.236.79) Got a positive name query response from 192.168.236.206 (192.168.236.206) Got a positive name query response from 192.168.236.207 (192.168.236.207) Got a positive name query response from 192.168.236.217 (192.168.236.217) Got a positive name query response from 192.168.236.72 (192.168.236.72) 192.168.236.86 * However:
As usual, you can check the Samba log files for additional clues. Testing client browsing with net viewOn the client, run the command net view \\server in an MS-DOS (command prompt) window to see if you can connect to the client and ask what shares it provides. You should get back a list of available shares on the server. If this works, continue with the later section Section 12.3.1. Otherwise:
Browsing the server from the clientFrom the Windows Network Neighborhood (or My Network Places in newer releases), try to browse the server. Your Samba server should appear in the browse list of your local workgroup. You should be able to double-click the name of the server to get a list of shares.
If you've made it this far and the problem is not yet solved, either the problem is one we've not yet seen, or it is a problem related to a topic we have already covered, and further analysis is required. Name resolution is often related to difficulties with Samba, so we cover it in more detail in the next sections. If you know your problem is not related to name resolution, skip to the Section 12.3 at the end of the chapter. Troubleshooting Name ServicesThis section looks at simple troubleshooting of all the name services you'll encounter, but only for the common problems that affect Samba. There are several good references for troubleshooting particular name services: Paul Albitz and Cricket Liu's DNS and Bind (O'Reilly) covers the DNS, Hal Stern's NFS and NIS (O'Reilly) covers NIS ("Yellow pages"), while Windows Internet Name Service (WINS), hosts/LMHOSTS files, and NIS+ are best covered by their respective vendors' manuals. The problems addressed in this section are as follows:
Identifying what's in useFirst, see if both the server and the client are using DNS, WINS, NIS, or hosts files to look up IP addresses when you give them a name. Each kind of system has a different preference:
We recommend that the client systems be configured to use WINS and DNS, the Samba daemons to use WINS and DNS, and the Unix server to use DNS, hosts files, and perhaps NIS+. You'll have to look at your notes and the actual systems to see which is in use. On the clients, the name services are all set in the TCP/IP Properties panel of the Networking Control Panel, as discussed in Chapter 3. You might need to check there to see what you've actually turned on. On the server, see if a /etc/resolv.conf file exists. If it does, you're using DNS. You might be using the others as well, though. You'll need to check for NIS and combinations of services. Check for a /etc/nsswitch.conf file on Solaris and other System V Unix operating systems. If you have one, look for a line that begins with host: followed by one or more of files, bind, nis, or nis+. These are the name services to use, in order, with optional extra material in square brackets. The files keyword is for using HOSTS files, while bind (the Berkeley Internet Name Daemon) refers to using DNS. If the client and server differ, the first thing to do is to get them in sync. Clients can use DNS, WINS, HOSTS, and LMHOSTS files, but not NIS or NIS+. Servers can use HOSTS and LMHOSTS files, DNS, NIS or NIS+, and winbind, but not WINS—even if your Samba server provides WINS services. If you can't get all the systems to use the same services, you'll have to check the server and the client carefully for the same data. You can also make use of the -R (resolve order) option for smbclient. If you want to troubleshoot WINS, for example, you'd say: $ smbclient -L server -R wins The possible settings are hosts (which means whatever the Unix system is using, not just /etc/hosts files), lmhosts, wins, and bcast (broadcast). In the following sections, we use the term long name for a fully qualified domain name (FQDN), such as server.example.com , and the term short name for the host part of an FQDN, such as server. Cannot look up hostnames
Long and short hostnamesWhere the long (FQDN) form of a hostname works but the short name doesn't (for example, client.example.com works but client doesn't), consider the following:
On the other hand, if the short form of the name works and the long form doesn't, consider the following:
Unusual delaysWhen there is a long delay before the expected result:
Localhost issuesWhen a localhost isn't 127.0.0.1, try the following:
Troubleshooting Network AddressesA number of common problems are caused by incorrect routing of Internet addresses or by the incorrect assignment of addresses. This section helps you determine what your addresses are. NetmasksUsing the netmask, it is possible to determine which addresses can be reached directly (i.e., which are on the local network) and which addresses require forwarding packets through a router. If the netmask is wrong, the systems will make one of two mistakes. One is to route local packets via a router, which is an expensive waste of time—it might work reasonably fast, it might run slowly, or it might fail utterly. The second mistake is to fail to send packets from a remote system to the router, which will prevent them from being forwarded to the remote system. The netmask is a number like an IP address, with one-bits for the network part of an address and zero-bits for the host portion. It is used as a bitmask to mask off parts of the address inside the TCP/IP code. If the mask is 255.255.0.0, the first 2 bytes are the network part and the last 2 are the host part. More common is 255.255.255.0, in which the first 3 bytes are the network part and the last one is the host part. For example, let's say your IP address is 192.168.0.10 and the Samba server is 192.168.236.86. If your netmask happens to be 255.255.255.0, the network part of the address is the first 3 bytes, and the host part is the last byte. In this case, the network parts are different, and the systems are on different networks:
If your netmask happens to be 255.255.0.0, the network part is just the first 2 bytes. In this case, the network parts match, and so the two systems are on the same network:
Make sure the netmask in use on each system matches the structure of your network. On every subnet, the netmask should be identical on each system. Broadcast addressesThe broadcast address is a normal address, with the hosts part all one-bits. It means "all hosts on your network." You can compute it easily from your netmask and address: take the address and put one-bits in it for all the bits that are zero at the end of the netmask (the host part). The following table illustrates this:
In this example, the broadcast address on the 192.168.236 network is 192.168.236.255. There is also an old "universal" broadcast address, 255.255.255.255. Routers are prohibited from forwarding these, but most systems on your local network will respond to broadcasts to this address. Network address rangesA number of address ranges have been reserved for testing and for nonconnected networks; we use these for the examples in this book. If you don't have an address yet, feel free to use one of these to start. They include one class A network, 10.*.*.*, a range of class B network addresses, 172.16.*.* through 172.31.*.*, and 254 class C networks, 192.168.1.* through 192.168.254.*. The domain example.com is also reserved for unconnected networks, explanatory examples, and books. If you're actually connecting to the Internet, you'll need to get an appropriate IP address and a domain name, probably through the same company that provides your connection. Finding your network addressIf you haven't recorded your IP address, you can learn it through the ifconfig command on Unix or the ipconfig command on Windows. (Check your manual pages for any options required by your brand of Unix. For example, ifconfig -a works on Solaris.) You should see output similar to the following: $ ifconfig -a le0: flags=63<UP,BROADCAST,NOTRAILERS,RUNNING > inet 192.168.236.11 netmask ffffff00 broadcast 192.168.236.255 lo0: flags=49<<>UP,LOOPBACK,RUNNING<>> inet 127.0.0.1 netmask ff000000 One of the interfaces will be loopback (in our examples, lo0), and the other will be the regular IP interface. The flags should show that the interface is running, and Ethernet interfaces will also say they support broadcasts (PPP interfaces don't). The other places to look for IP addresses are /etc/hosts files, Windows HOSTS files, Windows LMHOSTS files, NIS, NIS+, and DNS. Troubleshooting NetBIOS NamesHistorically, SMB protocols have depended on the NetBIOS name system, also called the LAN Manager name system. This was a simple scheme where each system had a unique 20-character name and broadcast it on the LAN for everyone to know. With TCP/IP, we tend to use names such as client.example.com, stored in /etc/hosts files through DNS or WINS. The usual mapping of domain names such as server.example.com to NetBIOS names simply uses the server part as the NetBIOS name and converts it to uppercase. Alas, this doesn't always work, especially if you have a system with a 21-character name; not everyone uses the same NetBIOS and DNS names. For example, corpvm1 along with vm1.corp.com is not unusual. A system with a different NetBIOS name and domain name is confusing when you're troubleshooting; we recommend that you try to avoid this wherever possible. NetBIOS names are discoverable with smbclient :
Extra ResourcesAt some point during your work with Samba, you'll want to turn to online or printed resources for news, updates, and aid. Documentation and FAQsIt's OK to read the documentation. Really. Nobody can see you, and we won't tell. In fact, Samba ships with a large set of documentation files, and it is well worth the effort to at least browse through them, either in the distribution directory on your computer under /docs or online at the Samba web site: http://www.samba.org. The most current FAQ list, bug information, and distribution locations are located at the web site, with links to all the Samba manual pages and HOWTOs. Samba NewsgroupsUsenet newsgroups have always been a great place to get advice on just about any topic. In the past few years, though, this vast pool of knowledge has developed something that has made it into an invaluable resource: a memory. Archival and search sites such as the one at Google (http://groups.google.com/advanced_group_search) have made sifting through years of valuable solutions as simple as a few mouse clicks. The primary newsgroup for Samba is comp.protocols.smb. This should always be your first stop when there's a problem. More often than not, spending 5 minutes researching an error here will save hours of frustration while trying to debug something yourself. When searching a newsgroup, try to be as specific as possible, but not too wordy. Searching on actual error messages is best. If you don't find an answer immediately in the newsgroup, resist the temptation to post a request for help until you've done a bit more work on the problem. You might find that the answer is in a FAQ or one of the many documentation files that ship with Samba, or a solution might become evident when you run one of Samba's diagnostic tools. If nothing works, post a request in comp.protocols.smb, and be as specific as possible about what you have tried and what you are seeing. Include any error messages that appear. It might be days before you receive help, so be patient and keep trying things while you wait.
Samba Mailing ListsThe following are mailing lists for support with Samba. See the Samba home page, http://www.samba.org/, for information on subscribing and unsubscribing to these mailing lists:
Searchable versions of the Samba mailing list archives can be found at http://marc.theaimsgroup.com. When posting messages to the Samba mailing lists, keep in mind that you are sending your message to a large audience. The notes in the previous section regarding Usenet postings also apply here. A well-formulated question or comment is more likely to be answered, and a poorly conceived message is very likely to be ignored! Further Reading
TOC |
:: Command execute :: | |
--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.004 ]-- |