28

I have a machine running Ubuntu with Samba that I use to share stuff with my family's Windows machines in our local network. Currently they access a share for movies/music/etc with one user.

I want to connect them to another share as a different user (for example, user "goytacaz").

When I try connecting to this new share, Windows gives me "Error 1219" and complains about multiple connections by the same user.

How do I get my machine to accept multiple connections by the same user?

1
  • Are you just looking to connect using samba? Samba already supports this AFAIK.
    – heavyd
    Jan 14, 2010 at 17:32

6 Answers 6

33

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.)

3
  • 1
    Thank you for this answer. I had the same issue, and connecting using the server's IP address instead of DNS name worked for me for the second connection.
    – Ben Torell
    May 25, 2010 at 15:43
  • I tried using the workaround on Win10 with no success. Still got errors 86 and 1219. Jun 18, 2020 at 18:45
  • How to create one or more DNS aliases? Do we do it on the server (Raspberry Pi with Debian) or on the Windows client?
    – bomben
    Oct 10 at 13:54
10

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.

3
  • This worked like a charm! Fiddled for an hour with the samba share on the server until I found this - Thanks :) Sep 2, 2013 at 23:19
  • Thank you for this. I hate having to work around the new crap the Microsoft spews out, but this is elegant if not goofy... works great!
    – SuperJames
    Sep 5, 2015 at 18:09
  • 1
    Curious though, are double names a typo? Why would you use the exact same ones twice for the same IP?
    – user93175
    Mar 9, 2016 at 21:51
9

If you prefer to not fiddle with each client to solve a server issue, you can use the smb.conf file to setup name aliases for the server. This has the added benefit of each alias showing up as distinct server in the Windows Network.

Edit your smb.conf file and add the following entry in the [global] section:

[global]
...
netbios aliases = alias1 alias2 readonly


After a restart of samba (remember to restart smbd AND nmbd!) you should be able to access the new server aliases using UNC notation in the Windows Explorer.
Note that it might take a little time, at my site about 1 Minute after the samba-restart, for them to work.
Once the aliases show up in the Windows Network you're definitely good to go.

1
  • Great solution. No DNS entry needed for the netbios alias. Aliases list does not include hostname, only additional aliases. See also %L mechanism.
    – weberjn
    Oct 8, 2021 at 10:49
3

use the IP address (or host name if you use the IP address) of the server

http://support.microsoft.com/kb/938120

2

i was just having the same issue.

for one user i use: \192.168.x.x <-- IP of the ubuntu server for the other user: \server-name <-- hostname of the ubuntu server.

this allowed me to connect with a windows machine using different logins.

1

Use netbios alias samba option:

netbios name = share1
netbios aliases = share2

windows will "see" 2 different samba servers and you can connect to both share with different user authentication

You must log in to answer this question.