Monday, March 16, 2026

How to Mount Windows Network Drives in WSL

Mounting network drives in Windows Subsystem for Linux (WSL) opens up a whole new dimension for file management and development. Learn how.
The Linux terminal on Ubuntu

Mounting network drives in Windows Subsystem for Linux (WSL) opens up a whole new dimension for file management and development. This process allows you to access files stored on remote servers or shared folders directly from your WSL environment, making it easier to work across platforms.

In this article we'll review a step-by-step guide on how to do it.

Prerequisites

Before diving in, ensure you have the following:

  • Windows 10 or Windows 11: Ensure WSL is enabled.
  • WSL Installed: You should have WSL set up (either WSL1 or WSL2).
  • Network Share Details: Know the network path (e.g., `\\SERVER\ShareName`) of the shared drive you want to mount.

Mounting Network drives in WSL

1. Enable WSL (If Not Already Done)

If you haven’t enabled WSL on your Windows machine, do so with these steps.

First, oen PowerShell as Administrator by searching for PowerShell in the Start menu, right-click, and choose "Run as Administrator".

Next, let's run the WSL Installation Command:
$ wsl --install

If needed, restart your computer by following any prompts to complete the installation.

2. Install Required Packages in WSL

To work with network drives, you might need the `cifs-utils` package for WSL. Open your WSL terminal and run:

sudo apt update
sudo apt install cifs-utils

3. Create a Mount Point

Next, you'll need to create a directory where the network drive will be mounted. Choose a convenient location, like `/mnt/`.

sudo mkdir /mnt/my_network_drive

4. Mount the Network Drive

Now it's time to mount the network drive. Use the following command, replacing the placeholders with your actual server address, share name, username, and password:

sudo mount -t cifs //SERVER/ShareName /mnt/my_network_drive -o username=YOUR_USERNAME,password=YOUR_PASSWORD
- **Example**:
sudo mount -t cifs //192.168.1.10/SharedFolder /mnt/my_network_drive -o username=user,password=pass

5. Access the Mounted Drive

You can now access your network drive at `/mnt/my_network_drive`. Use commands like `ls` to view the contents:

ls /mnt/my_network_drive

6. Unmounting the Drive

When you're finished, you can unmount the drive with:

sudo umount /mnt/my_network_drive

Additional Tips

Persistent Mounting

To automatically mount the drive at WSL startup, add the following line to your `/etc/fstab`:
//SERVER/ShareName /mnt/my_network_drive cifs username=YOUR_USERNAME,password=YOUR_PASSWORD 0 0

Security Considerations

Storing passwords in plain text in `fstab` can be insecure. Instead, consider using a credentials file:

Create a file to store your credentials:

nano ~/.smbcredentials

Add the following lines:

username=YOUR_USERNAME
password=YOUR_PASSWORD

Change permissions to secure the file:

chmod 600 ~/.smbcredentials

Update the `fstab` entry to use the credentials file:

//SERVER/ShareName /mnt/my_network_drive cifs credentials=/home/YOUR_USERNAME/.smbcredentials 0 0

Conclusion

By following these steps, you can seamlessly access Windows network drives from your WSL environment. This integration not only enhances your productivity but also provides a robust way to manage files across different operating systems. Whether you're developing applications or handling files, having access to network resources in WSL is invaluable. 

With this guide, you should be well-set to access your Windows network drive in WSL. Happy coding!

Featured Article

How to Mount Windows Network Drives in WSL

Mounting network drives in Windows Subsystem for Linux (WSL) opens up a whole new dimension for file management and development. Learn ...