This guide shows you how to securely access a network drive (a shared folder on your office or home network) from outside your local network, whether you’re using Windows or macOS. You’ll learn the safest methods—VPN and SSH tunneling—and how to set them up step by step, so you can reach your files without exposing them to the internet.
What You’ll Need
- Administrator access to the router or firewall that protects the network where the drive lives.
- The IP address or hostname of the computer that hosts the shared drive.
- The network drive’s share name (e.g., \\Server\SharedDocs).
- A VPN server or SSH server running on the host network (instructions below).
- Your Windows or Mac computer with the necessary client software (built-in or free).
Step-by-Step
Option 1: Using a VPN (Recommended)
- Set up a VPN server on the network hosting the drive. The easiest way is to use a router with built-in VPN support (many modern routers offer OpenVPN or WireGuard). Alternatively, install a VPN server like OpenVPN or WireGuard on a dedicated computer (e.g., a small PC or Raspberry Pi) on that network.
- Configure the VPN server. Follow the server software’s instructions to create user accounts and certificates. Make sure to enable strong encryption (AES-256 or better) and use a strong password or key.
- Forward the VPN port on your router. Log into your router’s admin panel, find the port forwarding section, and forward the VPN port (e.g., UDP 1194 for OpenVPN, UDP 51820 for WireGuard) to the VPN server’s internal IP address.
- Install the VPN client on your remote computer. On Windows, download the official client for your VPN protocol (e.g., OpenVPN GUI). On Mac, you can use Tunnelblick for OpenVPN or the official WireGuard app for macOS.
- Import the VPN configuration file. The server will provide a .ovpn (OpenVPN) or .conf (WireGuard) file. Import it into your client.
- Connect to the VPN. Launch the client, enter your credentials, and connect. Once connected, your computer is virtually on the same network as the drive.
- Map the network drive.
- Windows: Open File Explorer, right-click “This PC”, choose “Map network drive”, select a drive letter, enter the path (e.g., \\192.168.1.100\SharedDocs), check “Connect using different credentials” if needed, and finish. Use the internal IP of the host computer.
- Mac: In Finder, press Cmd+K, type smb://192.168.1.100/SharedDocs, and click Connect. Enter your username and password when prompted.
Option 2: Using SSH Tunneling (Alternative)
- Enable SSH on the host computer. On Windows, install OpenSSH Server (via Settings > Apps > Optional Features). On Mac, enable Remote Login in System Settings > General > Sharing.
- Forward the SSH port on your router. Forward TCP port 22 (or a custom port) to the host computer’s internal IP.
- Create an SSH tunnel from your remote computer.
- Windows: Open PowerShell or Command Prompt and run:
ssh -L 445:localhost:445 user@your-public-ip(replace user and IP). This forwards local port 445 to the host’s SMB port. - Mac: Open Terminal and run the same command.
- Windows: Open PowerShell or Command Prompt and run:
- Map the drive using the tunnel. In Windows, map to \\127.0.0.1\SharedDocs. On Mac, connect to smb://127.0.0.1/SharedDocs.
Common Mistakes
- Exposing SMB directly to the internet. Never forward port 445 without a VPN or tunnel. SMB is vulnerable to attacks like EternalBlue.
- Using weak passwords. Use long, unique passwords for VPN and SSH accounts.
- Forgetting to update software. Keep your router, VPN server, and operating system patched.
- Using the wrong IP address. When connecting, use the internal IP of the host computer, not the public IP, unless you’re using the tunnel correctly.
- Not enabling encryption. Ensure VPN or SSH uses encryption; plain FTP or unencrypted SMB is unsafe.
Tips
- Use a dynamic DNS service. If your home IP changes, a dynamic DNS hostname (like myhome.ddns.net) makes it easier to connect.
- Set up two-factor authentication on your VPN if supported.
- Limit VPN access to specific users and disable unused accounts.
- Use a firewall on the host computer to allow only VPN/tunnel traffic to the drive.
- Test the connection from a mobile hotspot to ensure it works outside your network.
Troubleshooting
- Cannot connect to VPN: Check that the VPN port is forwarded correctly (use an online port checker). Verify the server is running and the client has the correct configuration file.
- Drive maps but is slow: This is normal over the internet. Try using a wired connection or a faster VPN protocol like WireGuard.
- Access denied: Ensure the share permissions allow your user account. On Windows, check both share and NTFS permissions.
- SSH tunnel fails: Make sure SSH is enabled on the host and the port is forwarded. Test with
ssh -vfor verbose output. - VPN connects but no network access: Check that the VPN assigns the correct subnet and that the host computer’s firewall allows traffic from the VPN interface.
Frequently Asked Questions
Is it safe to access a network drive remotely without a VPN?
No. Exposing SMB or AFP ports directly to the internet is extremely risky. Always use a VPN or SSH tunnel to encrypt traffic and hide the drive from the public internet.
Can I use a free VPN service?
Yes, but for accessing your own network, it’s better to set up your own VPN server (using OpenVPN or WireGuard) on your home network. Free third-party VPNs are not designed for this and may compromise your data.
What if my router doesn’t support VPN?
You can install a VPN server on a dedicated device like a Raspberry Pi or an old PC. Alternatively, use SSH tunneling, which only requires SSH server software.
How do I find my public IP address?
Search “what is my IP” on a search engine from the network where the drive is located. But note that your IP may change; use dynamic DNS for a stable hostname.
Can I access the drive from a mobile device?
Yes, if you install a VPN client on your phone and connect to your VPN, you can then use file manager apps that support SMB or AFP to access the drive.
What is the difference between SMB and AFP?
SMB (Server Message Block) is the standard file-sharing protocol on Windows and is also supported by macOS. AFP (Apple Filing Protocol) is Apple’s older protocol, now deprecated. For cross-platform access, use SMB.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- How to Use Multiple CSS Transforms
- How to Spoof Location on iPhone
- iOS App Testing on Multiple Devices: A Guide
- How to Delete iOS Calendar Viruses
- X Bar Symbol in Word: 3 Quick Typing Methods
- Convert Physical SIM to eSIM on iPhone: Step-by-Step