18

In my windows 10 command prompt, when I need to set the drive to some network shared drive I just use

net use V: //192.168.xxx.xxx/folder

I added Bash on Ubuntu on Windows in my Windows 10, and I'd like to have access to my network drives from the terminal as well, so I tried mounting it

sudo mount -t cifs -o username=myusername //192.168.xxx.xxx/folder /mnt/new_folder

where I created my new_folder in the /mnt folder, but I get the error

sudo: cannot find computer COMPUTER NAME

Where COMPUTER NAME is the actual name of my computer that I can see in the Explorer as well.

What am I doing wrong and how can I mount network drives in my windows bash?

EDIT:

I got it to work partially, by adding my computer name in the hosts file in etc/hosts

 127.0.1.1    COMPUTER NAME

But I still cannot mount the network drive

11
  • Those can't be the exact commands you used. Please use the exact commands. You state network path where you should have put COMPUTERNAME. Also don't use spaces in folders or put them between ". Remove the hosts entry. It just redirects the COMPUTER_NAME back to your own computer (which is not what you want). Please edit your question with the exact commands you use. – Rik Sep 23 '16 at 9:00
  • Instead of network path I used my remote servers remote address (in my office), so it's along the line of 192.168.xxx.xxx/newtork_folder. There are no spaces in the original, maybe I wasn't clear with that. – dingo_d Sep 23 '16 at 9:03
  • Well, that all matters a lot in your question. (you had network path right after // which should be the computername. Can you ping the computer by its ip or computername? – Rik Sep 23 '16 at 9:04
  • I added Bash on Ubuntu on Windows in my Windows 10 O, wait... is this all on the same computer? How are you running Ubuntu on Windows? – Rik Sep 23 '16 at 9:06
  • The bash is on Windows (I'm testing it out, the new anniversary update), the remote server is on the same network as my laptop. – dingo_d Sep 23 '16 at 9:07
9

Support for WSL accessible mounting of network drives (as well as removable local drives) was announced April 2017. Not sure which build exactly was the first to include it but my guess is around 15063.250 and above should be recent enough. If you do have support then you can now run:

sudo mount -t drvfs '\\192.168.xxx.xxx\folder' /mnt/new_folder

(Note that the network path must be in expressed in backslashes and thus has to be quoted to stop the shell automatically turning them into forward slashes.)

-5

See Callum Gare's answer above:
WSL has been under heavy development and it now supports mounting network shared folders.


Old answer

What you refer to as Windows 10 Bash is excellent for some uses but totally crippled for others. In general, it can be of good use for developers but is useless to SysAdmins. This is intentional, at least at the moment. It could just mean that it's under heavy development and some features are out of the current focus, as Rik points out and some people here on superuser also believe. Another view on the matter is that it must not enter in competition with Powershell, which is the #1 Microsoft shell product at the moment.

It all depends on what your specific needs are. If all you need is Bash I would recommend doing yourself a favor and use Cygwin for now. Or cmder, which doesn't require installation.

After the long preamble, I'd like to answer your question.

Question: Mounting network drive in Windows 10 from Bash?

Answer: In Windows 10, open a Cygwin Bash prompt and issue:

net use V: //192.168.xxx.xxx/folder

Or a cmder bash prompt:

net use V: \\192.168.xxx.xxx\folder
3
  • 2
    This doesn't answer the question nor explains what's the culprit. 2/3 of your answer is a polite rant, then you offer a workaround that requires installing extra software but doesn't offer any advantage over built-in cmd. – gronostaj Sep 15 '17 at 11:15
  • @gronostaj I explained that wsl does (or did) not fully support the feature: that's the culprit. I then answered the question in the title, showing how easy it should be, if the right tool is employed. Please note that the question is about bash, not built-in cmd. – simlev Sep 18 '17 at 10:37
  • 2
    You should delete this answer. – Kenny Evitt Nov 16 '17 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.