Map network drive, connect as different user to same Server

I ran into an interesting problem today. I was helping someone configure Samba and had shown him the XP/2000 trick of mapping a network drive and having it connect as a different user. He then wanted to map another network drive to another share on the same server, but this time connect as an entirely different user.

Windows won’t do that. You can’t use different credentials to connect to different shares on the same server. Once you provide a username and password for an smb server, Windows XP/2K wants to use that for ALL shares on that server.

That’s actually a useful feature. For example, I use that to connect printers that otherwise would need authentication. By mapping a share that reconnects at logon, the printers are automatically available because attempting to connect to them will automatically use the same logon/password as the mapped drive did.

But darn it, this person really needed to connect multiple times with different user ids. After some digging, we figured out how to do it: fool Windows into thinking it isn’t the same server. One way to do that is to use the ip address for one connection and the smb name for the other, but that only gives you two connections. To get more, you need to add aliases into DNS and configure Samba with the same netbios aliases. With that trick, Windows happily makes multiple connections with different user name/password logons. Basically, it doesn’t realize that it is connecting to the same machine.

See for an explanation of how Windows decides what credentials to use.