How to Access a Network Folder from Windows Subsystem for Linux

|

|

The post guides users on how to mount or map a network drive or folder in the Windows Subsystem for Linux (WSL). This can be done through detailed steps provided, which include using commands to create a mount point and map the network folder. The post also instructs on mapping protected locations requiring username and…

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. If you know the path to a shared folder and have access to the location, you should be able to map it easily.

Similarly, users can mount or map network locations in WSL environments. Any network location within Windows can be mounted or mapped in the WSL Linux shell.

In a WSL environment, users can mount network locations in two or more ways. One way is to map a network folder, like mounting a removable drive in WSL. Once the drive is mounted with a drive letter, you can use the mount command to map the drive to a mount point in Linux.

The commands below can mount a network drive assigned to the letter F in the WSL environment.

sudo mkdir /mnt/f
sudo mount -t drvfs F: /mnt/f

Mapping a network folder follows a similar approach.

How to map a network folder in Windows Subsystem for Linux

As mentioned above, any network location you can reach from within Windows can be mounted or mapped from the Linux shell.

If you know the UNC (Universal Naming Convention) path for a particular folder or drive and can access the location, you can mount it in the WSL shell environment.

For example, if the path to the network share is \\server\documents, you can run the commands below to mount it in WSL.

First, create a mount point in Linux where you’d want to map the shared network folder. Run the commands below to create a mount point if it’s not already created.

sudo mkdir /mnt/documents

Once the mount point is created, run the commands below to mount the network share.

sudo mount -t '\\server\documents' /mnt/documents

If the network location is password protected, you may have to use the net use command to map the location instead.

For example, you can use the net use command to mount the network path \\server\documents with the username Joe and the password MyPassword to map it to your F: drive.

net.exe use f: \\server\documents /user:Jdoe MyPassword

That should mount the network location mapped to the F drive in WSL. To unmount, simply run the commands below.

sudo umount /mnt/documents

That should do it!

The post below also shows you how to mount a removable drive in WSL.

How to mount a removable drive in Windows Subsystem for Linux.

Conclusion:

This post showed you how to mount a network folder or share in Windows Subsystem for Linux. Please use the comment form below if you find errors or have something to add.


Discover more from Geek Rewind

Subscribe to get the latest posts to your email.

Like this:



One response to “How to Access a Network Folder from Windows Subsystem for Linux”

  1. Ben Crocker Avatar
    Ben Crocker

    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.)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Discover more from Geek Rewind

Subscribe now to keep reading and get access to the full archive.

Continue reading