How to Mount Network Drives in Windows Subsystem for Linux
If you use wsl/" class="sal-link" rel="noopener" target="_blank" data-sal-id="16936">Windows Subsystem for Linux (WSL), you might want to access files stored on your network directly from your Linux terminal. This guide shows you how to connect these network folders to your WSL environment.
Why mount network drives in WSL?
Mounting a network drive allows you to interact with shared files using Linux tools and scripts. It bridges the gap between your Windows network resources and your Linux workspace, making it easier to manage projects or data stored on a server.
What happens when you are done?
Once finished, your network folder will appear as a regular folder within your Linux file system. You can read, write, and manage files in that location just like you would with any other directory on your machine.
This post shows students and new users steps to mount or map a network drive or folder in Windows Subsystem for Linux (WSL). In Windows 11, users can map network drives and folders with ease.
Mounting a drive letter
If you have already mapped a network location to a drive letter in Windows (such as F:), you can easily bring it into WSL.
Note: The following commands require admin privileges.
1. Create a folder in Linux to act as the bridge:
sudo mkdir /mnt/f2. Mount the Windows drive letter to that folder:
sudo mount -t drvfs F: /mnt/fMounting a network folder path
If you have the network path (also called a UNC path, like \\server\documents), you can mount it directly without a drive letter.
1. Create a mount point:
sudo mkdir /mnt/documents2. Mount the network share:
sudo mount -t '\\server\documents' /mnt/documentsHandling password-protected shares
If the folder requires a login, use the Windows net use command first to establish the connection.
Run this in your command prompt (requires admin privileges):
net.exe use f: \\server\documents /user:username MyPasswordAfter running this, you can follow the steps above to mount the F: drive into your WSL environment.
How to unmount
When you are finished, you can disconnect the folder using this command:
sudo umount /mnt/documentsThe post below also shows you how to mount a removable drive in WSL.
How to mount a removable drive in Windows Subsystem for Linux.
Summary
Mounting network drives in WSL allows you to access shared files seamlessly. By creating a mount point in Linux and using the mount command, you can link your Windows network paths to your terminal. If a password is required, use the net use command in Windows first to authenticate, then proceed with the mount process in WSL.
How do I mount a network drive in WSL?
What is the UNC path and how do I use it in WSL?
Can I access password-protected network shares in WSL?
How do I unmount a network drive in WSL?
Is it necessary to create a mount point before mounting a network drive in WSL?
Was this guide helpful?
Hi!
You’re missing one thing from this otherwise extraordinarily useful post:
sudo mount -t ‘\\server\documents’ /mnt/documents
should be
sudo mount -t drvfs ‘\\server\documents’ /mnt/documents
(I got the bit about “-t drvfs” from another post that involved doing
“Map network drive” first to assign a drive letter to the network drive.)