This is the scenario that you run Windows as your host operating system and Ubuntu in a VirtualBox, and that you want to access a specific Windows folder from Ubuntu.
First you have to make sure that have install Guest Additions. From the VirtualBox’s menu go to Devices → Install Guest Additions… This will mount a virtual CD on your /media/cdrom. Normally this folder’s window will show up. As root run the program VBoxLinuxAdditions.run. When the program completes reboot your VirtualBox.
With Guest Additions installed you may now go ahead and define the shared folder(s). From the VirtualBox’s menu go to Devices → Shared Folders. A dialog will show up. In this dialog you can specify which folder from your Windows system you want to share with your Ubuntu. Press the button with the + symbol to add a new shared folder in the list. You will have to specify a Folder Name for each folder you add. Make sure you memorize that name because you will need it very soon.
When done with you shared folder(s) specification, you may now go ahead and actually mount these folders from Ubuntu. First you have to create a mounpoint, that is, a directory in your Ubuntu which will reflect the shared folder from Windows:
# sudo mkdir /media/windows-share
Of course you may choose an alternative path for your mountpoint. With your mountpoint created you can now mount the shared folder, like this:
# sudo mount -t vboxsf folder-name /media/windows-share
Where folder-name will be the name you assigned for this folder when you were adding it in the shared folders list.
You could use the /etc/init.d/rc.local script to execute these commands on startup to have the shared folders automatically mounted every time you start your Ubuntu VirtualBox.
Very useful!!!
thanks a lot for this article…
From Chile – Southamerica
pamorale
thank you so much!!!
One question though, how do I used the ” /etc/init.d/rc.local” ?
I think you need to execute that in the terminal like “/etc/init.d/rc.local start”
I found the easiest way to edit /etc/rc.local for me to be:
sudo gedit /etc/rc.local
but in my machine, i get this message
mount: unknown filesystem type ‘vboxsf’
You need to install virtualbox guest additions
sudo apt-get install virtualbox-guest-additions-iso
thanx
This is just what I needed! I would add that the shared folder may need to be in the following directory: C:Program FilesSunxVM VirtualBox
Works like a CHARM. THANKS for outlining this.
Sorry, I’m pretty new to OS stuff, so my question might be quite low level.
Qn) There are several VBoxLinuxAdditions(sth).run. How do I know which one I should choose?
Great tip, thanks for sharing this! FYI this is what I added to my Ubuntu VirtualBox guest /etc/rc.local file (top section of rc.local omitted). It now connects to the shared folder automatically on startup, as the blog owner stated. Very cool! (I have _VirtualBoxShared added under Vbox menu Devices > Shared Folders. _VirtualBoxShared is the name of the actual folder on my Windows Vista host box.) The folder ubushare is what I created instead of the tutorials /media/windows-share example.
#
# By default this script does nothing.
mount -t vboxsf _VirtualBoxShared /home/ubuntu/ubushare
exit 0
And for those of us who are really new to Ubuntu but are familiar with Windows text editors, I found the easiest way to edit /etc/rc.local for me to be:
sudo gedit /etc/rc.local
Finally, a quick solution that works! Thank you!
I’ve followed the guide and I still can’t get this to work.
After I set up the folders I keep getting this :
fisher@fisher-laptop:~$ sudo mount -t vboxsf VBShare /home/fisher
[sudo] password for fisher:
/sbin/mount.vboxsf: mounting failed with the error: Protocol error
Can anyone help me out with this?
My problem was with my “folder-name” being wrong. Once I fixed that, the error went away.
I have the same problem solved by folder name correction.
thanks for sharing this, couldn’t be easier !
thanks for sharing, this definitely was a quick solution to my problem… much appreciated…!!!
I have a question… Is it possible to unmount the shared folder??? I accidentally put it in the wrong directory…I’m an ubuntu noob…
thanks ,a lot ….it really workssssssss
Thanks a lot!! Very helpful article.
Thanks a lot!!
A great solution, thanks!
Great site! You really helped me with the shared folders in virtualbox.
Good luck being smoke free!
You made the right decision.
mount is not working for me!
but I use this command instead:
mount.vboxsf NAME /PATH/TO/FOLDER
Thanks for documenting this. I’m used to a few other VM tools where this is all automagic, I couldn’t figgure out why it wasn’t working.
Anyone having problems might be helped be this link:
http://forums.virtualbox.org/viewtopic.php?f=8&t=17827#p77284
I was initially getting something along the lines of “filesystem vboxsf unknown” but resolved it by following the steps in that post.
Note: do not run “guest additions” shell script from the window manager — use the command line. I tried running the script by double clicking on it and it did not work (permission problem, probably).
Works now!
>>I have a question… Is it possible to unmount the shared folder??? >>I accidentally put it in the wrong directory…I’m an ubuntu noob…
I had the same problem =)
To unmount folder use this:
sudo umount /media/windows-share
where /media/windows-share – your wrong directiory
I’ve spent about 20 hours trying to find help on this… and found your article, which solved my issue in 2 minutes! Thanks!
as clear as crystal.
Thanks
This was very useful, thanks!
@fisher
- Check to make sure that “vboxsf” is the name of your shared folder in “Devices > Shared Folders”. That was causing the same error for me.
This is a great article. The only suggestion as a Linux newbie is that a detailed explanation of the sybtax would be great to get a complete understanding.
Glad I found this article. You saved me many hours of going throuhg the docs. Thanks !
Help a newbie
How do i avoid to insert sudo mount -t vboxsf folder-name /media/windows-share
every time a start ubuntu?
And how to make it available at “PLACES”
tks in advance
forgot to add
great post
Hi,
Thanks a lot! Worked great!
I had to:
sudo apt-get install dkms
then reinstall the guest additions, reboot and then:
sudo mount -t vboxsf folder-name /media/windows-share
and it worked.
Wonderful! It worked exactly as the article published. Helps me playing with my Linux toy
thanks a lot. . .It’s really an easy solution to the specified problem! ! ! nd ur solution works like a charm! ! ! ! ! !
so far that sums up my linux experience. why do i have to do something as fundamental as mounting a drive using the command line?? i don’t want to go back to the DOS days, it’s 2009 not 1989. could you please describe how to do this using a gui?!!
Nice one. I *needed* this info
To have the shared folder show up when you boot Ubuntu, add a line like this in /etc/fstab:
folder-name /media/windows-share vboxsf uid=myusername 0 2
Don’t use a startup script to mount a filesystem.
fisher, I had this problem too
You need to run the command from another dir (e.g. do not run it from the /media dir)
Anyways, great tutorial – Thanks!
Thanks… it worked…
Just as an alternative – you can configure your guest network adapter as bridged. This will allow the guest to get an address on the same subnet as your host from the DHCP server. From there, you can use WinSCP to copy files back from a linux installation that has SSH set up on it.
Perfect Thank you it works
had to use mount.vboxsf, mount -t vboxsf wouldn’t work for me. thanks!
Hi, I did the above and it works, but I can’t write to it from Ubunto, it say’s Permission denied. I tried to sudo chmod, sudo chown. In the virtual box I did set it to mount permanently, but did not check off readonly. In windows I did the same. I can write as root, but just not as the regular user
Awesome, thank you so much!
Thanks loads for this! Very easy to follow and helpful.
Worked like a charm! Thanks!
Thanks. Now I can share files. Also, thanks donnie for the tips.
Now, to figure how to make the windows-share as a desktop shortcut….
“Now, to figure how to make the windows-share as a desktop shortcut…. ”
Nvm, ctrl+ shift drag did the trick.
Good tip. Thank you.
Excellent, a Big Thanks!!!!
Great!
Also works well for USB-Sticks. (I never found a way to reliably accesss them under VirtualBox.) Thanks!
thanks for the pointer. i did this and it worked flawlessly.
so i got the brilliant idea to share a fat32 usb disc rather than repartition my ntfs drive (permissions issues with ntfs not fun). so i shared my empty usb disc and mounted it, but i couldn’t ls on the disc. said:
“/bin/ls: cannot open directory .: Operation not permitted.”
what the? it worked 2 minutes ago!
it seems the disc IS working, but for some reason ls fails on an empty disc. so i created a text file:
vi hi.txt
i edited and saved the file. worked fine. i was then able to ls on the top-level directory.
Thanks … It really helped me to mount a windows shared box on Ubuntu
Really simple and nice blog
Why in the world does this require us to use the command line? Ridiculous. Make it show up as a virtual thumb drive or something.
If you’re root (“#” signal is showed), why do you proceed sudo command?
Thank you. Worked great!
@Teiji: Thanks for the “ctrl+ shift drag” tip!
Thank you very much. Worked like a charm.
Thank you a lot for this. VirtualBox configuration is confusing. You were clear and it works perfectly.
Congratulations!
I typed “configuration” meaning “documentation” lol
I’m sorry, I’m too sleepy
I can see the entire c: drive when I do an ls -la ~/shared. but when try to cp a file to ~/shared I get “cp: cannot create regular file `/home/mrentz/shared/redmine-0.9.3.tar.gz’: Protocol error.”
What am I doing wrong?
It would be awesome to get it working now that I’ve got this far.
Cheers!
Forget previous message… I’ve figured it out and got it going. I just cd’ied into ~/shared/vboxsf (which is on the C:/ drive) and did a cp ~/path/file .
boom boom and wallah!
p.s. this is my first submission to an online post “ever”!
I think you people who read and help on these things are Sooooo Coooool
You freakin rock… I too had to run the installation via command line though.
you save my time. Bunch of thanks.
Many many thanks buddy.
V.Good.
Thanks a lot for posting this, it worked like a charm. Will link this later when I write it down on my blog.
thx !
thanxxx
hey buddy can u help me in starting opensource developement under linux
Excellent…thanks. I followed it and worked great. I was looking for it for a while now. It works great. Thanks a lot.
Thanks for posting – this issue seems to cause a lot of confusion.
However, I do think the posters who wish to see how to mount the drive in the Ubuntu GUI.
Thanks for posting – this issue seems to cause a lot of confusion.
However, I do think the posters who wish to see how to mount the *folder* in the Ubuntu GUI.
thanks dude
Thanks!
Thank you!
Thank you, I have checked other tutorials and they were not successful but this one worked a charm. Thanks
Thanks, this is really helpful!
Ok this is great n all but… when I try to mount I get
user@user-desktop:/$ sudo mount -t vboxsf PDWNLDS /home/user/pdwnlds
[sudo] password for user:
/sbin/mount.vboxsf: mounting failed with the error: No such file or directory
User=me but not real me
so WTF? Ive been working to solve this issue for 6 days now! Fracking G@Y! I have the folder shared etc and it still wont mount, been to hundereds of sites without any success and even tried to get a product to mount the virtual disk so I can just extract my fracking data…you know if all you linux people want others to use linux instead of windows…MAKE IT FRACKING SIMPLER and GUI FRIENDLY!! So tired of this l33t speak shit makes me want to puke JUST TELL WHAT THE FRACKING SOLUTION IS and GET IT OVER WITH!
Do this before mount.
mkdir ~/pdwnlds
or
mkdir /home/user/pdwnlds
when logged in with other than ‘user’ account.
@Noobulon,
I had the exact same problem. What I had done wrong was I hadn’t written the path correctly. I’d double check the path if I were you.
I have a problem When I install an error occured it says that “unknown file system ‘vboxsf’ ”
By the way I’m using Ubuntu 10.10 is it because of the version or what??
please tell me about this problem immediate action is highly appreciated.
Dotcom
Thanks! great resource…
Thanks for this simplicity. It works but in my case I need to run through the whole process including installation… I am newbie… any clues?
How about if i’m using live cd to run ubuntu 8.04 on vbox ?, is’nt work properly…..
Thank you for precisely showing how to do this. It works! Thanks again! I am confused on how to make changes to rc.local because it opens read-only but I’m a newbie and sure I’m doing something wrong. Probably rights related. Also, another user recommended modifying fstab instead of rc.local – not sure what the difference is and what’s better. Thanks!
I’m running a Vista host and Kubuntu 10.10 guest.
Thanks for your excellent article. I’m new to this. It only took me two days to do this. So many people have posted replies I thought I should try to remember what worked for me. I finished about midnight so it’s kind of a blur but here is what I can remember. First I got errors when installing the VB Additions I copied the error into Google and found this VB forum post http://forums.virtualbox.org/viewtopic.php?t=15679 that states extra packages must be installed. After doing that VB Additions installed correctly.
I created a shared folder in windows C:AA and a shared forlder in Linux in my home dir called ‘host’.
I used Dolphin to create the linux folder.
I had a lot of trouble with: sudo mount -t vboxsf folder-name /media/windows-share
My errors were using a path for the windows ‘folder-name’ like win-pcAA. All that’s needed is the folder name ‘aa’.
Also, the win and linux folder names must be different.
Writing to ‘/etc/init.d/rc.local’ must be done as root. This page http://forums.virtualbox.org/viewtopic.php?t=15868 also helped change the ownership from root to me.
Thanks again.
This worked great! Thanks!
to mount the shared folder @ boot time, add the following commands in a terminal.
sudo su
gedit /etc/init.d/rc.local
mount -t vboxsf VMshare-win /home/hitman/Desktop/VMshare-Ubu
where “VMshare-win” is the folder created in Windows host OS
and
“VMshare-Ubu” is the folder created on Ubuntu guest OS.
note: add the last line @ the end of rc.local file.
Took me a great deal of time to get this solved. As I read somewhere before, it isn’t at all expected that any Ubuntu user as to deal with DOS like commands to get things going, especially newcomers.
I found a webpost with the easiest solution to sharing folders between Host OS (Win7) and Guest OS (Ubuntu 11.04) with VirtualBox:
http://www.manhinli.net/blog/2011/03/18/permanently-sharing-folders-in-virtualbox-4-0-4-with-ubuntu-10-10-guest/
I hope this saves a lot of someone else’s time looking for a way to make things work!
I found this when trying to set up share folder(s) between BackTrack guest OS with XP 2000 Prof host. Hope this also saves your time too!
http://foxlinx.wordpress.com/2010/02/03/virtualbox-installation-windows-host-with-a-backtrack-4-guest-and-virtualbox-linux-guest-additions/
Hi HItman,
I tried to do the same u mentioend regarding adding the command to etc by gedit, but I have run into problems. Now, when ever I open my places and enter home folder, I am not able to open the folder, but it opens gedit with error showing /home/ is not the directory. How can I solve this problem and revert back to see my home folder.
hello
every time when i reboot share folder does.t work
why ?
help me
Thanx!
This was really helpful!
K.
Worked great!
Many thanks!
Worked great! The Unbuntu and VirtualBox sites were unclear in their instructions, and had bad examples. You laid it out simply and it worked the first time! Thanks!
Worked, very good instructions. I have been searching on the web and have found many instructions but never explained in a maner I could understand or apply. Thanks.
Thanks! Really helpful for a newbie that just started using virtualbox and ubuntu. search all over for this.
Thanx bitch
thanks a lot .it worked for me….
Thanks a lot..I have been searching for this since long…
yes, its working and thank you so much, i’ve been searching for this for hours and finally solved!
thanks in advanced!
I’ll right away clutch your rss as I can not find your e-mail subscription link or newsletter service. Do you have any? Please allow me recognize so that I could subscribe. Thanks.
I’m using this guide as part of my edx.org course. First thanks for sharing. Now for the issue I had (and solved).
I’m not a Linux person, so this wasn’t obvious for me, but when creating the share as above I found I could not write to the share from the guest system, I got a “permission denied” message when trying to do mkdir which sucked when trying to use GIT having to sudo everything. (Note the host is OSx so this might be a Unix permissions issue, Windows users may have it easier?)
As a solution to the Permission Denied error:
1) I put the OSx host folder somewhere freely writable (IE. to be on the (un)safe side) in my public folder and shared it. Note I’m on VPN so no worries about intruders in my home office! this part isn’t a great way to solve this though.. comments anyone?).
2) Did all of the above. No issues.
3) Checked I could ‘see’ the host from in Ubuntu.
4) And this is the magic… Do this on the shared folder in Ubuntu to make it writable to your ‘regular’ account
sudo chmod 777 ~/Documents/MyShare
The above plus the host machine permissions combined allowed me to write to the folders from both my OSx machine and the Unbutu virtual box.
Anyone with tips on how I could do without using the public folder on OSx please comment! It’s not an ideal solution…
Thanks a lot!
ΘΑΥΜΑΣΙΕΣ ΣΥΜΒΟΥΛΕΣ!!!! ΕΥΧΑΡΙΣΤΟΥΜΕ
I did all than and works. I even add the script at the end of /etc/init.d/rc.local and its ok. Thanks a lot!!!
For Mac OS user see thread http://ubuntuforums.org/showthread.php?t=1398340 to get help on permission issues.
Thank you.
Guys,
A super noob and Linux’s and VirtualBox here.
How was it for this one:
# sudo mount -t vboxsf folder-name /media/windows-share
if I wanted my Shared Folder on my other Windows drive (e.g. D:My Shared)?
Haha, stupeee meee!
I’m talking about the ‘Folder Path’ (duh) (on the Edit Share dialog), when all I have to use is supposed to be the next entry which is ‘Folder Name’…
Solved on my end,
Thanks thanks……………….
Really helped.. Simple to understand and easy to follow..
Thanks a lot!!!!
Cheers!
Thank you very much. I’ve been looking for this for a long time
U sir are a genius! I spent almost 3 hours trying to share a folder until i found this site. Thx!!
awesome, exactly what I am looking for
i followed your instructions, $ sudo mkdir/media/windows-share and the machine replies with command not found! i’m using windows 8 host and ubuntu 12.04 as guest on virtual box. somebody help, please, i’m a newbie
linda…
you are missing a space between mkdir and the slash
Why not modify /etc/fstab instead of /etc/init.d/rc.local?
Fully Agreed with the points here, and it shows a great deal of correct sense. Thanks for the wonderful flow of information
THank you so much ! Am a newbie and this helped me a lot !
Loads of thanks for posting this!! Very useful and saved a lot of time!! I was just banging my head around for sharing folders…. Great work!!
thank you so much! I needed this for a project.
Thanks a lot!
Some heads up for beginners. Terminal is where you will be entering your commands for Ubuntu. If after you open terminal it does not say (roo)t you need to enter “sodu su”
Default password is “adminuser” if prompted.
From there I found that it was easiest to drag and drop the “VBoxLinuxAditions.run” file.
Then followed the directions and everything else worked flawless.
“sudo mkdir /media/windows-share” //no qutoes
followed by
“sudo mount -t vboxsf NAMEOFYOURFOLDERHERE /media/windows-share”
Thx, this help me a lot
Thanks dear…
Thank you so much.
I have been struggling for a week now.
The /etc command was found nowhere else but here! That did the tick I think.
Thanks once again.
Hi,
i install my system ubuntu 12.04 and in virtualbox we create window xp. how share folder between this two ( ubuntu host and windows xp guest).
Thanks
Thank you. A simple solution that works.
Thanks, your solution helped me very much!
This blog was… how do I say it? Relevant!! Finally
I have found something which helped me. Thanks a lot!
Wow! At last I got a website from where I know how to really get valuable information concerning
my study and knowledge.
Very interesting,thank you
thank you so much for help
For all dummies (having already installed Virtual Box additions and in VirtualBox having Shared Folders already linked/created):
1. run terminal (in Tab “Applications” “Accessories” these are below Machine View Devices Help on your Desktop)
2. via copy/paste:
gksu gnome-terminal
(this makes you to root)
3. (maybe this is not necessary but I have done it, move to your folder “/media” where are sf_ folders located ) so paste:
cd /media
4. command “dir” shows you all shared folders so paste:
dir
- this will show you how the folder looks like, mine is:
sf_E_DRIVE sf_NTFS sf_Windows7 windows-share
sf_New_folder sf_RAMDisk VBOXADDITIONS_4.3.24_98716
5. Now for the folder sf_E_DRIVE execute command (without the sf prefix):
mount -t vboxsf E_DRIVE /home
(Note: my E_Drive has a FAT32 formating – works fine, my NTFS drive has formating as the name it says and it does not work)
6. move to folder /home and you should see your shared files
cd /home
Hi, that’s a negative!..:)
^^ gksu is depreciated & the *correct* CMD to use is: pkexec (to run applications as root with graphical authentication)
Ehh, forgot to clarify /add: pkexec is anything but handy, if you’re trying to run any sort of other-than-extremely-known application, it requires PolicyKit (!); & I don’t know whether this is cool, or not… Here’s a link, about it @webupd8.org/2015/03/how-to-run-gedit-and-nautilus-as-root.html
Btw., as I’m checking (all) this out – while I’m posting – noticing that teh Xubuntu 15.10 (Ubuntu) Software Center is loading Mint Cinnamon, when searching for PolicyKit, which is total madness: pkexec is NOT new, it’s been around for a couple of builds -now- and on top of it all, it’s become neccessary… So, for this to occur – ah, idk. xD
*screenshots upped 2 imgur.com/a/6coOO
I would like to ad following useful command: sudo adduser your_username vboxsf
so mine is milanosz and this looks like:
sudo adduser milanosz vboxsf
it removes problems with editing /etc/init.d/rc.local, it makes the change permanent.
Thanks,It worked very well for me.
While this would look nice in /etc/fstab, as some people have mentioned, that’s not the whole story: to mount this share, you need the vboxsf kernel module loaded. Out of the box, that module is loaded *after* /etc/fstab is processed, meaning boot will hang if you have it there. To mount at boot, either put it in /etc/rc.local, or change the boot order to ensure the vboxsf kernel module is loaded before /etc/fstab is processed.
Another solution is to put it in /etc/fstab with the noauto option. This puts the configuration in the logical place (fstab) but allows you to mount later, with just mount /mnt/… (no further options).
Very useful…thanks a lot for sharing this..
Thanks a lot for sharing this
Thanks!
Thanks a ton !!
If you want to learn more about shared folders on VirtualBox (Linux Mint/Ubuntu Desktop) you can checkout VirtualBox Shared Folders on Linux Mint (video tutorial).
I am rnnuing Linux Mint 9 Isadora as guest in VirtualBox on a Windows 7 host, been rnnuing it for a few weeks now and almost all the Compiz effects run smoothly, except for the cube. I can spin it, but it more than often tends to have a life of its own, jumping, spinning and bouncing like crazy making me lose control of it. This never happened to me when I ran Linux in dualboot with Windsows before. I wanted to run Linux in VirtualBox so that I could have either OS available to me at all times without the need of rebooting. I love rnnuing Linux like this but I would like to know if anyone else have experienced the cube having this kind of behaviour in VirtualBox before and if there’s a way to make it spin more smoothly?
Hello.
I have a question, i already mounted the windows partition on Ubuntu but I can not write on it. Even when i dont have the check of just read.
How can I do to write on it??
Thanks
Ps. I also did the chmod -R 777 process
Thanks!
Great! thank you so much.
This got me up and running….thanks!
Great thanks to you!
Great thanks to you!
Just what I need for my little script factory which runs on a small guest system but creates to much output to be stored. So I can move it to windows and handle it from their.
Thanks
Great Thanks to you! very useful post.
hi,
i wanna connect those folders immidiatly when i open to virtualbox . i dont want to write “mount” code on the terminal. it can connect itself. how can i do ? i wrote to /etc/rc.local but it isnt connect i have to start /etc/rc.local.
Thank you! Your article is still relevant today, only now did I realize I didn’t have the guest additions installed (which I had initially read online should be installed automatically).
Had to give a shout out for this very easy little tutorial. Worked great!
Doesn’t work “/sbin/mount.vboxsf: mounting failed with the error: Protocol error
“
Hello patrida,
I suppose that your instructions apply to version 8.04. I intend to use such an old version because my computers do not much processing power in order to use a newer (and more demanding) one.
Have you written any article for a WiFi connection?
I have two PC, one with Win7 and another with Win10. I want to install Ubuntu 8.04.
How can I setup it in order to provide Internet access through a USB WiFi connected to the host?