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
- How to Configure Windows Firewall on a Windows VPS
- How to Set Up a VPN Server on Windows Server
- Windows Server Security Checklist for a New VPS
Browse more articles in Windows Server Administration.