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?
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)
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!