How to Setup SSH access between VirtualBox Host and Guest VMs

Discussion in 'Desktop Operation' started by corpus, Nov 19, 2011.

  1. corpus

    corpus Member

    wanted to install a test virtual machine on my Desktop pc for server and ispconfig proposes. Test new things, new software etc.
    The problem was that the clipboard between host and virtual machine does not works if you haven't set up X. So i google it for the solution and i wrote a simple tutorial.


    Go to
    download virtual box for your machine
    Debian 6.0 (Squeeze) virtualbox-4.1_4.1.6-74713~Debian~squeeze_amd64.deb
    and Oracle VM VirtualBox Extension Pack
    For use with Version 4.1.6 only
    All Platforms (Windows, Mac OS X, Solaris and Linux) Oracle_VM_VirtualBox_Extension_Pack-4.1.6-74713.vbox-extpack

    after go into your download folder and run as root

    dpkg -i virtualbox-4.1_4.1.6-74713~Debian~squeeze_amd64.deb
    after installation open the
    with virtualbox (double click)
    to install the Oracle VM VirtualBox Extension Pack

    it will also ask you the root password during the installation

    to have usb support between the the host and the guest machines edit /etc/fstab and add

    usbfs /proc/bus/usb usbfs defaults,devmode=666 0 0
    then do a

    mount -a
    as root from your terminal

    open virtualbox
    go to File-->Preferences-->Network and click on the "Add Host-only network (Ins)
    it will create automatically a "vboxnet0" network
    Click to OK to save changes

    Add a new virtual machine and proceed with installation. I installed Debian 6.
    After installation boot the new v.machine and then power off it.

    Now go with your mouse on your virtual machine
    Right-click --> Settings
    Go to Network -- click on the second tab "Adapter 2"
    check the "Enable Network Adapter" and choose from the drop-down Attached to: Host-only Adapter
    It will automatically choose the "vboxnet0" in the Name field
    Click to OK to save changes

    Now open a terminal on your host maschine and execute

    you will see something like this

    vboxnet0  Link encap:Ethernet  HWaddr 0a:00:27:00:00:00  
              inet addr:  Bcast:  Mask:
    keep in mind the

    Bootup your virtualmachine
    login as root and run

    pico /etc/network/interfaces
    add these lines in the bottom

    auto eth1
    iface eth1 inet static
    the address is based in the ifconfig results on you host machine

    after this close and save
    run in terminal

    ifup eth1
    Now go to your root machine's console and login with ssh to your guest machine

    ssh [email protected]
    Those tested on a debian 6 host and also a debian 6 guest


Share This Page