Windows or SAMBA – who do you blame?

Ubuntu (Linux distribution)

WARNING: very dull techie post coming up. You have been warned.

Had a problem yesterday trying to get a SAMBA share on our Ubuntu box to allow access to one of the PCs. The solution is very simple and I notice a lot of other people online had this issue so I’ll detail it here. Hopefully someone might find it and it’ll be of use.

Our scenario is one Ubuntu machine running as a file-sharer / backup box / web server and several Windows XP desktops. SAMBA controls around half a dozen shares, all bar one of which are publicly read/writeable with no logins required. The other requires a login because it contains accounts data. If anyone wants to see the smb.conf for that, then just ask.

The problem I had was just after I copied all our accounts data from a shared desktop drive to the Ubuntu share. The idea is to get rid of those constant cries round the office of “is anyone in the accounts share? Can you log out because it won’t let me in!” and also to provide some security as well as data redundancy. I copied said files, then went to one of the desktops to access the share and ensure it worked. This PC had already attached with no issues to a handful of the other (insecure) shares.

I added a Network Place of \servernameaccounts and double-clicked. Up popped the password prompt, username and password entered… the usual Microsoft networking pause… and:

Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed.

Bugger. I went back to the server and checked the permissions. Then I looked at the message. It’s telling me about users. So I created another user with similar permissions and tried to log on again. Same problem. Then I looked at the error again. Carefully.

It’s a Windows error, not an Ubuntu or SAMBA one. It’s complaining that this user – the one on the XP box – is trying to access the server twice with different usernames. Which he (in this case) isn’t allowed to do. He’s connected as “nobody” to access the insecure shares, and now I’m trying to connect him as “accounts” to get to the secure one. This has to work as some staff will need simultaneous access to both types of share. Windows has no functionality to “log off” network shares – even a reboot doesn’t always disconnect it, though I’m aware of a registry key fix that solves this.

A dig on the internet offered a few clues, most relating to deleting permanent net shares and mapped drives. Then I spotted something ridiculously simple. Windows itself is what’s preventing you doing this. It stores the name of the server you’re accessing and the user name you’re connecting with. If you make another connection to “servername” with a different “username” without ditching the first, then the error appears.

Thing is, it’s very literal how it stores the server name. And it seems there’s no genuine reason why you shouldn’t be able to connect twice. Windows just stops you. I assume you need a “better” version of Windows to be allowed to do it or something (like the inbuilt crippling of filesharing in the desktop versions, limiting the number of connections so you have to move to a server OS).

So you should be able to connect, but Windows stops you. So how do you get around it? It’s stupidly simple, really. Refer to the server differently.

For all the insecure shares I’ve now got all the PCs configured to go to \servernamesharename.

For the secure share it’s \server-IP-addresssharename.

Easy as that. Same server, two ways to refer to it, error ignored, two fingers up at a pointless restriction. I’m curious to see if mucking about with the hosts file would allow infinite connections to the server, by providing multiple aliases for the same IP address.

Anyway, problem solved and another step closer to heading home in a couple of weeks.

2 thoughts on “Windows or SAMBA – who do you blame?”

  1. Brilliant!!

    Helps me tons in tooling around with ubuntu server and samba on my xp box. great!

  2. Glad to help, KJ. It took me so long to figure out what ended up being a simple solution it made sense to put it up here. I hope more people in need find it.

    Now, will someone get me a working Ubuntu driver for a Broadcomm wifi card? Please?!

Leave a Reply

Your email address will not be published. Required fields are marked *