27

Just installed Hyper-V on Windows 8 and Guest OS Ubuntu 12.04.

Coming from VirtualBox, I am looking for best method for sharing a Directory on Host/Windows with Guest Ubuntu.

I read this: https://stackoverflow.com/a/1386764/913295 and I am familiar with Samba. Since that question does not relate to Hyper-V I am raising this related question here.

1
  • Ubuntu 14.04 on Windows 8.1 operating system allows to browse folder. Oct 19, 2015 at 16:57

3 Answers 3

15

Good question.

The bad news is that, unlike VirtualBox or VMWare that allows you to define "Shared Folders" which are directories on your host that are exposed to the guest, Windows 8 Hyper-V does not provide such feature at all.

The good news is that, since there is not such feature provided out of box from Hyper-V at all, there won't be necessary special purposed tools for it, e.g., for mounting vboxsf file systems. You just going through the official/standard way, accessing your host share folders as network shared folders.

The smbclient, the command-line SMB/CIFS clients for Unix, is the command-line tool to access to your Windows host share folders. Below are two examples that I found. Again, nothing special, access it the same way as you access any other Windows network shared folders.

How can I connect from Ubuntu 12.10 to file shares on a Windows 8 system
https://askubuntu.com/questions/245106/how-can-i-connect-from-ubuntu-12-10-to-file-shares-on-a-windows-8-system-using-a

Perfect Ubuntu setup on Hyper-V in Windows 8
http://webdevtooling.com/webdevtooling.com/tutorials/perfect-ubuntu-setup-on-hyper-v-in-windows-8/

I'll repost the "Configure a shared folder" section from the second link:

We need to share out a folder in the host to the guest. Guest can mount this on boot. For this tutorial, I’ll assume we are sharing it from a this location %USERPROFILE%\workspace

In the VM, edit the /etc/fstab:

//WinHost/users/username/workspace /home/username/workspace  cifs    defaults,soft,uid=username,gid=users,file_mode=0777,dir_mode=0777,credentials=/home/username/.cifs-credentials,soft

Also, add a credentials file for the mount to work. Put the following content in there:

[email protected]
password=something

That should be it.

More references for GUI based mounting:

http://www.wikihow.com/Mount-a-Windows-Share-on-an-Ubuntu-Server
http://www.liberiangeek.net/2013/04/how-to-access-windows-network-shares-in-ubuntu-13-04-raring-ringtail/
http://www.7tutorials.com/how-access-windows-7-shared-folders-ubuntu
https://help.ubuntu.com/community/MountWindowsSharesPermanently

If it doesn't work for you at first, try with a Windows based client first to access the host share folders. Again, nothing special, access it the same way as you access any other Windows network shared folders. I.e., some how-tos says that you "must have Created Internal Virtual Switch Via Virtual Switch Manager" to use the host share, that is purely not necessary and it gives you no benefits/advantages at all, since we are just accessing it as a normal Windows network shared folder. To recap, here are the steps:

  1. On your Hyper-V host, create a shared folder and assign Change permission to Everyone.

  2. On the virtual machine running on the host, open the Network and Sharing Center and enable File and Printer Sharing.

  3. On the virtual machine, click Start and type \\host_name\share_name where host_name is the name of your Hyper-V host and share_name is the name of the share you created.

  4. Press ENTER and an Explorer window will open in the VM showing the contents of the shared folder on the host.

  5. You can now copy files from the VM to the host and vice versa as needed.

References:

https://stackoverflow.com/questions/1386754/edit-source-directly-on-ubuntu-vm-from-windows-host/1386764#1386764

How to share files between a Hyper-V host and its virtual machines
http://www.windowsnetworking.com/kbase/WindowsTips/WindowsServer2008/AdminTips/VirtualPlatforms/HowtosharefilesbetweenaHyper-Vhostanditsvirtualmachines.html

3
  • There are lots of things smbclient or smbtree can go wrong, and there are lots of articles troubleshooting them as well. This is not a Hyper-V question thus not the proper place to ask. Open a new question, and be sure to mention you are using a client within Hyper-V. Otherwise, people will be misleaded too.
    – xpt
    May 26, 2015 at 17:55
  • Any idea why on Debian inside Hyper-V smbtree fails to show the host system's shares. Doing smbclient --list=<COMPUTER_NAME> --workgroupd=WORKGROUP --user=<username> works but also throws Error NT_STATUS_IO_TIMEOUT and NetBIOS over TCP disabled -- no workgroup available?. Note the host's shares are accessible from another windows machine. May 29, 2015 at 3:16
  • The big advantage of vboxsf is that you could re-use same drive, no need to copy things around. I share my home folder and since my build directory is there I can use to build tools inside the VM. VirtualBox however is broken in Windows10 and HyperV seems like a good software also for this use case.
    – dashesy
    Dec 30, 2016 at 22:39
5

Nothing of the above worked for me. I found a video on youtube that solves my problem without much work. the steps are:

  1. install openSSH in ubuntu guest machine: sudo apt install OpenSSH-server
  2. find the Ubuntu guess IP with ifconfig. you can install them with sudo apt install net-tools.
  3. In the windows host machine, install WinCSP
  4. In WinCSP -> New session
    • File protocol: SCP
    • Host Name: the IP of the ubuntu guess machine
    • UserName and Password: The ones from the Ubuntu guess machine.
    • Login

With all that works for me, just find enough.

1
  • This was much simpler than the other things I've tried. I should have thought of this sooner. Thanks.
    – Adam J.
    Jul 22, 2022 at 2:28
1

The answer for Windows 8 and Ubuntu 14.04 or 14.10 seems to be a bit different.

When I click on the Files icon in the taskbar, it allows one to browse the network; the host machine is listed as a machine on the network. Clicking on the host machine opens up a dialog box where it demands a password. It took me a while to find the right combination of entries in the dialog which work.

The dialog shows values for User and Password. The User value is prefilled with the account name you created on Ubuntu. This is probably NOT what you want. Take a look at the C:\Users folder on your Windows system. Whatever name has been used for that folder which contains your personal Windows files (and a lot more) is the name you want to plug into the Ubuntu dialog box. Then enter your Windows sign-in password into the password field.

After your password has been accepted, you will be able to navigate to your files in the C:\Users folder and have full access to them. Access to other files and folders depends on the Windows permissions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .