I recently hit an exciting and hard to solve problem at work, or at least my colleague and co-web wrangler did. You see at New Internationalist our office network is a mix of *nix, windows and mac machines. We use various Samba servers to host all our documents. So its pretty important to browse the network to find the various samba and windows shares. My colleague was using a stock ubuntu install with Gnome 3 as his desktop manager. Try as we might we couldn’t make his nautilus file manager play nice with the smb shares.
The obvious thing to do would be to mount the shares with cifs. And we did that for the main common drive.
mount -t cifs -o guest //theserver/share /mnt/shareddrive
But that doesn’t solve the browsing problem and is a faff to maintain (say we change server name?) We spent several hours looking round at various forums. Interestingly my debian machine seemed much happier despite squeeze’s venerable age. After fiddling with samba configs and noodling around for some time it eventually turned out that there was a straightforward fix.
We had worked out that the problem must be with NETBIOS name resolution, as not only my colleague’s nautilus, but also an smbtree on the commandline were slow. So we needed to change the order of the name lookups in nsswitch.conf. It turns out that his configuration contained a line like this.
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
Clearly mdns4_minimal is a bit shit at doing NETBIOS name resolution, or perhaps that is because we are using WINS in our workplace. Simply adding a "wins" to the hosts line cured the problem.
hosts: files wins mdns4_minimal [NOTFOUND=return] dns mdns4
The winbindd manpage indicates that you can get away with just files and wins, but this would presumably mean a less rich internet experience what with having no DNS and all!