I would like to show all available samba shares in my local network ( if I'm correct in specifying the network mask).

I've searched on this issue and tried things like smbtree, findsmb, which returned nothing, and nmblookup -S '*', which returned

name_query failed to find name *

Seems like these commands worked in the past. I know that Samba shares exist on my network and I'm using some of them, but I would like to, for example, know the local IP address of my printer. So I'm wondering if there is a way to do this local network scan using standard Linux tools. If not, then I'd appreciate another tool suggestion.


Try using nmap with the smb-enum-shares script, like so:

nmap -p139,445 --script smb-enum-shares.nse --script-args smbusername=<USERNAME>,smbpass=<PASSWORD> <IP_OR_NETWORK>

You can leave out the part

--script-args smbusername=<USERNAME>,smbpass=<PASSWORD>

if you don't have any specific credentials.



Those commands have fallen into disuse, with some secret parameters not being maintained by new Linux developers.

The following command used to work but I couldn't make it work any more. It might still work on some distributions:

nmblookup -S __SAMBA__

This one still works but not as good as before:

nmblookup -S WORKGROUP

If you wish to explore the network, you could start by nmapping and looking for open port 139, assuming our LAN is and we have 6 computers:

nmap -sS -O -p 139

Once you know all the servers having the SAMBA port open, the next stage is to find out what these machine's Netbios names are. We'll start with the machine at

nmblookup -A -N

Now that we've got the computer name, say COMPX, to investigate its shares use the diagnostic program smbclient with the -N flag to suppress the password prompt (password not required):

smbclient -L \\COMPX -I -N

(The above programs might be different on various Linux distributions.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.