I tried sshfs
, but the local directory where I want to mount a folder from the VM does not open after running the command.
How can I mount a folder from an ubuntu virtual machine on ubuntu?
791 views Asked by Kumar Deepak At
2
There are 2 answers
0
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
Guest Additions
on the virtual machine. These can be dowloaded from within the virtual machine from the Devices > Install Guest Additions menu.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.