2

When I share a folder, it only works when privileges are set to "Everyone". How can I share a specific folder with a specific username/password so that only those who know that username/password can access it? And more specifically, how can I make it so that two different shared folders on the same machine can be accessed via 2 different usernames & passwords, for instance 1 folder is public to everybody and the other one is private to only 2 people in the organization?

PREAMBLE

Right clicking on a folder -> properties -> sharing tab -> advanced sharing -> tick the "share this folder" checkbox and then under the "permissions" button:

On PC1 that has a local Windows account "userA", I share folderA specifying the user "everyone" full control privileges and, as expected, it fully works on PC2: It asks for username/password, so I click on "Use another account" and I type in "userA" (this account exists on PC1 but not on PC2) along with the password and it works perfectly fine.

Then, still on PC1, I shared folderB giving it only "userB" full control and no other user. Trying to connect to the shared folder on PC2, I am prompted to enter the credentials, so I click on "Use another account" like before, but after typing "userB" with the password, it displays a window saying: Attempting to connect to \PC1\folderB... and then 15 seconds later, it says: The network folder specified is currently mapped using a different user name and password. (but that's not the case)

enter image description here

SHARING TO THE "EVERYONE" USER

Every tutorial that I could find online says to add the "everyone" user to the permissions! This is nonsense. SURE it works, but then everybody can see the contents of that folder! I want this specific folder to ONLY be accessible to 2 people in the organization, not to everybody!

HACKING FOR A SOLUTION

EDIT: OK so 3 hours in, now I have begun to understand something about folder sharing in Windows. It looks like Windows can only connect to one username/password per host. This means that if I share 2 folders not to the same username/password, I will only be able to access one of them until I reboot the computer. I managed to get 2 shares with different username/passwords working with this hack: On the client computers (e.g. PC2), map a network drive to \PC1\folderA (with userA/passA) and map another one to \192.168.0.123\folderB (with userB/passB) obviously 192.168.0.123 is PC1's local IP address. If I ever wanted to share a third folder with yet another username/password I would be completely stuck, but fortunately for me, I only need 2 username/password pairs in all. Thank god. Why does Windows shared folders "feature" suck so much after a quarter of a century?! Linux has been top notch on this feature for more than 35 years now!!!

NET USE HACK

Following @jw_ solution using the "net use" command, I tried wiping out the net use passwords first, then mapping the folderA, this worked. Then I tried to map folderB. IT DID NOT ASK ME FOR THIS PASSWORD. Instead, it printed a strange list and I could NOT access the folderB share, even tough it says in the command line prompt that the operation completed successfully while mapping it. Then I tried to wipe out the net use passwords and both the folderA and folderB mappings were listed so it kind of did something while trying to map folderB but it just doesn't work!

enter image description here

3
  • "Why does Windows shared folders "feature" suck so much after a quarter of a century?! Linux has been top notch on this feature for more than 35 years now!!!" - The reason may be: (1) Patents, if MS provide some feature it could be sued by patent trolls; (2) Compatability issue: If the feature that sucks is solved, then maybe there will be more serious problems appear.
    – jw_
    Commented Jan 16, 2020 at 3:50
  • The SMB login window often cause problems, you can use command line in case of problems: (1) Clear everything up: net use * /del (2) mount the share: net use \\<ip address>\<folder> /user:<user name to log in> , then you will be asked for passwords. No reboot is needed when messed up on SMB
    – jw_
    Commented Jan 16, 2020 at 3:55
  • So, are you suggesting that when the shared folder access doesn't work properly on a client computer, I can launch CMD and execute the "net use * /del" command to kind of reset the share mapping passwords? What does this command do exactly? Also not so much related but: Wasn't SMB removed from current Win10 versions??
    – that-ben
    Commented Jan 16, 2020 at 12:38

1 Answer 1

0

Based on the solution you find out:

The Samba login window often cause problems, you can use command line in case of problems:

(0) Open command line window, my way is WinKey+R then input cmd and Enter

(1) Clear everything up:

net use * /del 

Then "Yes". This removes all the records in the system about the Samba login status onto other machines.

I guess

net use <ip address> /del 

can remove only records about login to a single remote machine with , but I never tried this since there are always just one connection in my usage.

(2) mount the share:

net use \\<ip address>\<folder> /user:<user name>

to establish Samba connection, then you will be asked for passwords and input it.

(3) Now just access that machine as usual in Explorer, like

"\\<ip address>" or "\\<ip address>\<folder>"

, then Windows will be sure NOT to ask you any passwords.

In fact since such problems are very common, I alwasy run a batch file to set up the connection then goto Explorere to continue. One batch per remote machine.

3
  • I edited my question, see the bottom part, I followed your "net use" command instructions and it only worked for the first shared folder. The second shared folder, it never asked me the password, instead it output a strange listing and then it said the operation completed successfully but in Explorer, I could not access it.
    – that-ben
    Commented Jan 16, 2020 at 14:53
  • @that-ben The answer is mainly to sovle the mess up without reboot, and you can use this to switch between accounts for different folders on the same machine. Do you use "net *** del" before your second "net use"?
    – jw_
    Commented Jan 17, 2020 at 0:45
  • 1
    No, but I understand that it works, yes. The problem is that it gets tiring to always go back and forth the folders and type the password everytime. I understand I could make a batch file to delete and reconnect to network shares but it's still unsatisfactory. I would like BOTH the shares passwords to be retained. How is this not possible with Windows 7/10 pro? At least, I can do exactly that when I link folderA through the computer's name and folderB through the computer's IP. Windows thinks it's 2 completely different hosts and therefore I can make a different password share for each!
    – that-ben
    Commented Jan 17, 2020 at 13:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .