M HYPE SPLASH
// news

Virtual box : How to copy/paste text between a host running mac os and a ubuntu guest? (Shared clipboard doesn't work)

By Abigail Rogers

Shared Clipboard and Drag'n Drop both set to Bidirectional.

Devices > Guest Additional CD image gives this error.

Unable to insert the virtual optical disk /Applications/ into the machine Ubuntu_vm

0

2 Answers

If your goal is simply to copy/paste text between host and guest, as an alternative to using the shared clipboard, you can achieve this by opening a port on the Virtual Machine & using ssh to login to the guest from a standard Mac OS terminal.

If you didn't install an ssh server on the guest you can add this like so from the (guest) command line

sudo apt-get update
sudo apt-get install ssh-server
sudo apt-get install openssh-server

If you are running ufw firewall you will need to allow ssh from the (guest) command line

sudo ufw allow ssh

You need to add a policy to the VM so that it will allow connections to the port, you can do this from the (host) command line:

VBoxManage modifyvm "<my_ubuntu_vm>" --natpf1 "<name_for_your_rule>,tcp,,<alternative_port_for_ssh_eg_2222>,,22"

Then you can ssh into the guest from the (host) command line

ssh -p <alternative_port_for_ssh_eg_2222> <your_username_on_the_vm>@127.0.0.1

The host command line remains under the control of Mac OS so you can now cut and paste as you would from any other terminal &/or application

1

I have seen this error when a disk was already inserted into the VM, such as the previous guest additions. Do you have another iso already attached?

4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy