How Do I Make It So That I Have To Re-Enter My Login Credentials To Access SMB In Windows 10?

Status
Not open for further replies.

ArcticWolf_11

Dabbler
Joined
Aug 24, 2017
Messages
28
Hello, very new to FreeNAS and just made a box with it. So I have it all set and I can see and copy files to it and I have it listed as a network location under all my internal drives. What I want to know is that if I am able to make it so that if I turn the box off or restart it. I would need to re enter my password for the root user in order to access the drive/smb share. Is this possible in FreeNAS or is it a windows thing that saves my password every time and I can't find a checkbox to make it not do that so I don't know. Once again, very new to FreeNAS so please explain what I need to do step by step. Thanks!
 

Artion

Patron
Joined
Feb 12, 2016
Messages
331
If you use the same credentials for FN root user and Windows user, then it automatically authenticates when you acces the share. But you probably have saved the FN credentials in Windows. Make sure to untick the "Save credentials" option when you autheticate on the share. Maybe this or this can help.

windowsvault_credential_manager_big.jpg


windows-credentials.png
 

ArcticWolf_11

Dabbler
Joined
Aug 24, 2017
Messages
28
If you use the same credentials for FN root user and Windows user, then it automatically authenticates when you acces the share. But you probably have saved the FN credentials in Windows. Make sure to untick the "Save credentials" option when you autheticate on the share. Maybe this or this can help.

windowsvault_credential_manager_big.jpg


windows-credentials.png
Thanks but I don't see my FreeNAS box on there nor did I checkmark the "save credentials" box. I did map it as a network drive however. Any other ideas that you may have?
 
Last edited:

Artion

Patron
Joined
Feb 12, 2016
Messages
331
Was it a message like these ones?

upload_2017-8-24_13-57-22.png


upload_2017-8-24_13-57-54.png


BTW, what is the username you use in Windows?

Maybe you have set permissions on the share to the nobody user on FN, that is Everybody in Windows. If that is the case, you have to change the permissions so that only authorized users can access the share.
 
Last edited:

Artion

Patron
Joined
Feb 12, 2016
Messages
331
Look at the tab of the shares, Allow Guest Access and Storage -> Dataset permissions

upload_2017-8-24_14-10-44.png


upload_2017-8-24_14-12-45.png
 

ArcticWolf_11

Dabbler
Joined
Aug 24, 2017
Messages
28
Was it a message like these ones?

View attachment 20274

View attachment 20275

BTW, what is the username you use in Windows?

Maybe you have set permissions on the share to the nobody user on FN, that is Everybody in Windows. If that is the case, you have to change the permissions so that only authorized users can access the share.
Yes, I had that screen/popup and I typed in "root" as the user and then the password. I also did not check that box to remember the password.
Look at the tab of the shares, Allow Guest Access and Storage -> Dataset permissions

View attachment 20276

View attachment 20277
Allow guest access isn't checked and the Owner (user) is set to "root" and the Owner (Group) is set to "wheel", so that may be my issue. How do I set the Owner (group) to "root" then or do I have to create a user that isn't root to do it?
 

TecSaoMiguel

Cadet
Joined
Sep 22, 2017
Messages
4
Hello everbody, I`m having almost the same issue. I created a SMB share, and set up to the group "DTI". When I access the first time, it asks my credentials correctly, but when I access the second time it did not. It`s like it got saved in somewhere, but I need it to aks my credentials everytime I access the share. How do I do that? I`m using FreeNAS 11, but I got the same issue in FreNAS 8.3, and I didn`t check the box to remember credentials on windows.
 

Artion

Patron
Joined
Feb 12, 2016
Messages
331
Hello everbody, I`m having almost the same issue. I created a SMB share, and set up to the group "DTI". When I access the first time, it asks my credentials correctly, but when I access the second time it did not. It`s like it got saved in somewhere, but I need it to aks my credentials everytime I access the share. How do I do that? I`m using FreeNAS 11, but I got the same issue in FreNAS 8.3, and I didn`t check the box to remember credentials on windows.
Well windows saves the credentials per session. When you reboot or log out and log in again it asks you again the credentials for the share. Is this your case? Or it doesn't ask you for the credentials even when you reboot?

Inviato dal mio YD201 utilizzando Tapatalk
 

styno

Patron
Joined
Apr 11, 2016
Messages
466
net use /delete * && klist purge will do exactly what you want for all entries & tickets. If you want to do this for only one of the connections you have to change to commands to be more specific.
 

TecSaoMiguel

Cadet
Joined
Sep 22, 2017
Messages
4
Well windows saves the credentials per session. When you reboot or log out and log in again it asks you again the credentials for the share. Is this your case? Or it doesn't ask you for the credentials even when you reboot?

