10

I have Windows 7 and use VirtualBox. I have installed Ubuntu Server as a guest.

Is there any easy way where I can copy text in the Ubuntu Server terminal to my Windows 7 host? How about in the other direction?

Jonas
  • 26,874
  • 52
  • 105
  • 125
  • 1
    Do you have Guest Additions installed? If so, it should *`Just Work`*. – Dennis Williamson Oct 25 '10 at 20:30
  • @Dennis: No, where can I get it? – Jonas Oct 25 '10 at 20:34
  • 1
    It's on the ISO that contains Virtualbox. When you select install Guest Additions in the VB menu that mounts an image in your guest as a CD/DVD. From Ubuntu, navigate to that directory (`/media/something` probably) and run the appropriate shell script (you should be able to tell which one based on their names). – Dennis Williamson Oct 25 '10 at 20:38
  • @Dennis: `/media/cdrom/` is empty for me, and `cdrom/` is the only directory I have in `/media` – Jonas Oct 25 '10 at 20:42
  • 1
    @Dennis: But when I look in the CD-Rom menu in VirtualBox the `VBoxGuestAdditions.iso` is checked. – Jonas Oct 25 '10 at 20:45
  • 1
    Since you're running Server, it may not automount. Try mounting the CD from within Ubuntu. – Dennis Williamson Oct 25 '10 at 21:04
  • @Dennis: I have also tried with `mount /dev/cdrom` but then I get this message: `mount: can't find /dev/cdrom in /etc/fstab or /etc/mtab` and it is a new fresh installation of Ubuntu Server 10.10. – Jonas Oct 25 '10 at 21:04
  • You will need to supply all the arguments to the mount command (`sudo mount -t iso9660 -o ro /dev/scd0 /media/cdrom`) or add an entry to your `/etc/fstab` that would look something like `/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0` – Dennis Williamson Oct 25 '10 at 21:36
  • @Dennis: I executed `sudo mount -t iso9660 -o ro /dev/scd0 /media/cdrom` now, but I can still not see anything with `ls /media/cdrom/` – Jonas Oct 25 '10 at 21:51
  • 1
    @Dennis: I now followed the instructions on [Installing Guest Additions in VirtualBox for an Ubuntu Server Guest](http://blog.brettalton.com/2010/04/28/installing-guest-additions-in-virtualbox-for-an-ubuntu-server-guest/). However, as stated in the end of that article. It won't give me support for **copy-and-paste** unless I install X.Org or XFree86 Window System. – Jonas Oct 25 '10 at 22:01

5 Answers5

9

I think the best solution is to "ssh" into the server and work on it like that.

The best known SSH client & terminal emulator on Windows is probably PuTTY. When you use that, it will allow you to copy/paste text from/to it.

JanC
  • 1,313
  • 7
  • 7
  • This seems to be the way to go. I now followed the instructions on [Installing Guest Additions in VirtualBox for an Ubuntu Server Guest](http://blog.brettalton.com/2010/04/28/installing-guest-additions-in-virtualbox-for-an-ubuntu-server-guest/). However, as stated in the end of that article. It won't give me support for **copy-and-paste** unless I install X.Org or XFree86 Window System. – Jonas Oct 25 '10 at 22:02
5

I believe you need to install the Virtualbox Guest Additions. This adds certain integration features like the ability to share the clipboard between the host and guest.

After installing guest additions you see the options for clipboard settings such as "Host to Guest", "Guest to Host", as well as "Bidirectional" clipboard sharing. The last is my preference.

John T
  • 163,373
  • 27
  • 341
  • 348
  • How do I install the Guest Addition? I have tried from the menu, but nothing happens. – Jonas Oct 25 '10 at 20:32
  • There is no "clipboard" in an Ubuntu Server though (it doesn't have a GUI, at least not in a default install). – JanC Oct 25 '10 at 21:26
  • 1
    @JanC Didn't see the "server" part at first glance. In this case, SSH into the server is a good solution. If he has any sort of GUI environment, even just X, guest additions should work however. – John T Oct 25 '10 at 21:59
2

In the Oracle Virtualbox settings, go to Settings > General > Advanced

There is an option for Drag and Drop. Select the direction you want to copy the text.

Canadian Luke
  • 24,199
  • 39
  • 117
  • 171
amjad
  • 21
  • 1
0

I had to run manually the following command after the installation of VirtualBox Guest Additions to make copy & paste work.

sudo VBoxClient --clipboard

wonea
  • 1,817
  • 1
  • 23
  • 42
Vladimir
  • 101
  • I had the same problem, and I find that I have to run the above command before every time I want to copy/paste (i.e., one copy operation on the host is all the command gives you). – Edan Maor Apr 06 '11 at 17:49
-1

Yes. Highlight the text and right-click. Choose "Copy". Go to the other application and right-click, then choose "Paste". At least that works with my own Ubuntu host and Windows XP guest, in either direction.

CarlF
  • 8,846
  • 3
  • 24
  • 40