smbtree - Discovering Windows Shares

Posted by JD 12/11/2012 at 00:00

If you use Linux for any time, you’ll probably need or want to connect to MS-Windows shares at some point using Samba. While it has become easier to point-n-click a connection, sometimes we want to use other connection tools to have the SMB share connected even when we are not logged in, but the machine is running.

Knowing which shares are available is the first step. Normally, I’d attempt to use

smbclient -u windows-user -L //server/
to discover shares on a specific server. There’s an easier way.

 $ smbtree -U windows-user

This will check the entire subnet for guest and user specific connections on all servers. The output list is easy to read and includes any CUPS printer shares.

As always, to learn more, just check the man page – man smbtree

An old dog can be taught a new trick.