0

I'm running Ubuntu 12.04 Server (guest machine) on VirtualBox having Windows 7 as host machine.

I make a "Server12.04" named folder on my Host machine desktop & shared the same in Virtual Box (ticked the auto-mount option). How can i access the shared folder in the guest machine (which is Ubuntu server 12.04).

I got one refrence answer from Link but this was not helpfull. Whenever i tried to share the folder i got the following error :-

The program 'VmBoxManage' is currently not installed. You can install it by typing apt-get install virtualbox. Means why to install VirtualBox inside the VirtualBox ??

Please help me out . Thanks in advance !!

1

2 Answers 2

0

On your host OS, you create the shared folder by running

VBoxManage sharedfolder add "VM name" --name "sharename" --hostpath "C:\test"

On your guest system, you have to run

mkdir /home/<user>/vboxshare
sudo mount -t vboxsf -o uid=1000,gid=1000 share /home/<user>/vboxshare

VBoxManage can change the settings of a VirtualBox, but if you already have this share created, there's no need to run this command.

2
  • @davidbaumaan i have windows 7 as my host machine & having "share" named folder on my desktop which i want to share with my guest OS which is Ubuntu Server 12.04 (on VirtualBox) ?? you got me Dec 26, 2014 at 17:08
  • Did it work? OF course, you have to adjust the command according to your needs. Dec 7, 2015 at 18:28
0

TL;DR

On Ubuntu Server, without guest additions, manually mount the shared folder on the guest, e.g.:

mkdir /mnt/sharedfolder
sudo mount -t vboxsf FolderNameInVBoxSettings /mnt/sharedfolder

If the above works fine, add a corresponding entry in /etc/fstab to make it permanent.

Detailed Intructions

Let me share what has worked for me in two different setups, an Ubuntu 20.04 LTS Desktop and an Ubuntu 20.04.3 LTS Server on a Windows 10 host. I will use an example username sun. The first step is common, and is done via the VirtualBox UI (I have 6.1.26 at the time of posting), by selecting the target VM and going to Settings > Shared Folders and clicking the "Add shared folder" button:

shared folder settings

On the dialog box, I entered the Windows source path in "Folder Path", an arbitrary name for the shared folder under "Folder Name", and the "Mount Point" which is a valid path of my choosing, on the guest. Note that "somename" should be an empty directory:

add shared folder details

For Ubuntu Desktop

For a desktop, I also ticked the "Auto-mount" option above. Assuming that guest additions have already been installed, and that the somename directory exists, then that's all there is to it. The shared folder will be visible, even on reboot.

To avoid having to use sudo every time to access the shared folder, I did one more thing:

sudo adduser sun vboxsf

For Ubuntu Server

For the server, without guest additions installed, I took note of the ArbitraryName above, because I will need to use the same name for the mount command on the Linux guest:

mkdir /home/sun/somename
sudo mount -t vboxsf ArbitraryName /home/sun/somename

I check that I can see the files:

cd /home/sun/somename
ls

Yes, the Windows files are there! But this mount will be lost on reboot, so I make it permanent by adding an entry to /etc/fstab:

$ sudo vim /etc/fstab

# My VirtualBox shared folder entry in /etc/fstab
ArbitraryName    /home/sun/somename   vboxsf   defaults  0   0

Again, ArbitraryName must be the same one specified in VirtualBox settings, i.e. the same one we used in the previous mount test command. Now I can reboot the machine and after login, I can do ls /home/sun/somename to see my Windows shared folder files! As a bonus, I didn't like the green highlight on the shared folder directories, so I added the following to my ~/.bashrc:

export LS_COLORS=$LS_COLORS:'ow=1;34:';

The above gets rid of that highlighting but still keeps the other colors, such as blue for directories. Hope this is helpful!

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.