Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have Ubuntu installed in Virtualbox. I want to mount my VirtualBox shared folder in Ubuntu automatically when I log in Ubuntu. I put the following line in my ~./bashrc and ~/.bash_profile:

sudo mount -t vboxsf windows_share /media/windows_share

where windows_share is the name I created with Virtualbox. But everytime I start my Ubuntu, it asks me for passwd since it needs sudo. Is there anyway to automatically mount Windows share without entering password every time I log in?

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

To always mount a Virtual Box "shared folder" on booting an Ubuntu guest we have two options. It is up to personal preference which option works best in our setting.

1. Mount with fstab

To mount a shared folder using the vboxsf filesystem provided with Guest Additions we first need to make sure prerequisites are met. Then we may put the following line in our etc/fstab file:

<name_of_share>   /path/to/mountpoint   vboxsf   <options>  0   0

Replace name_of_share and /path/to/mountpoint with your individual setup (the directory for the mountpoint has to be created first). See the manpage for mount for mount <options>. One possibility is to mount with defaults, or to give specific mount options (e.g. rw, suid, exec, auto, users).

2. Mount with Virtual Box "automatic mounting":

In recent releases of Virtual Box we can also automatically mount shared folders on creation:

enter image description here

Then this shared folder will be mounted to the guest directory /media/sf_<name_of_share> accessible to all users who had been made member of the group vboxsf.

share|improve this answer
How do you change the mount directory and mount prefix? Do you run some terminal commands in the HOST OS or the GUEST OS? –  CMCDragonkai Jan 18 at 12:12
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.