Sams Teach Yourself Samba in 24 Hours

ContentsIndex

Hour 4: Installing and Testing the Configuration

Previous HourNext Hour

Sections in this Chapter:

 

Testing the Installation

At this point in the game, I

The time has come to see whether I made any mistakes along the way. I'll highlight some common errors during setup, how to detect them, and how to correct them.

Samba includes a utility named smbclient that provides an FTP-like interface for accessing SMB servers. In fact, the original use for smbclient was to test Samba. In this case, it enables me to test the Samba server without locating extra PCs. Although it cannot guarantee zero glitches when the PCs are connected, it should enable me to find any obvious errors.

After verifying that the Samba daemons are running or that valid entries exist to start the processes from inetd.conf, I attempt to get a list of shares from the server. The -L netbios name switch tells smbclient to get a list of shares from the server specified by netbios name. I use the -N switch to suppress the prompting for a password because it is not needed if all I want is to see what shares are available:

root# /usr/local/samba/bin/smbclient -L EAGLE -N
Added interface ip=192.168.1.73 bcast=192.168.1.255 nmask=255.255.255.0
Domain=[FOWLPLAY] OS=[Unix] Server=[Samba 2.0.0beta4]

        Sharename      Type      Comment
        ---------      ----      -------
        boss1          Disk      Shared directory for group boss1
        homes          Disk      Unix home directory space
        printer1       Printer   printer located outside office
        IPC$           IPC       IPC Service (Samba 2.0.0beta4)

        Server               Comment
        ---------            -------

        Workgroup            Master
        ---------            -------
        FOWLPLAY

All three shares that I defined (homes, boss1, and printer1) appear in the share list. The IPC$ share is created automatically and is used for browsing. I'll talk about this one more in later hours. Everything appears fine to this point.

The next step is to verify the individual disk shares. First, I'll connect to the [boss1] share as joe. When connecting to a share, the network path is written as //servername/sharename replacing servername and sharename with the appropriate values. In the bash shell, to connect using a username other than the one stored in the $USER environment variable, I'll need to use the -U username switch:

root# /usr/local/samba/bin/smbclient //eagle/boss1 -U joe
Added interface ip=192.168.1.73 bcast=192.168.1.255 nmask=255.255.255.0
Password:
Domain=[FOWLPLAY] OS=[Unix] Server=[Samba 2.0.0beta4]
tree connect failed: ERRSRV - ERRinvnetname (Invalid network name in tree connect.)

After entering the correct password, smbclient returns with an error of an "Invalid network name in tree connect." If you remember from Hour 2, "Windows Networking," a tree connect occurs after the client has been authenticated and is attempting to connect to a specific resource. After some checking, I find that I misnamed the directory /export/boss instead of /export/boss1:

root# ls -l /export
total 1
drwxrws---   2 root     boss1        1024 Dec 29 09:50 boss/
root# mv /export/boss /export/boss1
root# ls -l /export
total 1
drwxrws---   2 root     boss1        1024 Dec 29 09:50 boss1/

After correcting my mistake, I try again. This time, I successfully connect. You will notice that the hosts file I uploaded was created with the correct permissions and group ownership as well. I can use a similar method for verifying the [homes] share:

root# smbclient //bilbo/boss1 -U joe
Added interface ip=192.168.1.73 bcast=192.168.1.255 nmask=255.255.255.0
Password:
Domain=[FOWLPLAY] OS=[Unix] Server=[Samba 2.0.0beta4]

smb: \> lcd /etc
the local directory is now /etc

smb: \> put hosts
putting file hosts as \hosts (101.073 kb/s) (average 101.074 kb/s)

smb: \> dir
  hosts                                     621  Tue Dec 29 10:36:48 1998
                61967 blocks of size 4096. 15359 blocks available

smb: \> quit

root# ls -l /export/boss1
total 1
-rw-rw----   1 joe      boss1         621 Dec 29 10:36 hosts

When I've tested the disk shares, the last item to verify is the network printer. The process is the same except I'll use the -P switch to tell smbclient to connect to the share as a printer rather than a network drive. Using the put command to upload a file to a printer informs smbclient to send the file to be printed. I can verify that Samba sent the file correctly by using the lpq command to view the appropriate print queue:

root# smbclient //bilbo/printer1 -P -U boss
Added interface ip=192.168.1.73 bcast=192.168.1.255 nmask=255.255.255.0
Password:
Domain=[FOWLPLAY] OS=[Unix] Server=[Samba 2.0.0beta4]

smb: \> lcd /etc
the local directory is now /etc
smb: \> put hosts
putting file hosts as \hosts (5.41469 kb/s) (average 5.41469 kb/s)

smb: \> quit

root# lpq -P printer1
waiting for printer1 to become ready (offline ?)
Rank   Owner      Job  Files                                 Total Size
1st    boss       0    hosts                                 621 bytes

Sams Teach Yourself Samba in 24 Hours

ContentsIndex

Hour 4: Installing and Testing the Configuration

Previous HourNext Hour

Sections in this Chapter: