[Samba] Getting a list of all possible smb mounts

Bernhard Rosenkraenzer bero at arklinux.org
Sat Oct 18 10:26:02 GMT 2003

I'm currently doing this to get a list of all possible SMB mounts:

nmblookup -M -- -		[grab list of master browsers]
for every master browser:
	smbclient -L {MASTER BROWSER IP} -U user%pass
	* Parse everything after "Workgroup.*Master" to get list of
	  workgroups and workgroup masters
for every found workgroup master:
	smbclient -L {WORKGROUP MASTER IP} -U user%pass
	* Parse everything between "Server.*Comment" and 
	  "Workgroup.*Master" to get list of hosts
for every found host:
	smbclient -L {HOST} -U user%pass
	* Parse everything between "Sharename.*Type.*Comment" and 
	  "Server.*Comment" to get available mounts

This mostly works, but has a couple of problems, such as
* smbclient -L some_ip -U user%pass apparently hangs for 10+ minutes
  if some_ip belongs to a Windoze box with a paranoid firewall
  [Tried with 2.2.8a, 3.0.0, 3.0.1pre1 and current CVS 3.0 branch]
* smbclient -L {WORKGROUP MASTER IP} -U user%pass doesn't always find
  all machines in the workgroup, and sometimes finds machines that
  have been turned off ages ago (I know this isn't samba's fault).

Is there a better way to get a list of available SMB mounts, or at least a 
workaround for the long hangs?


Ark Linux - Linux for the masses

Redistribution and processing of this message is subject to

More information about the samba mailing list