How to share clipboard between Ubuntu VirtualBox and host

If you’re using Ubuntu on a VirtualBox, you might find yourself needing to move some text between your host computer and the virtual machine. Luckily, copying and pasting between them is pretty easy to achieve. In this guide, we’ll go over the steps you need to take to enable clipboard sharing between your Ubuntu VirtualBox guest and your main computer.

Installing the Guest Addition Image for VirtualBox

If you want get that Guest Additional Image up and running in your Virtual Machine, here’s what you need to do:

First off, fire up VirtualBox and pick the machine you want use for clipboard sharing. Then, go ahead and start it up.

Read: How to Change the Resolution of Ubuntu 22.04 VM in VirtualBox

Once your machine is up and running, pop open the operating system’s terminal and enter the command below. This’ll get you the packages you need to install the Guest Addition Image.

How to install guest additions virtualbox

Read: How to Install Vagrant on Ubuntu 22.04

Once you’ve got the necessary packages installed, it’s time to pop in that Guest Addition CD. Just click on “Devices” in the Virtual Machine’s menu bar and choose “Insert Guest Addition CD image” from the dropdown.

Read: How to share folders between your Ubuntu Virtualbox and your host machine

Just sit tight for a bit while the installation wraps up. Once it’s done, you’ll be prompted to reboot your system. So go ahead and shut down the Virtual Machine, then right-click on it to get to the settings icon. Alternatively, you can just click on the machine and hit the settings icon, like in the screenshot below:

Copy paste in Virtual box – Virtualbox shared clipboard

Head over to the machine’s settings window and find the “General” tab in the left-hand sidebar. From there, choose the “Advanced” tab, which should be displayed in a snapshot above for your reference.

You should be able to see a dropdow called “Shared Clipboard”. Click on the dropdown menu and select the option “Bidirectional” to enable clipboard sharing for the machine. Finally, click the OK button.

Simply start the machine to activate the copy-and-paste feature between VirtualBox and the host. However, if it’s not functioning, it may indicate that the guest Addition Image wasn’t successfully inserted, and you’ll have to insert it manually.

Read: How to quickly send a text from Ubuntu to Android using a three-line Bash script

Manually add the Guest Addition CD Image

To begin, execute this command to create a fresh directory named /mnt/cdrom:

sudo mkdir -p /mnt/cdrom

Virtualbox copy paste not working: 

Now, mount the image to directory /mnt/cdrom by executing the command below:

sudo mount /dev/cdrom /mnt/cdrom

Head over to the /mnt/cdrom directory and run the “VBoxLinuxAddition.run” script.

cd /mnt/cdrom

Read: How to copy and paste between host and VM

sudo sh ./VBoxLinuxAdditions.run –nox11

VirtualBox guest additions Ubuntu

Now, After the script has completed running, you’ll need to restart the system. Use the command below:

sudo shutdown -r now

Read: How to add guest features to your Virtualbox on Ubuntu 18.04

Conclusion

Copying and pasting between the host and Ubuntu VirtualBox guest can be a convenient and time-saving feature for users. By following the steps outlined in this article, users can enable clipboard sharing and insert the guest additions CD image to ensure smooth functionality. With these tips and tricks, users can make the most out of their VirtualBox experience and seamlessly transfer information between their host and Ubuntu guest operating systems.

 


If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.

 

Nikolaus Oosterhof

Nikolaus holds a degree in software development and has a strong passion for all things tech-related, especially gadgets with screens. Though he is nostalgic for older phone models, he's a retired gamer and continues to enjoy programming in open-source environments. Additionally, Nikolaus enjoys writing about Linux, macOS and Windows and has experience designing web pages.

Leave a Reply