Mounting a windows share in Windows Subsystem for Linux
Assuming the host Windows OS can access a file share at "\\servername\sharename", try this command in bash. You will need to be root:
mkdir /mnt/mountedsharemount -t drvfs '\\servername\sharename' /mnt/mountedshare
The single quotes are important!
Worked for me with a SharePoint Online UNC path. The permissions are screwy though. I can navigate through the folders and see the filenames, but I can't read files. So need to figure out the permissions thing. Let me know if you get anywhere with that.
Actually if your windows share is already mapped to a drive in the Windows host, it can be even simpler. Let's suppose you already mounted the share on Z:
. In that case the following will work:
sudo mkdir /mnt/zsudo mount -t drvfs 'Z:' /mnt/z
While you have an a mount created to the windows host through /mnt/c
already created for you in WSL, if you want to mount a share from another machine, then you will need to create the mount point, e.g.
sudo mkdir -p /mnt/somename
Then you will need to mount the remotely shared smb://
filesystem at that mount point using mount.cifs
, e.g.
sudo mount.cifs //server/sharename /mnt/somename
Optionally, you will want to include options following /mnt/somename
such as
-o username=yourname,uid=YOURUID,noperm,password=yourpassforremoteshare
If it is an older WinXP share you are attempting to mount, then you will need to enable NTLMv1
authentication by including the sec=ntlm
or sec=ntlm1
. See mount.cifs
for further use of the sec=
option.