When having more than one computer in a local area network (LAN), you may need to make files stored on one computer accessible on another computer over the network. In this case, you can share a folder in Windows using the SMB protocol. Note that the workflow is the same for sharing folders in Windows versions 7, 8, and 11.
Before we create a shared folder and configure access, let’s briefly go over the main steps:
The requirements to share a folder are:
In this walkthrough, we will use Windows 10 Professional Edition (Build 19042):
First, we need to enable file and printer sharing in Windows 10 network settings. These settings are related to the firewall configuration.
Control Panel > Network and Internet > Network and Sharing Center
or
Control Panel > All Control Panel Items > Network and Sharing Center.
Alternatively, you can open this window with the command:
control /name Microsoft.NetworkAndSharingCenter
control.exe /name Microsoft.NetworkAndSharingCenter /page Advanced
A network profile is a preset with special security, firewall, and network sharing settings in Windows for the network connection.
A network profile in Windows 10 can be private, public, and domain (if a computer is a domain member).A network profile must be Private to share a folder in Windows 10 and newer Windows versions. If you need to change a network profile, read how to do this at the end of this section.
After setting these options, other computers in the network can ping your computer and access shared folders.
Follow these steps to change the network profile in Windows 10 and prepare for setting up network sharing.
Providing credentials of your Windows user account to other people is not a good idea. Based on best practices, it’s recommended that you create special user accounts in Windows 10 and set the needed access level for these accounts to share a folder. There are various settings to create users and groups in Windows 10 Professional edition.
We create user11, user12, user13, and user14 here. By default, these users are members of the Users group.
To share a folder with the same permissions for multiple users who must use different credentials, it is more convenient to create a group, add the needed users to the group, and share a folder with this group.
We add three users (that were created before) to this group - user11, user12, and user13.
All preparation steps have been completed. Network settings are configured, users and groups are created. Now we can share a folder in Windows 10.
To share a folder in Windows 7, 8, 10, or 11, do the following:
Note: If Everyone is selected in Share Permissions, access can be limited in the NTFS security permissions of the Security tab explained below after configuring Share Permissions.
Click Add to add the needed user or group with whom you want to share the folder.
Note: We use advanced sharing and not simple sharing because the options to configure are limited with simple sharing. In the screenshot below, you can see how simple sharing settings look after we configured Windows 10 data sharing via SMB. Moreover, using advanced sharing settings allows you to understand how to share a folder in Windows 10 and general file sharing principles better.
The alternative method to share a folder in Windows 7, 8, 10, or 11 is using a Shared Folders snap-in fsmgmt.msc. You can also follow the steps below to find this snap-in:
You can also check shared folders, opened sessions, and opened files in this snap-in, as well as manage existing shares and disable file sharing.
To connect to a shared folder from a Windows 10 computer over the network, do the following:
You can enter the full network path to a shared folder known as UNC path, such as:
This method can be useful because sometimes a list of shared folders cannot be browsed on a remote SMB server.
We have explained how to access shared folder in Windows 10 in a general way. For more convenience, you can map a remote shared folder as a network drive that will be displayed in Windows Explorer permanently (until you remove this drive). This method also works for other Windows versions.
By default, all shared folders are protected by a password for specific users. However, there is a secure method for users to access a shared folder from their Windows computers without entering a password each time. The conditions are the following:
Let’s use an example to illustrate this. For example, we have two computers:
Computer 1 parameters:
Computer 2 parameters:
Create User1 on Computer1 and User1 on Computer2. The password for User1 on Computer1 must be the same as the one for User1 on Computer2 (Password1 in this example).
After completing this configuration, User1 can access the shared folder on Computer1 from Computer2 without entering a password, but the connection is password-protected. The user must be logged in to Windows on Computer2 as User1. This approach is classified as a best practice when users need to access a shared folder without entering a password.
By default, users on remote computers cannot access a file share if they don’t enter a password or if their account doesn’t have a password. This is for security reasons. However, you can configure Windows shared folders to access them without passwords. Be aware that setting up network sharing without passwords is not secure and has high risks to your data.
The information below is provided for educational purposes, as these settings go against the best practices of Windows file sharing and should not be used. Opt for the approach explained above with the same passwords for user accounts if you don’t want to enter a password when accessing a file share. Even if all users in your local network are trusted users, somebody can illegally access your network, for example, by connecting to the network via Wi-Fi and gain access to your data.
Below you can see the settings that make it possible to connect to a file share without a password at all.
In Advanced sharing settings > All networks, you can see two options that enable access without passwords:
In addition to that, there is a group policy responsible for access to a shared folder without a password.
You can find this policy in the group policy editor (gpedit.msc) in Windows Settings > Security Settings > Local Policies > Security Options. The policy name is: Network access: Let Everyone permissions apply to anonymous users
If this policy is Enabled, then users can access a Windows shared folder without a password.
Guest is a built-in Windows user with limited privileges that can be used to access particular resources on a Windows machine. A guest user account can play a role in file sharing and providing anonymous access to a shared folder. When enabling anonymous access to shared folders, users can access the appropriate shared folder as a guest user without entering credentials.
Enabling anonymous access to shared folders using a guest user account widens the attack surface. Malicious actors or unauthorized users can attempt to exploit vulnerabilities in the guest user account or in the file sharing configuration to gain unauthorized access to the system or sensitive data.
By default, Guest is disabled for security reasons.
It is impossible to enable or create a guest account in Windows 10 build 10159 and newer because Microsoft removed this option. You can create only a standard local user account with manually set permissions, but not a special guest account as it was in Windows 7, Windows XP, and earlier versions (it’s even not possible in the command line and by editing group policies).
Windows 10 uses SMB 3.1 by default to share folders (SMB server) and access shared folders on remote machines (SMB client). If you share a folder in Windows 10 and try to connect to this shared folder from Windows XP, for example, you will get an error because Windows XP uses SMB 1.0 and SMB 1.0 is disabled in Windows 10 by default for security reasons.
Note: Ransomware such as WannaCry and NotPetya used EternalBlue and EternalRomance exploits related to the SMB 1.0 protocol vulnerabilities to attack computers and corrupt data. After that, Microsoft released security patches for all Windows operating systems starting from Windows XP. There are also EternalChampion, EternalSynergy, and EternalRocks exploits for the SMB v1 protocol used by ransomware.
Learn more about CIFS and other SMB versions and read about the differences between SMB and NFS.
You can check whether the appropriate version of the SMB protocol is enabled in Windows by using the PowerShell commands listed below.
Get-WindowsOptionalFeature -Online -FeatureName SMB1Protocol
or
Dism /online /Get-Features /format:table | find "SMB1Protocol"
Get-SmbServerConfiguration | Select EnableSMB2Protocol
Get-Item HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters | ForEach-Object {Get-ItemProperty $_.pspath}
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters | ForEach-Object {Get-ItemProperty $_.pspath}
If the command returns True in the output, it means that the current SMB protocol version is enabled.
Get-SmbServerConfiguration | select "*enablesmb*"
To enable SMB 1.0 for an SMB server or client in Windows 10, do the following:
You can enable SMB 1.0/CIFS File Sharing Support in CMD:
Enable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol
or
Set-SmbServerConfiguration -sEnableSMB1Protocol $true
or
Install-WindowsFeature FS-SMB1
Enable client only:
Enable-WindowsOptionalFeature -Online -FeatureName "SMB1Protocol-Client" -All
Enable SMB 1.0 server:
Enable-WindowsOptionalFeature -Online -FeatureName "SMB1Protocol-Server" -All
If, for some reason, you need to disable SMB 2 on Windows 10, you can edit the appropriate registry parameter or use the PowerShell command:
reg.exe add "HKLM\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v "SMB2" /t REG_DWORD /d "0" /f
sc.exe config lanmanworkstation depend= bowser/mrxsmb10/nsi
sc.exe config mrxsmb20 start=disabled
PowerShell -ExecutionPolicy Unrestricted
Set-SmbServerConfiguration -EnableSMB2Protocol $true
This section explains common issues when Windows sharing is not working and provides tips on resolving them.
Windows cannot access \\hostname\share
You do not have permission to access \\hostname\share. Contact your network administrator to request access.
If you see this error message, it can mean that a user has not been added to the list of users in the sharing settings of the shared folder or that there are no permissions to access this share for this user. Edit sharing settings of the folder, add the needed user, and set the appropriate permissions.
Get-SmbShareAccess -Name "share01"
get-acl C:\share01\ |fl
Use the appropriate share name and path to the shared folder in the above commands because they may be different in your case.
Control Panel\User Accounts\Credential Manager
The alternative way is to run the command to open the classic Credential Manager:
rundll32.exe keymgr.dll,KRShowKeyMgr
Windows cannot access \\sharename
Check the spelling of the name. Otherwise, there might be a problem with your network.
Error code: 0x80070035.
The network path was not found.
Fix 1
Check SMB protocol versions on the server and client sides. You may need to enable or disable the appropriate SMB versions.
Fix 2
A Server service can be stopped or disabled. This server is responsible for an SMB server in Windows for file sharing. Check the service state and start the service if it is not running.
Check whether the following Windows services are running on a machine with a shared folder:
Fix 3
If anonymous (guest) access is used (that is not recommended, as we explained above), then check the following group policy.
Enable insecure guest logons
in
Computer Configuration > Administrative templates > Network > Lanman Workstation
We don’t recommend enabling this policy or enabling guest access for security reasons. If you use guest access anyway, then enabling this policy may fix the 0x80070035 error.
reg add HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters /v AllowInsecureGuestAuth /t reg_dword /d 00000001 /f
An error occurred while reconnecting S: to
\\Computer\share
Microsoft Windows Network: You can’t access this shared folder because your organization’s security policies block unauthenticated guest access. These policies help protect your PC from unsafe or malicious devices on the network.
The error is reflected in the log of Event Viewer in Windows.
Log Name: Microsoft-Windows-SmbClient/Security Source: Microsoft-Windows-SMBClient Event ID: 31017
Rejected an insecure guest logon.
This error can be encountered on Windows 10 newer than build 1709 when trying to use anonymous access to a shared folder because anonymous (guest) access is disabled for SMB v1 for security reasons. SMB v1 and SMB v2 don’t use SMB signing and encryption that make the connection vulnerable.
The optimal solution is to configure a remote host with an SMB share to use SMB v3 on an SMB server. Disable anonymous (guest) access. If SMB v2 is the highest protocol version that can be used, configure access with authentication. Access with authentication is the best approach for setting up network sharing.
This error can occur if SMB 1.0 is disabled on a client machine. See the information above about how to enable SMB 1.0 or configure an SMB server and SMB client to use SMB 3.0 or 3.1 on both sides.
Maximum 20 concurrent connections for file and printer shares is the limit in Windows 7 and newer client Windows versions. It means that 20 users can connect to the file share at the same time. If user 21 connects to the file share while 20 users have already been connected, he/she will get an error.
Unlike Windows 10 and other client Windows versions, Windows Server 2019 (and other server versions) does not have a limit of concurrent connections to a shared folder. If you need to create a file server and share folders for many users, including domain users, consider configuring a file share on Windows Server 2019. Read also this NAS vs file server comparison.
Now you know how to share a folder in Windows 10 and other client Windows versions. You need to configure the firewall/security settings, create user accounts, and set SMB sharing permissions and NTFS file system permissions for the folder. Clients can connect to a shared folder using their credentials and map a shared folder as a network drive.
Remember to back up your files stored in shared folders. NAKIVO Backup & Replication supports backup to SMB file shares and NFS shares (including NAS).
Link nội dung: https://ausp.edu.vn/how-to-set-up-network-file-sharing-in-windows-a24679.html