Inviato dal mio YD201 utilizzando Tapatalk
Thanks for your answer. It does ask again my credentials when I reebot. But I`m looking for something that asks everytime I open the share, even if I don`t reebot. I tought that maybe SMB has some command to do that, because I already set windows to not save the credentials and it doesn`t worked (works only with reboot or logout).
 

Artion

Patron
Joined
Feb 12, 2016
Messages
331
Thanks for your answer. It does ask again my credentials when I reebot. But I`m looking for something that asks everytime I open the share, even if I don`t reebot. I tought that maybe SMB has some command to do that, because I already set windows to not save the credentials and it doesn`t worked (works only with reboot or logout).
Making a fast search I found this ( https://serverfault.com/questions/4...edentials-for-a-network-share-on-a-windows-ma )… hope it helps, but I see there is no easy way to achieve what you want… rather than loging off… ☺

Inviato dal mio YD201 utilizzando Tapatalk
 

styno

Patron
Joined
Apr 11, 2016
Messages
466
So the CMD I posted on Saturday did not work?
 

TecSaoMiguel

Cadet
Joined
Sep 22, 2017
Messages
4
Thanks Artion and styno for your help.
The "net use * /delete /y" command did work, but it takes around 10s or 15s to work properly. So, if you close your connection, use the command and someone else access the share in less than that, it will access with the last user used.

So, I solved it with a VBS script. Turning off the navigation of the share, it will be accessed only by the script:

Code:
Set oShell = CreateObject("WScript.Shell")
Set myFile = CreateObject("Scripting.FileSystemObject")
Set msgWait = WScript.CreateObject("WScript.Shell")
Dim count

oShell.Run "net use \\storage /delete /y"
oShell.Run "net use * /delete /y"
oShell.Run "net use /persistent:no"

Set readFile = myFile.OpenTextFile("C:\Storage\log.txt")
OldUser = readFile.ReadLine

UserName = InputBox ("Digite seu usuário:", "ACESSO À REDE")

If (UserName <> "") Then

	If (OldUser <> UserName) Then
		dteWait = DateAdd("s", 10, Now())
		count = 10
		Do Until (Now() > dteWait)
			msgWait.Popup "AGUARDE " & count & " SEGUNDO, ENQUANTO O ÚLTIMO USUÁRIO É DESCONECTADO", 1, "ACESSO À REDE", 0
			count = count -1
		Loop
		msgBox ("USUÁRIO DESCONECTADO" & WScript.Sleep(1000))
	End If

	UserPass = InputBox ("Digite sua senha:", "ACESSO À REDE")
	If (UserPass <> "") Then
		WScript.Sleep 1000

		Set writeFile = myFile.OpenTextFile("C:\Storage\log.txt", 2)
		writeFile.WriteLine(UserName)
		writeFile.WriteLine(UserPass)
		writeFile.close()

		oShell.Run "net use \\storage " & UserPass & " /user:" & UserName
		oShell.Run "C:\Windows\Explorer.exe \\storage\"

		oShell.Run "net use \\storage /delete /y"
		oShell.Run "net use * /delete /y"
	End If
End If


Long story short, it copies the last user into the "log.txt", and uses it to know if the new access is from a new user or the same user.
If it`s from a new user, it will wait at least 10 seconds to try to connect. Enought time to "net use * /delete /y" to work.

;)
 

styno

Patron
Joined
Apr 11, 2016
Messages
466
Strange, I could've sworn that it worked instantly. Did you include the klist part of the command? I don't see how access could be gained if the Kerberos ticket is purged.
But hey, you've got a (quite elegant) solution! ;-)
 

TecSaoMiguel

Cadet
Joined
Sep 22, 2017
Messages
4
Strange, I could've sworn that it worked instantly. Did you include the klist part of the command? I don't see how access could be gained if the Kerberos ticket is purged.
But hey, you've got a (quite elegant) solution! ;-)
Ty styno.
I try to use the klist command "klist -li 0x3e7 purge", but it didn`t work.
 

Artion

Patron
Joined
Feb 12, 2016
Messages
331
Thanks Artion and styno for your help.
The "net use * /delete /y" command did work, but it takes around 10s or 15s to work properly. So, if you close your connection, use the command and someone else access the share in less than that, it will access with the last user used.

So, I solved it with a VBS script. Turning off the navigation of the share, it will be accessed only by the script:

Code:
Set oShell = CreateObject("WScript.Shell")
Set myFile = CreateObject("Scripting.FileSystemObject")
Set msgWait = WScript.CreateObject("WScript.Shell")
Dim count

oShell.Run "net use \\storage /delete /y"
oShell.Run "net use * /delete /y"
oShell.Run "net use /persistent:no"

Set readFile = myFile.OpenTextFile("C:\Storage\log.txt")
OldUser = readFile.ReadLine

UserName = InputBox ("Digite seu usuário:", "ACESSO À REDE")

If (UserName <> "") Then

	If (OldUser <> UserName) Then
		dteWait = DateAdd("s", 10, Now())
		count = 10
		Do Until (Now() > dteWait)
			msgWait.Popup "AGUARDE " & count & " SEGUNDO, ENQUANTO O ÚLTIMO USUÁRIO É DESCONECTADO", 1, "ACESSO À REDE", 0
			count = count -1
		Loop
		msgBox ("USUÁRIO DESCONECTADO" & WScript.Sleep(1000))
	End If

	UserPass = InputBox ("Digite sua senha:", "ACESSO À REDE")
	If (UserPass <> "") Then
		WScript.Sleep 1000

		Set writeFile = myFile.OpenTextFile("C:\Storage\log.txt", 2)
		writeFile.WriteLine(UserName)
		writeFile.WriteLine(UserPass)
		writeFile.close()

		oShell.Run "net use \\storage " & UserPass & " /user:" & UserName
		oShell.Run "C:\Windows\Explorer.exe \\storage\"

		oShell.Run "net use \\storage /delete /y"
		oShell.Run "net use * /delete /y"
	End If
End If


Long story short, it copies the last user into the "log.txt", and uses it to know if the new access is from a new user or the same user.
If it`s from a new user, it will wait at least 10 seconds to try to connect. Enought time to "net use * /delete /y" to work.

;)
Maybe restarting the Workstation service can do the trick. [emoji4]
140826df93f3264c1bd65462d5e36e4c.jpg


Inviato dal mio A8 utilizzando Tapatalk
 
Status
Not open for further replies.
Top