I have an old linux software running occasionally in an Ubuntu 8.04 Virtualbox virtual machine inside my Debian 9 host. Can I ssh / sshfs from inside the VM to the host without being connected to an external network? How?

I am aware that ssh-ing in the opposite direction has already been asked (SSH to a virtual machine) but I am asking for the other way around, i.e. from guest to host, not from host to guest.


1 Answer 1


You want a host-only network: here are instructions for setting one up (you don't need a NAT interface if you're running a purely internal setup.) It's essentially a tun interface that can be shared between multiple VMs, so you should only need to give your VM (and host side of the interface) an address and make sure that SSH is bound to the interface.

Assuming you're using the graphical interface, here are some steps that should get it going:

  1. Add a "Host-only networking" interface to your VM. "Name" here indicates which host-only network you're attaching to: there should only be one right now (called "vboxnet0"), so accept the default.
  2. In VirtualBox Preferences, make sure you see a host-only network in the "Network" tab (it should be named the same as the interface that you made previously.) Enter the host-side address/netmask for the interface (e.g. as you only have one guest attached to this network, you can disable DHCP by going to the "DHCP Server" tab and unchecking the "Enable Server" box.
  3. In your VM, you should see a new interface. Make note of its name (likely "eth1") and try to bring it up: ifconfig eth1 netmask up
  4. If it works (try pinging, then add the interface to your /etc/network/interfaces so that it's always set up when the VM starts:

# The host-only network interface auto eth1 iface eth1 inet static address netmask network broadcast

  1. You may need to edit your sshd_config and restart sshd on the host if you have it listening to specific interfaces
  • Please provide the explicit steps. I guess "Give an address" doesn't mean sticking a yellow post-it on the screen with "26 Normandy Road, Niedersachsen". It probably involves using some ip address one gets from typing ifconfig either on the host or the guest, something like that.
    – Mephisto
    Commented Feb 21, 2018 at 20:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .