I was wondering if there is a way of listing all the smb servers on a local network (like looking at a network neighborhood in windows) via the command line in fedora.
Samba – Listing available smb shares on a network through the command line in linux
fedorasambaserver-message-block
Related Topic
- Linux – Unable to open a Linux SMB share from the domain controller
- Linux share (samba), how to list all shares with the path to local directory actually shared
- Samba – Delete files from command line using smb:// URL
- Linux – Can’t access SMB shares on Windows but can on Linux
- Linux – Small writes to SMB network share are slow on Windows, fast over CIFS Linux mount
- Linux – Change Windows ACLs of SMB Samba Shares – directly in linux
Best Answer
This command is a very little known secret of Samba. It returns IP adresses of all Samba servers in one's own broadcast domain:
nmblookup __SAMBA__
This one returns a list of all NetBIOS names and their aliases of all Samba servers in the neighbourhood (it does a 'node status query'):
nmblookup -S __SAMBA__
This one returns a list of all IP adresses of SMB servers (that is, Linux+Unix/Samba or Windows) in the neighbourhood:
nmblookup '*'
Finally, all NetBIOS names and their aliases of all SMB servers (Linux+Unix/Samba or Windows):
nmblookup -S '*'
The command given in the other answer
nmblookup -S WORKGROUP
does NOT return all Samba or all SMB servers from the neighbourhood. Instead, it returns all servers' NetBIOS names who happen to be members of a workgroup named 'WORKGROUP'. The results are independent of the servers' OS (wether that is Windows, or wether that is Linux/Samba) -- and it is a well known fact that sometimes lots of Windows member server are part of a Samba-controlled domain or workgroup. [Yes, it happens that Samba's default workgroup name is 'WORKGROUP'... but so what??]. -- But the question was 'How do I get to know all SMB (Samba?!?) servers in my network neighbourhood?'