Ubuntu Server VM: copy paste?

106,805

Solution 1

Just trying this myself. Couldn't get it to work with gpm and a console only guest.

I strongly suspect that the clipboard integration rely's on having a running X server in the Guest.

A work-a-round is to install openssh-server on the guest and ssh using a terminal from your host to the guest. Then you have 'clipboard integration'

Solution 2

Try to use PuTTY and connect via SSH to your virtual Linux system.

Solution 3

I came up with a different workaround. Open a shared folder, and create an executable script in the shared folder. Put "#!/bin/bash" (or whatever/wherever shell you want to use), followed by the command(s) you want to execute. Like this:

#!/bin/bash
cp foo bar
echo 'copied foo to bar'

Just replace "cp foo bar" with the long complicated string you wanted to cut and paste.

Depending on what you're doing, you might have to source the script rather than running it directly:

source ./myscript

EDIT: Oops! I forgot to add that you have to change the line endings from Windows-style to Unix-style line endings. In Emacs you can use

M-x set-buffer-file-coding-system

while in vim it would be

:set ff=unix

Sorry!

Solution 4

If you're running a Server in a VM , then why don't you just ssh into the VM and use the terminal?

Think about it. It's a server with no graphical interface.

If you only had the sever version installed on a actual computer instead of the VM would you have been able to copy paste into it's command line prompt? You have no multitasking available in the same TTY unless you use some multimplexer like "screen" or "tmux" or a software such as "gpm" as v3.xx suggested.

Share:
106,805

Related videos on Youtube

bukzor
Author by

bukzor

Apparently I'm better at VIM than Python..

Updated on September 17, 2022

Comments

  • bukzor
    bukzor over 1 year

    I've installed Ubuntu Server under Virtualbox just to get a nice little shell. I've also installed the VirtualBox "Guest Additions" and set "Shared Clipboard: Bidirectional".

    I still can't seem to get any copy-paste working. Am I missing something here?


    I've installed gpm which gives mouse support in server mode (no X), and allows copy-paste using the mouse, but still the VirtualBox integration doesn't work.

  • bukzor
    bukzor about 13 years
    That's not a bad suggestion. In fact it's probably more efficient/responsive than using the VM window.
  • Shiju Shaji
    Shiju Shaji about 12 years
    @James Brilliant idea !!! :)
  • adeleinr
    adeleinr over 11 years
    ran into this issue myself, this is definitely the only way I have found to work around this
  • GregB
    GregB about 11 years
    Not the point. This is a problem with the virtualization a guest additions.
  • Mahn
    Mahn almost 8 years
    Couldn't get it to work either on Ubuntu Server 16.04 no matter what, most likely it is tied to the X server like you suggest, so no-can-do with terminal only OSs.
  • Jonathan
    Jonathan over 7 years
    See also cygwin, with apt-cyg (apt-cyg install openssh-server)
  • phk
    phk over 7 years
    @JonathanLeaders You would only need a SSH client and not server on your Windows host.
  • DPSSpatial
    DPSSpatial over 7 years
    What IP address and port would you use to connect via SSH if the virtualbox is on a localhost?
  • user56reinstatemonica8
    user56reinstatemonica8 over 6 years
    There are lots of questions and answers on other sites about how to configure Virtualbox so you can SSH into it. Here's a simple one that worked for me with a Windows host and a terminal-only Ubuntu Server guest inside Virtualbox
  • Ardee Aram
    Ardee Aram over 5 years
    This should be the accepted answer.
  • SOFe
    SOFe almost 5 years
    Irony: shared folder in VirtualBox is even harder to setup than shared clipboard.
  • Reeshabh Ranjan
    Reeshabh Ranjan over 4 years
    @DPSSpatial I just used the ifconfig command on my guest to know the ip-address to use for SSH. I did not specify any port, because upon checking with nmap, I got to know that the SSH service was running on port 22 (the default one).
  • John Smith
    John Smith over 3 years
    Well, I can tell you in my case, it's because I've been waiting 25 minutes for SSH to connect to a Debian VM and am beginning to suspect it's just not going to work.