How can I mount a folder from an ubuntu virtual machine on ubuntu?

801 views Asked by At

I tried sshfs, but the local directory where I want to mount a folder from the VM does not open after running the command.

2

There are 2 answers

0
Melvin On BEST ANSWER
  1. Install the Guest Additions on the virtual machine. These can be dowloaded from within the virtual machine from the Devices > Install Guest Additions menu.
  2. Add the folder you wish to share to the Shared Folders, this option can also be found in the Devices menu.
  3. The folder can now be mounted with

    sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) folder ~/host

For more info, or troubleshooting, check out this Ubuntu Help article.

0
BenJ1337 On

OS: Ubuntu
Install the VBoxGuestAdditions. You don't have to reboot the system.
See https://download.virtualbox.org/virtualbox/ for newest available version...

$ wget https://download.virtualbox.org/virtualbox/7.0.10/VBoxGuestAdditions_7.0.10.iso -P /tmp
$ sudo mount -o loop /tmp/VBoxGuestAdditions_7.0.10.iso /mnt
$ sudo apt-get install bzip2 tar
$ sudo sh /mnt/VBoxLinuxAdditions.run

After that you can use the GUI for mounting folders. You must close the modal window with the listed folders, to actualy add your newly added folder. The folder doesn't have to exist on the guest, it will be create.

You also have to add your user to the group 'vboxsf' in the guest os, to get access rights for the shared folders:

$ sudo usermod -aG vboxsf $USER
$ newgrp vboxsf