How to enable shared clipboard or files in VirtualBox?

Questions about virtualization software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Post Reply
szymon1051
Level 2
Level 2
Posts: 88
Joined: Sun Apr 23, 2023 1:18 pm

How to enable shared clipboard or files in VirtualBox?

Post by szymon1051 »

I try this https://superuser.com/questions/42134/h ... 15#1158015
Image
Image

If I have Windows as guest and Mint as host the clipboard bidirectional.
But share file drag and drop not work any guest to host and host to guest

If I have LMDE as guest and Mint as host not work any, clipboard share or drag and drop.

Can fix this?
RIH
Level 9
Level 9
Posts: 2910
Joined: Sat Aug 22, 2015 3:47 am

Re: How to enable shared clipboard or files in VirtualBox?

Post by RIH »

My experience - from a couple of minutes ago..

Mint 21.3 Host...
Windows 7 & LMDE6 guests - could drag and drop to the guest but impossible to drag and drop back onto the host - the File/cursor refuses to leave the confides of the VirtualBox guest screen.

I had not noticed this before, largely because I have never attempted to use Drag & Drop to move files between Host & Guests.
I have a Shared Folder set up on my Mint Data drive & all my guests have Shared access to this, that is how I move files between.

Copy & Paste works fine with my Host & all my Guests..
Image
harry_fine
Level 2
Level 2
Posts: 57
Joined: Sat Aug 17, 2019 2:38 pm

Re: How to enable shared clipboard or files in VirtualBox?

Post by harry_fine »

I assume you have guest additions installed?
User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: How to enable shared clipboard or files in VirtualBox?

Post by AndyMH »

RIH wrote: Mon Mar 04, 2024 11:28 pm I have a Shared Folder set up on my Mint Data drive & all my guests have Shared access to this, that is how I move files between.
Likewise and I would go further, DO NOT save data files in a VM, save them on the host via a shared folder.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
RIH
Level 9
Level 9
Posts: 2910
Joined: Sat Aug 22, 2015 3:47 am

Re: How to enable shared clipboard or files in VirtualBox?

Post by RIH »

harry_fine wrote: Tue Mar 05, 2024 10:51 am I assume you have guest additions installed?
Yes, and the Extension Pack - you can't Share folders between Host & Guest without the extension pack in place..
Image
User avatar
Pierre
Level 21
Level 21
Posts: 13228
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: How to enable shared clipboard or files in VirtualBox?

Post by Pierre »

another thing that I've often done,
- is to use an usb stick - as the shared folder -
as this option, allows files to / from other PCs as well. . .
Image
Please edit your original post title to include [SOLVED] - when your problem is solved!
and DO LOOK at those Unanswered Topics - - you may be able to answer some!.
User avatar
Drugwash
Level 5
Level 5
Posts: 734
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO
Contact:

Re: How to enable shared clipboard or files in VirtualBox?

Post by Drugwash »

There may be incompatibilities between the VBox version and the guest kernel version. Pay attention when updating the guest kernel, there may be an error showing when trying to build guest additions for the kernel.
szymon1051
Level 2
Level 2
Posts: 88
Joined: Sun Apr 23, 2023 1:18 pm

Re: How to enable shared clipboard or files in VirtualBox?

Post by szymon1051 »

RIH wrote: Tue Mar 05, 2024 9:09 pm
harry_fine wrote: Tue Mar 05, 2024 10:51 am I assume you have guest additions installed?
Yes, and the Extension Pack - you can't Share folders between Host & Guest without the extension pack in place..
To mount need this "Insert Guest Additional CD image..." or "Upgrade Guest Additions..."?
virtualbox.png
virtualbox.png (41.13 KiB) Viewed 553 times


If use this "Insert Guest Additional CD image...".
How install from cd?

RIH wrote: Mon Mar 04, 2024 11:28 pm I had not noticed this before, largely because I have never attempted to use Drag & Drop to move files between Host & Guests.
I have a Shared Folder set up on my Mint Data drive & all my guests have Shared access to this, that is how I move files between.

Copy & Paste works fine with my Host & all my Guests..

How mount this folder in Linux?
RIH
Level 9
Level 9
Posts: 2910
Joined: Sat Aug 22, 2015 3:47 am

Re: How to enable shared clipboard or files in VirtualBox?

Post by RIH »

Use the "Upgrade Guest Additions" .
Guest Additions has come with the Oracle VirtualBox .deb file for a couple of years now.
Prior to that it used to be an additional iso that you had to download & mount.

The extension pack can be downloaded from here..
https://www.virtualbox.org/wiki/Downloads
VB.png
If you are in Linux then you just need to double left mouse click for VirtualBox to open & load it.
You will need to go to your user (Menu - User & Passwords - click on you & then click on groups) & add vboxusers as a group.
VB2.png
To add a Shared Folder.. (without the guest being loaded)
Go to Settings - Shared Folder tab
Click on the + sign & then the drop down arrow & select Other
VB1.png
That will open up a new window allowing you to search the contents of your computer.
NOTE: If the Folder that you wish to share is on a separate drive from your Operating System then you will probably need to go to /(root) & then the Media Folder & then select you name & all drives will become visible.
After you have selected your Folder to share then you will be offered another screen asking if you want the drive automatically mounted, read only (& something else that I forget at the moment). I always ask for it to be Automatically mounted.
The shared Folder will appear like this in Windows..
VB3.png
Image
szymon1051
Level 2
Level 2
Posts: 88
Joined: Sun Apr 23, 2023 1:18 pm

