Multiple Shares - same PC

Status
Not open for further replies.

MillerHL

Cadet
Joined
Feb 25, 2013
Messages
3
So, I got Freenas up and running -

I have set two 10G Shares so far. Both are acessable across my Domain and any local Workgroup across 3 Subnets, no issues.

My only issue is from any one PC I can only open one share at a time. Connect as in accessable - I can map both, but any time only one is acccessable -

I created indivdual users with passwords - testing individually is fine - just when I got to try to open both on the same PC. The first one connected will be fine, the second shows as mapped, connected but is unable to open. Once I dissconnect the first I can open the second.

Sorry - these are Windows CIFS Shares..

Not so much an issue thus far, as the shares are individual to a specific user - but curious george has got me here -

Thanks in Advance -

Thoughts?
 

JaimieV

Guru
Joined
Oct 12, 2012
Messages
742
Windows seems to default to "only one set of user credentials per server", if you're just browsing using Explorer.

You should be able to connect as two different FreeNAS users by either cheating and connecting once by hostname and once by IP, or by using the "connect with different credentials" panel (right click on a share instead of just clicking then authenticating), or by using the cmd prompt and "net use x: \\servername\share /user:domain\username"
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Windows seems to default to "only one set of user credentials per server", if you're just browsing using Explorer.

You should be able to connect as two different FreeNAS users by either cheating and connecting once by hostname and once by IP, or by using the "connect with different credentials" panel (right click on a share instead of just clicking then authenticating), or by using the cmd prompt and "net use x: \\servername\share /user:domain\username"

Hold on a second. So if I do:

net use r: \\FreeNAS\share1 /user:domain\username1
net use s: \\FreeNAS\share2 /user:domain\username2
net use t: \\FreeNAS\share3 /user:domain\username3
net use u: \\FreeNAS\share4 /user:domain\username4

in a .bat file in Windows it will succeed? With all 4 shares?
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
Hold on a second. So if I do:

net use r: \\FreeNAS\share1 /user:domain\username1
net use s: \\FreeNAS\share2 /user:domain\username2
net use t: \\FreeNAS\share3 /user:domain\username3
net use u: \\FreeNAS\share4 /user:domain\username4

in a .bat file in Windows it will succeed? With all 4 shares?

yep

i had a .bat file that ran on startup for some of my users after a file share migration to a new domain. essentially did that exact thing, but it prompted the user for their old login credentials because of differing domains during the transition.

then i made an exe GUI for it to simplify things for the user and make it more friendly than a command line 'dos box'
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Outstanding! I'll definitely have to keep that in mind for the future. Of course, I'm starting to migrate from Windows 7 to Linux Mint myself, but friends still use Windows and that may come in handy.
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
Here is the basic .bat i created for startup for users:
Code:
@echo off
::-----------------------------------------Selectuser----------------------------------------
:selectuser
CLS
@COLOR 17
ECHO *************MAPPING SHARED DRIVES*************
ECHO ...............................................
ECHO put your domain username
ECHO Example..
ECHO firstname.lastname
ECHO Do not include a domain (@example.com, example\)
ECHO ...............................................
ECHO.
SET /P user=Type in your domain username, then press ENTER:

net use /delete S:
net use /delete U:
net use /delete P:

net use S: \\servername.example.com\share /user:domain\%user% /persistent:yes
net use U: \\servername.example.com\Users\%user% /user:domain\%user% /persistent:yes
net use P: \\servername.example.com\Public /user:domain\%user% /persistent:yes


HERE is the HTA I created that I converted to exe:
Code:
<HTML>
 <head><title>Drive Mapper</Title>
 <HTA:APPLICATION
  APPLICATIONNAME="Drive Mapper"
  ICON="/path/to/file.ico"
  SCROLL="auto"
  SINGLEINSTANCE="yes"
  NAVIGABLE="yes"/>
	 <META HTTP-EQUIV="MSThemeCompatible" CONTENT="Yes">
 </Head>
 <Script Language="VBSCRIPT" Type = "text/vbscript">
 Sub Window_Onload
	Window.resizeTo 600,480
	call ShowDrives
	call AreYouConnected
 End Sub

 Sub CloseWindow
    self.close
 End Sub
  
 Sub Reload
    Location.Reload(True)
 End Sub
 
 Sub AreYouConnected
    blnAnswer = window.confirm("If you are connected to the network or VPN, please click OK.  If you do not want to connect to your share drives at this time, just hit cancel.  If you are working remotely, you can launch your VPN client before clicking OK.")
    If blnAnswer Then
        
    Else
		CloseWindow
    End If
End Sub

 FUNCTION ShowDrives
 DispDrives.value = ""
 Set objFSO = CreateObject("Scripting.FileSystemObject")
 Set colDrives = objFSO.Drives
 For Each objDrive in colDrives
    If objDrive.IsReady = True Then
       DispDrives.value = DispDrives.value & vbcrlf & objDrive.path & " " & objDrive.sharename
    End If  
 Next
 END FUNCTION

