Saturday, August 4, 2012

Fix slow connection to windows shares in Ubuntu 12.04

I had this annoying issue with my Ubuntu 12.04; it wouldn't connect sometimes to a NAS system in my network. Sometimes it would, other times it would say can't connect to share. I was pulling my hair (what ever is left after all those years in IT support) when finally I found a mention to the same problem online. Now there were a few suggestions that unfortunately didn't work for me. At the end I did a bit of mix and match and I got a solution:

open a terminal window and type the following:
sudo apt-get install smbfs winbind


Next type in:
sudo gedit /etc/nsswitch.conf
to open the nsswitch file for editing

There is a line showing the following:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

change it by adding the word 'wins' before the 'dns' like so:
hosts: files mdns4_minimal [NOTFOUND=return] wins dns mdns4


One quick reset later, and my Ubuntu would connect to the share straight away!

I would like to thank all the people that contributed to this solution. Unfortunately I can't remember all the web sites I got ideas from, so a big THANK YOU to each and all of you.