findsmb Command in Linux



The Linux findsmb command lists information about machines that respond to SMB name queries on a subnet. The subnet is a segmented part of a large network.

The findsmb command is a Perl script and a part of the Samba suite. This script uses nmblookup and smbclient utilities to get the information.

Table of Contents

Here is a comprehensive guide to the options available with the findsmb command −

Note − The findsmb command has been removed from the amba suite. It is recommended to use the alternative commands such as smbtree, nmblookup, and smbclient.

Prerequisites to Use findsmb Command

The findsmb command is a Perl script and a part of the Samba suite. To use this command, ensure that Samba and Perl are installed on Linux.

To check whether Samba and Perl are installed, use the following commands −

samba --version
perl --version
findsmb Command in Linux1

If the above commands show versions, it indicates that Samba and Perl are installed correctly. If the above commands do not display any output, install these utilities using the instructions below.

To install Samba and Perl on Ubuntu, Debian, and their derivatives, use the commands given below −

sudo apt install perl
sudo apt install samba

To install them on RHEL, use the following commands −

sudo dnf install perl
sudo dnf install samba

Syntax of findsmb Command in Linux

The syntax of the Linux findsmb command is as follows −

findsmb [options] [subnet-broadcast-address]

The [options] field specifies the findsmb command options to modify its behavior. The [subnet-broadcast-address] is an IP address that sends data to all devices on the network.

findsmb Command Options

The options of the findsmb command are listed below −

Option Description
-r It controls whether the command should account for Windows 95 bugs (disabled by default because Windows 95 is no longer in use)
subnet-broadcast-address To specify the broadcast address (Without this option the command will find the subnet information on the device running SMB [values passed to nmblookup -B])

Examples of findsmb Command in Linux

This section demonstrates the usage of the Linux findsmb command with examples −

  • Displaying Subnet of Machines that Respond to SMB Name Query
  • Using findsmb Command with -r Option
  • Using findsmb Command with Broadcast Address

Displaying Subnet of Machines that Respond to SMB Name Query

To display the subnet of machines that respond to SMB name queries, execute the findsmb command without any options −

findsmb

It displays the following information −

  • IP Address (IP ADDR)
  • NetBIOS Name (NETBIOS NAME)
  • Workgroup Name (WORKGROUP)
  • Operating System (OS)
  • SMB Server Version (VERSION)

Here is the sample output of the findsmb command −

findsmb Command in Linux2

The + sign with the workgroup indicates that the machine is the local primary browser for that workgroup. The local primary browser maintains all the machines and shares resources within the local network segment.

The asterisk (*) sign with the workgroup indicates that the machine is the primary domain browser of that workgroup. The domain’s primary browser maintains all the machines and shares resources across the entire domain.

Using findsmb Command with -r Option

To get detailed network information on machines running older versions of Windows (95 or 98), run the command with the -r option −

findsmb -r

Using findsmb Command with Broadcast Address

To display the SMB server on a specific subnet, specify the broadcast address.

findsmb 192.168.23.255
findsmb -r 192.168.23.255

By default, the command finds the information of the subnet of the machine running findsmb.

Alternatives of findsmb Command

Some alternatives of findsmb are listed below −

  • smbtree
  • smbclient
  • nmblookup

Use the smbtree command without specifying any option −

smbtree

To use smbclient, use the -L option to specify the server’s name and -U username.

smbclient -L [server] -U [user]

The nmblookup will be used in the following way −

nmblookup -A [address]

Conclusion

The findsmb command on Linux is used to display a list of machines that respond to SMB name queries. It is a Perl script and a part of the Samba package. It uses nmblookup and smbclient utilities to display the output.

The findsmb command is deprecated; it is recommended to use alternatives such as smbtree, smbclient, and nmblookup.

This tutorial discussed the findsmb command, its syntax, options, and usage in Linux through examples.

Advertisements