FUNCTION MapPDrive
	On Error Resume Next
	Set objNet = CreateObject("Wscript.Network")
	objNet.RemoveNetworkDrive "P:"
	objNet.MapNetworkDrive "P:", "\\server.example.com\public", True
	call ShowDrives
END FUNCTION
 
FUNCTION MapSDrive
	On Error Resume Next
	Const WINDOW_HANDLE = 0
	Const OPTIONS = 0
	Set objShell = CreateObject("Shell.Application")
	Set objFolder = objShell.BrowseForFolder _
    (WINDOW_HANDLE, "Select a folder:", OPTIONS, "\\server.example.com") 
	If objFolder Is Nothing Then
		Wscript.Quit
	End If
	Set objFolderItem = objFolder.Self
	objPath = objFolderItem.Path
	
	Set objNet = CreateObject("Wscript.Network")
	objNet.RemoveNetworkDrive "S:"
	objNet.MapNetworkDrive "S:", objPath, True
	call ShowDrives
END FUNCTION

FUNCTION MapUDrive
	On Error Resume Next
	Const WINDOW_HANDLE = 0
	Const OPTIONS = 0
	Set objShell = CreateObject("Shell.Application")
	Set objFolder = objShell.BrowseForFolder _
    (WINDOW_HANDLE, "Select a folder:", OPTIONS, "\\server.example.com\users") 
	If objFolder Is Nothing Then
		Wscript.Quit
	End If
	Set objFolderItem = objFolder.Self
	objPath = objFolderItem.Path
	
	Set objNet = CreateObject("Wscript.Network")
	objNet.RemoveNetworkDrive "U:"
	objNet.MapNetworkDrive "U:", objPath, True
	call ShowDrives
END FUNCTION

FUNCTION DisconnectDrives
	On Error Resume Next
	blnAnswer = window.confirm("Are you sure you want to disconnect all network mapped drives?")
	If blnAnswer Then
	DIM objNetwork,colDrives,i
	Set objNetwork = CreateObject("Wscript.Network")
	Set colDrives = objNetwork.EnumNetworkDrives
	For i = 0 to colDrives.Count-1 Step 2
	' Force Removal of network drive and remove from user profile 
	' objNetwork.RemoveNetworkDrive strName, [bForce], [bUpdateProfile]
	objNetwork.RemoveNetworkDrive colDrives.Item(i),TRUE,TRUE
	Next
	call ShowDrives
	Else
	
	End If
END FUNCTION

intButtonCount = 1

	Sub AddDriveLetter
	Set OFS = CreateObject("Scripting.FileSystemObject") 
	For x = 65 To 90 
	Select Case Chr(x) 
	Case "A", "B", "C", "D", "P", "S", "U" 
	Case Else 
	If oFS.DriveExists(Chr(x)) = False Then 
		MapLtr = Chr(x) 
	End If 
	End Select 
	If IsEmpty(MapLtr) = False Then 
    Exit For 
	End If 
	Next 
        strHTML = DataArea.InnerHTML       
        strHTML = strHTML & "<input id=" & intButtonCount & " type=" & Chr(34) & "button" & Chr(34) & _
            " value= " & Chr(34) & "Map Drive " & MapLtr & Chr(34) &" onClick=" & Chr(34) & _
                "NextDriveSubRoutine" & Chr(34) & ">"
        DataArea.InnerHTML = strHTML
        intButtonCount = intButtonCount + 1
    End Sub

    Sub NextDriveSubRoutine
        Set objButton = window.event.srcelement
        strID = objButton.id
        On Error Resume Next
	Set OFS = CreateObject("Scripting.FileSystemObject") 
	For x = 65 To 90 
	Select Case Chr(x) 
	Case "A", "B", "C", "D", "P", "S", "U" 
	Case Else 
	If oFS.DriveExists(Chr(x)) = False Then 
		MapLtr = Chr(x) 
	End If 
	End Select 
	If IsEmpty(MapLtr) = False Then 
    Exit For 
	End If 
	Next 
		
	Const WINDOW_HANDLE = 0
	Const OPTIONS = 0
	Set objShell = CreateObject("Shell.Application")
	Set objFolder = objShell.BrowseForFolder _
    (WINDOW_HANDLE, "Select a folder:", OPTIONS, "\\server.example.com") 
	If objFolder Is Nothing Then
		Wscript.Quit
	End If
	Set objFolderItem = objFolder.Self
	objPath = objFolderItem.Path
	
	Set objNet = CreateObject("Wscript.Network")
	objNet.RemoveNetworkDrive MapLtr
	objNet.MapNetworkDrive MapLtr & ":", objPath
	call ShowDrives
	End Sub


