Thursday 2 October 2014

Windows 7 refuses to reconnect to Samba after reboot

Faaaaaark! I have been fighting this off and on now for weeks.

The scenario is this:

The network is a Windows domain. Let's call the domain "WINDOZESUX"

I have a Linux host running Samba that is not a domain member. Let's call it "sambaserver"

sambaserver is configured with:

workgroup = WINDOZESUX

Result: Windows 7 client can successfully mount \\sambaserver\share

That's cool.

Move forward until one of the Windows 7 clients reboots.

Result: Windows 7 client cannot reconnect to the samba share "The user name is not found"

Solution: Delete the saved credentials on the Windows client

Result: Windows 7 client can successfully mount \\sambaserver\share

Rinse, lather repeat.

Much troubleshooting follows. Eventually I had a dim recollection that I had "fixed" this once before by using an IP address instead of DNS

Solution: Use an IP address in the UNC path

Result: Windows 7 client can successfully mount \\1.2.3.4\share

Reboot and the share connects automatically without trouble. yay

Now, I was going to leave it at that (and I have for a while) but I really don't want to hard configure IP addresses all over the place because it can become a management disaster for the future.

Now, I have spent hours googling, found thousands of posts for basic errors such as noobs who just didn't have their DNS configured properly at, also a bunch of other posts suggesting that the share was trying to reconnect before the network adapter had come up which plainly was not the case because it worked fine with an IP address. No it was something do with DNS or WINS resolution. Or so I thought.

Suffice to say I spent a lot of time mucking about with WINS, DNS and SAMBA configurations and nothing made a lick of difference.

Eventually while clutching at straws I changed the sambaserver configuration to:

workgroup = LINUXROX

Went through the rinse, lather and repeat process and still it behaved in the same infuriating fashion.

Then while I was poking around in the Windows credential manager, about to delete the credential for the hundredth time, I clicked on "Edit credential"

Lo and behold, the username in the credential manager was shown as WINDOZESUX\username where I am sure the last time I had connected to the share it was using LINUXROX\username

Hmmm. So I changed the entry in the credential manager to the correct LINUXROX\username and rebooted again.

Result: Windows 7 client successfully remounts \\sambaserver\share

FFS. So it appears Windows has a bug (which knowing Microsoft may in fact be a feature) where when you connect to a non domain share from a domain member it does it correctly but when it saves the credentials it goes and changes the goddamned domain from the one you had specified to the domain that the client is on. But it only does that when you use a DNS name. When you use an IP address it works fine. Who knows why? Will Microsoft fix it? Why would they. They might however put up a technet article one day suggesting the solution is to buy a windows server you smelly Linux user.

God I hate Microsoft crap.

In other news, Bordlerlands 2 was just released on SteamOS/Linux!

No comments: