How do you copy/paste between Mac OSX and UbuntuServer 14.04 inside VirtualBox

14,895

Since you as well asked how to do it the cool way (ssh) I'll cover that, only thing for you to find out is how to get ssh on your MAC since I have never touched and never will touch one.

1. Preparation:

Open virtualbox and go into the preferences via menu, go to the network tab and click on the little plus icon under host only networks, this will add an adapter called vboxnet0.

enter image description here enter image description here

After you have done that enter the preferences of the VM itself and switch there to the network tab and click on port forwarding on Adapter 1 and enter after a click on the plus sign your credentials like shown in the pictures below.

NOTE: You can SSH directly from your Mac OS X system to your VM system if it's NAT'd and on the same system; You don't need to configure Port Forwarding unless you want systems outside of the system running VM to reach the system. (included from comment as I never had or will never own a MAC i cant check on that, for an Ubuntu host it is definitively needed).

enter image description here enter image description here enter image description here

After that you go to the Adapter 2tab and enable this adapter and set it to be attached to the host only adapter named vboxnet0.

enter image description here

2. Logging in:

As i already said I have never touched a max but i assume the commands should be the same or near same so I will put here the commands used on an Ubuntu host to give you a lead on. To log in to your VM you start it in --headless mode in terminal (I leave the Kali-Linux in but you should replace that with your VM's name):

vboxmanage startvm "Kali-Linux" --type headless

Now wait a moment your VM still need to boot up even if it shows no window then log into it with:

ssh -l <user-name> localhost -p 2222

You will then be prompted for the user password on your VM and after that logged in, now the lines you see in your terminal are lines you see and type in your VM.

To shutdown you have two options I prefer mostly the first.

  1. shutdown from within the VM

    shutdown -h 1
    logout
    
  2. shutdown from terminal

    logout
    vboxmanage controlvm "Kali-Linux" poweroff
    
Share:
14,895

Related videos on Youtube

user547123
Author by

user547123

Updated on September 18, 2022

Comments

  • user547123
    user547123 over 1 year

    I'm having issues trying to setup GitLab on my Ubuntu server, running inside VirtualBox on Mac OS X. Copy/Paste does not work.

    I have installed guest additions and have changed the host-key to right-CMD (where it was previously left). I have also turned on bi-directional support.

    Now of the above work, so I'm really stuck and need to copy/paste code from the GitLab page to install it.

    Any ideas?

  • Thomas Ward
    Thomas Ward almost 8 years
    They can SSH directly from their Mac OS X system to their VBox system if it's NAT'd, and on the same system; they don't need to configure Port Forwarding unless they want systems outside of the system running VBox to reach the system.
  • Videonauth
    Videonauth almost 8 years
    Good to know, on Ubuntu on the other hand you need it otherwise it wont work sadly, so for future readers i might leave it in.
  • Thomas Ward
    Thomas Ward almost 8 years
    I'm saying you should keep it but adda "note" about locally on the host machine not needing the port-forwarding. I made such a comment in my answer, pointing at yours if they need help with outside-of-the-VBox-host SSH access.
  • Thomas Ward
    Thomas Ward almost 8 years
    @Terrance It does - this is about NAT (check the screenshots)
  • Thomas Ward
    Thomas Ward almost 8 years
    @Terrance there are many cases where you don't want to set it to Bridged, because of the environment you're in. Case in point, testing something in a workplace before putting it into production, you may not want it accessible to the whole network. That's the point and context. Therefore, as the answer here by Videonauth is, is for NAT cases, NOT for Bridged cases. You need to make a note about the context limitation there, because Bridged won't work in all network environments nor all cases (802.1X restricted LANs, MAC filtered LANs, etc.)
  • Thomas Ward
    Thomas Ward almost 8 years
    @Terrance Then Mac OS X Networking is fubar, or it doesn't operate the way it does in Windows or *nix, because you're effectively going from the router inside, not from outside in, and they SHOULD be on the same subnets.
  • Thomas Ward
    Thomas Ward almost 8 years
    @Videonauth leave it alone, do nothing. Terrance should have pinged me in chat instead to discuss/argue this.