141

I am running VirtualBox 4.1.4 on my Windows 7 laptop, running an Ubuntu 11.10 guest.

I would like to copy text from Ubuntu's terminal and paste it into a file on the Windows host. This doesn't work for some reason.

Any ideas?

lofidevops
  • 22,012
Misha Moroshko
  • 1,669
  • 4
  • 14
  • 9
  • Note that if you have "Locate pointer" enabled (highlights your pointer when you fit Ctrl), there is a bug in 12.04 that prevents this from working. Switch off "Locate pointer" and it will work. See https://bugs.launchpad.net/ubuntu/+source/gnome-settings-daemon/+bug/9441 – lofidevops Sep 25 '13 at 11:49
  • I believe @d3vid is talking about the "Locate pointer" setting in Ubuntu, not in Windows. In Ubuntu 14.04, this setting is found under gnome-tweak-tool; see http://askubuntu.com/a/425498/159361 – LarsH Jun 25 '14 at 19:11
  • Sadly stackexchange doesn't seem to allow me to post an answer since I haven't earn 10 reputation yet... So I'm posting a quick answer here: 1/ On Windows install Git Bash 2/ On virtual box, add a port forwarding on host IP ::1 and port 2222 to the guest IP and port 22 3/ Start the VM 4/ With Git Bash connect to the VM ssh user@localhost -p 2222 5/ Use the VM through Git Bash where you can copy/past everything you want – amanteaux Oct 08 '21 at 13:10
  • You could use Pastebin.com if you have access to the Internet. – Agmenor Oct 28 '11 at 04:02
  • Did you install the required virtual box tools?? (the ones that you should install on guest operating system to gain smooth operation / interaction between the host and the guest) – nobody Oct 28 '11 at 04:01
  • Probably not. What tools should I install, and how? – Misha Moroshko Oct 28 '11 at 04:04
  • It is called "Guest additions" as @soekarmana answered. – Beniamin Oct 28 '11 at 08:04

9 Answers9

125

Go to VirtualMachine's Settings->General->Advanced->Shared Clipboard (Bidirectional)

Reboot your virtual machine.

for me it solved the problem (it was set on Disabled), I had some machines working some not, so i checked settings in working ones they had bidirectional clipboard. Dont know if this was upgrade issue or... just double check your shared clipboard options.

Hope this helps someone.

VirtualBox V 4.1.20

nidla
  • 1,261
76

Start your VM then install Virtualbox Guest Addition
You can find this option under "Devices" on virtual box 4.2 or you can follow the explanations at How do I install Guest Additions in a VirtualBox VM?

15

I had to do four steps:

  1. Install Virtual Box extension pack in host
  2. Activate shared clipboard in menu
  3. Install Virtual Box guest extensions in ubuntu guest
    • sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
  4. Reboot virtual machine
jan
  • 253
  • That's what worked for me from ubuntu host to ubuntu guest, thanks ! – valkalon Oct 23 '16 at 10:42
  • step 3 was missing and worked for me –  Apr 07 '17 at 09:01
  • 2
    Step #3 lead to boot jam on Ubuntu 17.10, where was previously installed guest additions via sudo apt-get install virtualbox-guest-additions-iso – Dee Dec 02 '17 at 19:26
  • yeah, It's worked but there is a step #4 - reboot VM. – Marcos Mar 11 '19 at 21:45
  • 1
    @Dee sudo apt-get install virtualbox-guest-additions-iso some how fixed my issue, thank you – Jason Liu Mar 10 '20 at 20:57
  • @Jason Liu, surprised it still works the same... 3 years old comment. Possible the response steps needs update. – Dee Apr 25 '20 at 08:09
  • Didn't work on Windows11 host and ubuntu guest, the only thing that worked for me is this other answer https://askubuntu.com/a/1246171/1137246 – yash Apr 25 '25 at 14:07
4

In VirtualBox 4.x:

Start the Ubuntu instance, then in the VirtualBox menu at the top of the running instance window, Machine > Settings..., Advanced tab, change Clipboard Sharing to Bidirectional. It's set to Disabled by default.

1

The summary of "Main OS and Virtual OS Integration":

  1. Install Vbox Guest Additions
  2. Enable Shared Clipboard
  3. Enable Drag'n'Drop
  4. Enable Shared Folder (optional)
1

I marked some text from firefox and tried to paste it into a terminal and it didn't work. I had guest additions installed, and also enabled bidirectional copy and paste and it still didn't work, but now I found the reason.

Apparently when I marked the text in firefox, additional information is also stored like the font and style. The terminal can not interpret this, so it doesn't seem to accept it. I pasted the text into a plain text editor (notepad++ in my case) then selected the text again and copied it. Now when I pasted it into the terminal it worked.

So this can also be a reason why copy&paste doesn't work, even if everything is correctly setup.

Using VirtualBox 4.3.12 with Ubuntu 14.04 x64 as the guest.

Devolus
  • 123
0

For VMWare 15, I had to pause / shutdown the machine and go to VM -> Settings -> Options tab -> Guest Isolation

From there you can check / uncheck Enable copy and pasteenter image description here

Danny
  • 431
0

in recent virtual box follow these instructions :

enter image description here

Badr Bellaj
  • 131
  • 3
-1

For some reason I was not able to copy from my WindowsXP VM in VirtualBox to Ubuntu. However, I solved the problem by enabling a shared folder.

You can do that by going to Devices > Shared Folders > Shared Folder Settings in the alt menu on the VM window. After you set up a folder in the host, you can access it inside the VM in My Network Places:

enter image description here

  • Tried all of the above nothing seem to work cut-n-paste, scrolling. I am using Win10 host, ubuntu 18.04 guest, VBox 6.1.1 – Sam-T Dec 14 '19 at 16:28