smbtree
Browse Samba/Windows network resources
SYNOPSIS
smbtree [options]
PARAMETERS
-N
Do not ask for a password. Useful for anonymous browsing of shares.
-U
Specifies the username and optionally password to use for authentication. If password is not provided, it will be prompted interactively.
-W
Specifies the workgroup or domain to which the username provided with -U belongs.
-S
List only servers (not shares or domains/workgroups).
-D
List only domains/workgroups (not servers or shares).
-P
Probe all shares to determine if they are print shares. Can be slow.
-b
Broadcast on all interfaces to find shares. Useful for discovering services across different subnets.
-I
Connect to the specified IP address directly, bypassing NetBIOS name resolution for the target.
-n
Connect to the specified NetBIOS name of a server or domain.
-T
Set the tree level of detail to display. Higher numbers show more detail (e.g., -T 1 for workgroups, -T 2 for servers, -T 3 for shares).
-d
Set the debug (log) level. Ranges from 0 (no debug) to 10 (full debug).
DESCRIPTION
smbtree is a command-line utility from the Samba suite that allows users to explore network resources using the SMB/CIFS protocol. It displays a hierarchical tree structure of the network, showing workgroups or domains, the servers within them, and the shared resources (disks, printers) available on those servers. This tool is invaluable for network administrators and users to discover available shares without needing to map them directly, providing a quick overview of accessible network assets. It relies on NetBIOS over TCP/IP to discover services and can be used to list anonymous shares or those requiring specific user credentials.
CAVEATS
Requires Samba client tools to be installed on the Linux system.
Network connectivity to the target SMB/CIFS servers is essential, and relevant firewall ports (137/udp, 138/udp, 139/tcp, 445/tcp) must be open.
Authentication is often required to view resources beyond publicly accessible shares.
Can be slow on large or poorly configured networks due to reliance on broadcast lookups for discovery.
USAGE EXAMPLE
To list all shares in your current workgroup/domain without a password prompt (if anonymous access is allowed), you can simply run: smbtree -N
To list shares on a specific server named "MYSERVER" using a username "myuser": smbtree -n MYSERVER -U myuser
You will then be prompted for the password for "myuser".
OUTPUT STRUCTURE
The output is typically an ASCII tree, showing the network hierarchy. A common path would be: \WORKGROUP_OR_DOMAIN\SERVER_NAME\SHARE_NAME
Shared resources are usually prefixed to indicate their type, such as 'Disk' for file shares and 'Printer' for print shares.
HISTORY
smbtree is an integral part of the Samba suite, an open-source implementation of the SMB/CIFS networking protocol for Unix-like operating systems. Samba was initially developed by Andrew Tridgell in 1992 to allow Unix machines to share files with Microsoft Windows.
smbtree emerged as a utility within this suite to provide command-line network browsing capabilities, offering a text-based alternative to Windows' graphical "Network Neighborhood" or "Network" browsing. Its development has mirrored Samba's evolution, maintaining compatibility with various Windows and SMB server versions over the decades.
SEE ALSO
smbclient(1), nmblookup(1), testparm(1), mount.cifs(8)