Nautilus and Windows shares: wins for the win!

Being one of the very few Linux users in a Windows ecosystem is always a source of little niggles which are annoying but often educational.

Last week, I managed to finally solve a problem I've had for months - reliable mounting of Windows shares on my Fedora workstation.  

Despite having all the required libraries installed and configured (samba etc.), sometimes Nautilus would take 20 minutes (!) to load while trying to connect to my shared drives.  Sometimes it would fail altogether.  And other times it would work perfectly. Sometimes it would fail to start, then open the instant I disconnected my VPN.  Other times it would only work the instant I connected my VPN.  Whether drives would remount after a suspend seemed to depend on local meteorological conditions and my horoscope.  The problem was so changeable that I had real problems working out the issue, or even how to start researching it.

Anyway: once the problem was identified as being netbios, the final solution came from the following blog:

http://charlieharvey.org.uk/page/slow_nautilus_browse_with_netbios

All that was required was editing /etc/nsswitch.conf to change the line

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

to

hosts: files wins mdns4_minimal [NOTFOUND=return] dns mdns4

i.e. adding wins support high enough up the priority list.

Looking around support forums this seems like a common problem, but the solution is not so well-known.  Hopefully another blogpost will help spread the news.