Re: How to enable shared clipboard or files in VirtualBox?

Post by szymon1051 »

How mount share folder on guest Linux system?
User avatar
Drugwash
Level 5
Level 5
Posts: 734
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO
Contact:

Re: How to enable shared clipboard or files in VirtualBox?

Post by Drugwash »

User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: How to enable shared clipboard or files in VirtualBox?

Post by AndyMH »

szymon1051 wrote: Sat Mar 09, 2024 4:24 pm How mount share folder on guest Linux system?
In virtualbox settings > shared folders for your VM click the icon top right with the + symbol.
Screenshot from 2024-03-09 21-53-47.png
In the window that pops up:
  • Folder path - this is the folder on the host you want to share, I'm sharing all of my home folder. You can click on the down arrow and navigate to the folder in the host you want to share.
  • Folder name - not sure this does anything.
  • Mount point - this is the folder on the guest where the shared folder will mount. I have chosen to mount the share in the guest at /home/andy/mint. I have the same username in the host and the guest, makes life simpler.
Make sure you check auto-mount and make permanent checkboxes.

Boot your linux guest and create the folder for the mount point, in my case /home/andy/mint. For shared folders to work in linux guests, the user in the linux guest must be a member of the vboxsf users group. Open a terminal in the guest and

Code: Select all

sudo usermod -aG vboxsf $USER
You only get added to this group after a reboot of the guest, so shutdown and restart the VM.

This is ubuntu running in a VM, you can see the shared folder, mint, and that it has 512 items in it.
Screenshot from 2024-03-09 22-08-49.jpg
I believe that for shared folders to work you need the extension pack installed in VB, you might need guest additions in the guest - not sure.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
User avatar
Drugwash
Level 5
Level 5
Posts: 734
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO
Contact:

Re: How to enable shared clipboard or files in VirtualBox?

Post by Drugwash »

AndyMH wrote: Sat Mar 09, 2024 6:15 pm you might need guest additions in the guest - not sure.
Definitely.

If this type of sharing just won't work one can always try to enable a second network connection on the guest (in VBox settings), and mount the respective shared folders both on guest and the host.

This would help when the Guest Additions cannot be built due to issues with the guest kernel, usually happening when the VBox version is too old and guest kernel is too new, or vice-versa.

Recently I found some distros just can't deal with sharing folders so I just use this network alternative where my Drive Mapper helps mounting shared folders easily in a graphical interface.
User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: How to enable shared clipboard or files in VirtualBox?

Post by AndyMH »

And there was me thinking that drive mapper was not the answer, still learning. Looking at the package I think you are the dev? Is installation extract the archive and run setup.py?
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
User avatar
Drugwash
Level 5
Level 5
Posts: 734
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO
Contact:

Re: How to enable shared clipboard or files in VirtualBox?

Post by Drugwash »

Yes, I am the developer. Created it out of the same frustration of not being able to share drives/folders with VMs and also to avoid all the desktop clutter created by any mount/unmount launchers.

Installing the deb package one should only type drivemapper in terminal, or create a launcher and use that one.
Otherwise it can be launched from an arbitrary location through pkexec drivemapper.py. It requires elevated privileges because it runs nmap and other commands that need it.

EDIT: it may not be perfect but I have the password requirement disabled on my system (that is, my user always has elevated privileges, nothing asks for my password) so I'm not sure how it fares on other more tightly-secured systems.
User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: How to enable shared clipboard or files in VirtualBox?

Post by AndyMH »

I didn't spot the deb, where is it?

polkits - I've done the same with other applications, gparted being one.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
User avatar
Drugwash
Level 5
Level 5
Posts: 734
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO
Contact:

Re: How to enable shared clipboard or files in VirtualBox?

Post by Drugwash »

https://gitlab.com/linux-generic-and-ci ... type=heads

It's in the releases folder. GitLab is a bit different than GitHub or Codeberg.

Oh, the new code that I should upload sometimes soon may work a bit better but I haven't had time to do it yet. There are a few distros that don't work as they should with the current code, and I'm not well versed in packing deb packages either. :oops:
User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: How to enable shared clipboard or files in VirtualBox?

Post by AndyMH »

Drugwash wrote: Sat Mar 09, 2024 9:43 pm I'm not well versed in packing deb packages either. :oops:
Thanks found the deb. I only learnt enough to package foxclone into a deb and as for other package formats - only do debian/ubuntu, sorry. Looking at the content the only thing I might add is a preinst script - to check and remove an old version when upgrading. Anyway, enough, drifting well off topic.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
szymon1051
Level 2
Level 2
Posts: 88
Joined: Sun Apr 23, 2023 1:18 pm

Re: How to enable shared clipboard or files in VirtualBox?

Post by szymon1051 »

Just hover over sharing folders and everything was explained :oops: .
virtualbox2.png
I tried this but I can only read and not write.

Code: Select all

mount -t vboxsf name_of_share_folder mount_point
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: How to enable shared clipboard or files in VirtualBox?

Post by altair4 »

Based only on that picture you have no shared folders so there is nothing to mount.

Go through AndyMH's steps and try it again: viewtopic.php?p=2442081#p2442081
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Post Reply

Return to “Virtual Machines”