O'Reilly logo

Using Samba, Second Edition by David Collier-Brown, Robert Eckstein, Jay Ts

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

smbclient

The Samba Team supplies smbclient as a basic part of the Samba suite. At first, it might seem to be a primitive interface to the SMB network, but smbclient is actually a versatile tool. It can be used for browsing shares on servers, testing configurations, debugging, accessing shared printers, backing up shared data, and automating administrative tasks in shell scripts. And unlike smbfs and smbsh, smbclient works on all Unix variants that support Samba.

In this chapter we’ll focus mostly on running smbclient as an interactive shell, using its ftp-like commands to access shared directories on the network. Using smbclient to access printers and perform backups will be covered in Chapter 10.

A complete reference to smbclient is found in Appendix C.

Listing Services

The -L option can be used with smbclient to list the resources on a single computer. Assuming the Samba server is configured to take the role of the master browser, we can obtain a list of the computers in the domain or workgroup like this:

$ smbclient -L toltec
added interface ip=172.16.1.1 bcast=172.16.1.255 nmask=255.255.255.0
Password:
Domain=[METRAN] OS=[Unix] Server=[Samba 2.2.5]

    Sharename      Type      Comment
    ---------      ----      -------
    test           Disk      For testing only, please
    IPC$           IPC       IPC Service (Samba 2.2.5)
    ADMIN$         Disk      IPC Service (Samba 2.2.5)

    Server               Comment
    ---------            -------
    MAYA                 Windows 98
    MIXTEC               Samba 2.2.5
    TOLTEC               Samba 2.2.5
    ZAPOTEC              

    Workgroup            Master
    ---------            -------
    METRAN               TOLTEC

In the column labeled “Server”,

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required