'===============================================================================================
'CREATES ENTRY IN EVENT VIEWER FOR ERROR LOGGING PURPOSES
'-----------------------------------------------------------------------------------------------
Set oShell = CreateObject("Wscript.Shell")
Const EVENT_SUCCESS = 0
Const EVENT_FAIL = 1
if err.number <> 0 then
  oShell.LogEvent EVENT_ERROR, "Drive Mapping Script Exited With An Error." & vbcrlf & "Error Number: " & err.number & vbcrlf & "Error: " & err.description
else
   oShell.LogEvent EVENT_SUCCESS, "Drive Mapping Script Completed Successfully."
end if

'==============================================================================================

 </Script>
 
 <BODY STYLE="font:14 pt calibri medium; color:white; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr='#4169E1', EndColorStr='#1E90FF')">
 <div style="width:100%; float:left">
 <input style="width:100%; padding:7px;" type="BUTTON" value="Disconnect all mapped drives" onclick="DisconnectDrives">
 <div align="center"><input style="width:32%; padding:7px;" type="BUTTON" value="Map S Drive" onclick="MapSDrive"> <input style="width:32%; padding:7px;" type="BUTTON" value="Map U Drive" onclick="MapUDrive"> <input style="width:32%; padding:7px;" type="BUTTON" value="Map P Drive" onclick="MapPDrive"></div>
 <input style="width:100%; padding:7px;" id=addbutton type="button" value="Add Next Available Drive Letter" onClick="AddDriveLetter">
 <span id=DataArea></span>
 <br />
 Currently connected to:
 <textarea name="DispDrives" style="width:100%;" rows="7"></textarea>
 </hr>
 <div align="center"><input style="width:50%; padding:7px;" type="BUTTON" value="Done Mapping Drives" onclick="CloseWindow"> <input style="width:49%; padding:7px;" type="BUTTON" value="Try Again" onclick="Reload"></div>
 </div>
 <div style="width:100%;">
 <input style="width:100%; padding:7px;" type="BUTTON" value="Printer Install" onclick="InstallPrinters">
 </div>
 </body>
 </html>
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Code:
@echo off
::-----------------------------------------Selectuser----------------------------------------
:selectuser
CLS
@COLOR 17
ECHO *************MAPPING SHARED DRIVES*************
ECHO ...............................................
ECHO put your domain username
ECHO Example..
ECHO firstname.lastname
ECHO Do not include a domain (@example.com, example\)
ECHO ...............................................
ECHO.
SET /P user=Type in your domain username, then press ENTER:

net use /delete S:
net use /delete U:
net use /delete P:

net use S: \\servername.example.com\share /user:domain\%user% /persistent:yes
net use U: \\servername.example.com\Users\%user% /user:domain\%user% /persistent:yes
net use P: \\servername.example.com\Public /user:domain\%user% /persistent:yes

That isn't the same as what I just said. You used the same username for multiple shares on the same server. My example has you connect to multiple shares on the same server using a different username for each one. There's a big difference there. That difference is what got my attention. I thought I made this difference clear with username1, username2, username3, and username4.

If I try to setup a network mapping in Windows to //FreeNAS/tank and to //FreeNAS/Movies and each requires a different username then one of them must be mapped to //SERVER.IP.ADDRESS.HERE/Movies and the other can go to //FreeNAS/tank. If you don't you will get the error "The network folder specified is currently mapped using a different user name and password." This is well documented and has been an issue with every version of Windows since at least 2000(not sure about Win8, but I'd assume its the same). See http://support.microsoft.com/kb/938120. This is not a bug and is by design(as the KB also says).

This got my attention because it appeared that you had demonstrated a way to circumvent this limitation that is not documented by Microsoft. Unfortunately, if you read the KB the solution is to make a bunch of DNS aliases(stupid idea in my opinion and can be prohibitive and complex if you want a whole bunch of different users) or use the IP address(which then limits you to just 2 users).
 

Caesar

Contributor
Joined
Feb 22, 2013
Messages
114
OMG! for the last two days this issue has been driving me crazy. I got windows 7 and created two shares with different accounts. The first account was working fine the first time I used it, then a few days later I would get a permissions error when tying to connect to the share. I tried everything from deleting/creating the share then the user accounts. I built a freenas on VMWare and it happen there too. It wasn't until I chmod 777 to the shared drive and then check the file's owner that I realized that Windows was using a different username than the one I enter when prompted.

Sorry for the rant I just hate stupidity and I see no reason why Microsoft would design network authentication to behave like this.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
It has to do with how security is handled internally in Windows. You are allowed 1 username per machine you connect to. So using \\server and \\192.168.0.x are considered two different servers.

Internally to Windows, the reason has to do with preventing cross pollination of permissions on one machine. Not sure why the haven't found a way to fix this. I can map to 10 different shares on the same server with 10 different usernames on Linux without issues. :P
 
Status
Not open for further replies.
Top