This is mainly for my own reference, but here it goes.
1. Share a folder on the host OS
- In VirtualBox, click your OS on the left and click on Settings.
- Click on the Shared Folders tab.
- Click on the folder with the plus on the right.
- Browse to a folder of your choice in the folder path.
- Enter a folder name with no spaces e.g. “Share”.
- Check Auto-mount and Make Permanent, if available.
- Click on OK.
2. Mount the folder in the guest OS
- Create a folder in your guest OS that you want to share.
- Open up Terminal.
- Type in
id
and press ENTER— remember that ID. - Switch to the
root
user usingsudo su
and enter your password. - Browse to the
etc
folder usingcd /etc
. - Edit the
rc.local
file usingvi rc.local
. - Move your cursor right above
exit 0
and press the letter “i” on your keyboard to insert text. - Type in the following:
sudo mount -t vboxsf -o uid=1000,gid=1000 Share /home/username/Documents/Share
- 1000 should match the ID you noted down earlier.
- Share should match the folder name from step 1.
- username should match your Linux username.
- /Documents/Share should be the absolute path of the new folder you created.
- Now hit “ESC”, type
:wq
and hit ENTER to save and quit the file editing.
After you restart the guest OS, your shared folder will be automatically mounted.
Thanks! This really helped me, too.
I went through everything you explained in 1. By 2 I got stuck. can anybody help me please??
I’m totally lost when it comes to “2. Mount the folder in the guest OS”. I’m using mac – sierra as a host and windows 10 in Virtual box. I’m stuck from point 2.2 “open up Terminal” onwards. What is Terminal? How do I move on to the rest..? DO you by any chance has a picture as an example to summarise these steps? Many thanks in advance for your help.
Pingback: Rails: Ubuntu Virtual Development Environment on Window « Angkor Brick
Thanks for the instructions!
I needed to make 2 small changes in order to get shared folders to work with my Linux guest:
chmod +x /etc/rc.d/rc.local
without which therc.local
commands will not be executed.Nice! Thank you for sharing that!
I followed every step correctly.
Where do i check if it shared in guest OS?
I believe it’s mounted as a disk, so you can use the file explorer that came installed with the guest OS.
hello, i followed all the steps correctly but i still cant see me “shared” folder mounted anywhere what should i do?
Excellent writeup. Worked like a charm.
Thank you so much for the tip.
Very helpful. For those who might not see the files in the shared folder, try from terminal
ls /home/username/Documents/Share
and now if you see the data but not in the file viewer, then go to/home/username/Documents/Share
in the file viewer and on the top menu go to view tab and select reload folder or F5.If you want to add a user to a group in Fedora, do the following:
Open a terminal.
Enter
su -
, hit Enter.Enter the root password, hit Enter.
Type in
usermod -a -G vboxsf username
, replacing username with the user you want to add to the group, hit Enter.You may have to reboot to remount the share, the easiest way to do this is probably to reboot the VM.
This is really helpful!! Thank you very much ! 🙂
thanks – works great.
addition:
to find your shared folder run
df -H
in my case it’s mounted on
/media/sf_NAME
Works great. Just one note, look for links to rc.local and make sure the file has the execute permission.
In my case: sudo chmod +x rc.d/rc.local
This worked like magic. Thanks.
In addition to the above steps I had to install GuestAdditions using `sudo apt-get install virtualbox-guest-utils`
Great article. Very helpful. Comment from @Fabregas finally helped to get it done. Thanks a lot!
Hi I tried to mount the file to my guest OS (Mac OS Sierra) but I got a blue screen when I tried to restart the Ubuntu OS (it is Ubuntu 16.04). Do you know why this might be happening?
Worked like charm! host: macos and guest: ubuntu.
Thanks a lot, Tried hard to share and found this, both Bidirectional Drag & Drop and Clip board sharing were not working. This really helped a lot.
Worked on Mac in which I am running Linux VM! Thanks.
Hi ,
Its not working for me I have MAC book laptop and running Centos VM . Pls help
Thanks a lot! This is the only way that makes my Mac work.
Thank you! It really helped me!
I am not sure I could follow your instruction well.
How can I verify that rc.local running without any error?
Could you help print screen rc.local as reference? since your topic match to my condition.
I use Oracle Linux 6 (Guest) with Mac OS (Host)
Dear Friend, it is working for me after I fixed by install Guest Additional CD successfully.
If anyone who did has problem with Guest Addition CD like virtualbox additions module not loaded
For my case I run this command:
# yum install kernel-uek-devel.x86_64
# /sbin/rcvboxadd quicksetup all
and Then restart your guest os.
after login with user that map in rc.local, share folder will appear on user desktop.
Thanks.
Thank you for coming back to provide the solution!
Totally late for this post, but glad I found it!
Using Catalina (Host) to Mojave(Guest). After some testing, I realized that I didn’t have to change the rc.local file at all.
– I got this to work by changing Network Adapter (specifically, adapter 1) settings related to VB specific, Mojave (Guest) preferences in VirtualBox Manager area.
– Under “attached to” change from Default NAT to Bridged Adapter & for “name” dropdown, used the very first: en0: Wifi (Airport) which produced an “192 .etc.etc.etc” (IP) in place of the “10.etc.etc.etc” for the default connection in the Guest , re: Ethernet. Makes sense.
– SMBed to Mojave(Guest) VB env via Catalina (Host, my non-virtual environment) using the Finder->Go->Connect to Server
Thanks for posting newer information with regard to setting this up!
Very helpful writeup. The tips in the comments helped a lot as well. Thanks everyone.