Skip to content

Mounting shared folders in Ubuntu Server running on VirtualBox on startup

March 11, 2011

sudo mount -t vboxsf sharedFolderName /dir/created/by/you

It’s necessary to mount specifying an existing self-created directory for permissions reasons. Auto Mount mounts to a locked /media/sf_sharedFolderName dir that makes it impossible to view the shared folders via HOST browser.

Remember to edit the /etc/apache2/sites-available/default file to point the DocumentRoot toward the shared folder path! (Or create the shared folder path as a subdir of /var/www/) if you want to access the shared folders via browser on host.

To add this script to the runtime configuration, first add the script to a file in /etc/init.d, ie:
sudo nano /etc/init.d/mounting_script

Change to containing directory:
cd /etc/init.d

Then alter the permissions to allow root execution (THIS IS KEY!):
sudo chmod +x mounting_script

And then run the following to add to startup scripts:
update-rc.d mounting_script defaults

On a related note, to unmount any mounted shared folders:

sudo umount -a -t vboxsf

Advertisements

From → VirtualBox

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: