Samba+Windows: Allow multiple connections by different users?

Over Samba? There shouldn't be any problems; as long as the username & password are correct both connections should happen correctly.

Update: re: "Error 1219". This is a client-side error -- Windows only allows you to connect to a server as one user at a time. (See Microsoft documentation at KB938120.) This means the Windows machine has already connected as a different user, and so your attempts to connect again, as the correct user, are failing.

You need to disconnect the first connection before you can reconnect. Two ways I know of to do that:

  • Disconnect any reconnect-at-logon network drives from that server. Reboot. Reconnect to the server and make sure you give the proper username and password.

  • Use the net use /delete command from Windows' command shell (Start -> Run -> cmd; at the prompt type the command; you may need to specify a share name).

Update 2: If the users are already connecting to the server with one user, you won't be able to let them connect with a second user. You'll have to reconsider your share strategy, and reconfigure Samba to follow that strategy. (This isn't your fault; I blame Windows.)

Personally, I'd stick with individual users for each person, and consider using groups to control access to the shares. This works well if you have some shares that you want everyone to have read-write access to, and others that you want to be read-only for all but a select few users.

Update 3: The MS document linked above offers these two workarounds to enable connecting to the server as separate users. The general idea is, make Windows think it's connecting to a different server by using a different name.

  1. Use the IP address of the server when you connect with the second username. (Use \\ServerName\sharename when connecting as the first user, but use \\X.X.X.X\sharename when connecting as the second user.)

  2. Create one or more DNS alias(es) for the server to use when you connect with the second (, third, fourth...) username. (Use \\ServerName\sharename when connecting as the first user, but use \\ServerAlias1\sharename when connecting as the second user, \\ServerAlias2\sharename when connecting as the third user, etc.)


This is a solution for Windows 7 (although it might work for other versions as well)

  1. open Notepad (or any text editor) as Administrator
    (you have to right click and say 'run as Administrator')

  2. find : c:\WINDOWS\system32\drivers\etc\hosts (you will need to show all files not only .txt)

Now, if i.e. :
- you have 3 samba users: tom fred jon
- 3 samba shares on your samba server (i.e. IP: 192.168.0.100): docs stuff pics
- you want to connect as tom to docs, as fred to stuff and as jon to pics

Now add the following lines to the hosts file:

192.168.0.100   tomsdocs   tomsdocs
192.168.0.100   fredstuff  fredstuff
192.168.0.100   jonspics   jonspics

Once you close and save you can "Map a network drive" like so:

\\tomsdocs\docs as user tom
\\fredstuff\stuff as user fred
\\jonspics\pics as user jon

Note that the names above are totally up to you ... Whatever you put into the hosts file will need to mach what you call the server when you map the network drive.

The reason this works, is because windows needs to think it is connecting to different servers. Arguably, you could also set up your own home DNS server, but I prefer faking a bunch of entries in the hosts file (which gets evaluated before your windows machine asks the DNS for help).
Since the entire problem is a client side windows problem, I prefer doing it this way.

Hope this helps.