How to Set Up File Sharing (SMB) on Windows Server

SMB (Server Message Block) file sharing lets you share folders from your Windows Server VPS accessible over the network — a common need for team file access or connecting Windows clients to shared storage.

Prerequisites

  • Windows Server with administrator access

Step 1 — Create the Folder to Share

New-Item -Path "C:\SharedFiles" -ItemType Directory

Step 2 — Create the SMB Share via PowerShell

New-SmbShare -Name "TeamFiles" -Path "C:\SharedFiles" -FullAccess "Everyone"

For production use, restrict access to specific users/groups rather than "Everyone" — see permission configuration below.

Step 3 — Configure NTFS Permissions

$acl = Get-Acl "C:\SharedFiles"
$permission = "DOMAIN\username","FullControl","Allow"
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission
$acl.SetAccessRule($rule)
Set-Acl "C:\SharedFiles" $acl

Both share-level permissions (set above) and NTFS file system permissions apply — the more restrictive of the two ultimately governs actual access.

Step 4 — Allow SMB Through Windows Firewall

Enable-NetFirewallRule -DisplayGroup "File and Printer Sharing"

Step 5 — Restrict Firewall Access to Trusted Sources (Important for a VPS)

Unlike a local network file server, a VPS is internet-facing — never leave SMB (port 445) openly accessible to the internet; restrict to specific trusted IPs or, better, require VPN access (see How to Set Up a VPN Server on Windows Server) before allowing SMB connections at all.

Connecting to the Share from a Windows Client

\\YOUR_SERVER_IP\TeamFiles

Enter this path in File Explorer's address bar, authenticating with valid credentials for the server.

Mapping the Share as a Network Drive

net use Z: \\YOUR_SERVER_IP\TeamFiles /persistent:yes

Viewing Existing Shares

Get-SmbShare

Removing a Share

Remove-SmbShare -Name "TeamFiles"

Security Considerations for Internet-Facing SMB

SMB has historically had significant security vulnerabilities when exposed to the internet — the strong recommendation is never exposing SMB directly to the public internet; use it only over a VPN or private network connection for genuinely secure access.

Alternative: Using HTTPS-Based File Sharing Instead

For internet-accessible file sharing without SMB's security concerns, consider a web-based file sharing solution instead (see relevant guides in Popular Self-Hosted Applications) — often a safer choice than exposing SMB directly.

Common Errors

Can't connect despite correct credentials — verify the Windows Firewall rule is actually enabled, and confirm both share-level and NTFS permissions grant the connecting user appropriate access.

Continue Reading

Browse more articles in Windows Server Administration.

  • windows smb file sharing, windows server shared folder, new-smbshare powershell, windows file server setup
  • 0 משתמשים שמצאו מאמר זה מועיל
?האם התשובה שקיבלתם הייתה מועילה

מאמרים קשורים

How to Connect to a Windows VPS via Remote Desktop (RDP)

Remote Desktop Protocol (RDP) provides full graphical access to a Windows Server VPS, letting you...

How to Secure RDP on a Windows VPS

RDP's default configuration (standard port, password authentication, unlimited login attempts)...

How to Create a New Administrator User on Windows Server

Using only the built-in Administrator account for all management tasks is risky. Creating a...

How to Install Windows Updates on a Windows VPS

Keeping Windows Server updated is essential for security and stability. This guide covers...

How to Configure Windows Firewall on a Windows VPS

Windows Defender Firewall controls which network connections are allowed to and from your server....