SSH to Ubuntu host from Ubuntu VirtualBox guest?


Mountain X

I want to SSH into my host (Kubuntu 12.04 64bit) from a VirtualBox guest running 32bit Ubuntu 12.04. The host has the latest VirtualBox from the Ubuntu repositories (4.1.12). The guest is a preconfigured VM that I downloaded from VirtualBoxImages.com .

The problem is that my sshd_config doesn't allow PubkeyAuthentication to log in, and I need to be able to use PasswordAuthentication from this VirtualBox guest (for reasons that may not be within the scope of this question).

My /etc/ssh/sshd_config file probably needs to look like this:

PasswordAuthentication no

Match Address 192.168.56.0/24
    PasswordAuthentication yes

When I add the match block to sshd_config, ssh terminates with the following message: init: ssh master process (7352) terminated with status 255

Why? What am I doing wrong? I'm using almost the same match block as in the past, so I'm confused.

This question is related but didn't help me: How to allow SSH password authentication only from certain IP addresses?

I'm guessing my problem might be related to the VirtualBox network interface...

In VirtualBox, I use "Host Only" for adapter 1 (default vboxnet0). This way the host has interface vboxnet0 with IP address 192.168.56.1. That's why my above match block IP address.

(I also set adapter 2 to "NAT" so my guests can access the external internet). For testing, I set promiscuous mode to "Allow All". I can ping both ways. And I can SSH from the host to the guest (the reverse way I want to connect).

The host runs denyhosts, but I stopped the service while testing.

Mountain X

I found a solution on the Unix and Linux StackExchange for this question : https://unix.stackexchange.com/questions/67334/openssh-how-to-end-a-match-block

The answer said:

So the Matchblock must be at the end of the sshd_configfile .

Sure enough, this fixed everything for me .

Actually, it also solved my related problem outside of this question. My related question is getting androVM running in VirtualBox and fully functional. I'm just testing with an Ubuntu server to narrow down the problem. In androVM, I want to access files on Ubuntu host via SFTP using ES File Manager in Android. it's OK now.

Related


SSH to Ubuntu host from Ubuntu VirtualBox guest?

Mountain X I want to SSH into my host (Kubuntu 12.04 64bit) from a VirtualBox guest running 32bit Ubuntu 12.04. The host has the latest VirtualBox from the Ubuntu repositories (4.1.12). The guest is a preconfigured VM that I downloaded from VirtualBoxImages.co

Add Virtualbox guest on Ubuntu host and Manjaro guest

Farzad I have installed Manjaro in a guest VM on an Ubuntu 18.10 host, but I cannot use the guest additions in the Manjaro guest. I have installed the kernel 5.1.1-2in Manjaro and the output uname -ris: 5.1.1-2-MANJARO Then I tried to install virtualbox-guest

Add Virtualbox guest on Ubuntu host and Manjaro guest

Farzad I have installed Manjaro in a guest VM on an Ubuntu 18.10 host, but I cannot use the guest additions in the Manjaro guest. I have installed the kernel 5.1.1-2in Manjaro and the output uname -ris: 5.1.1-2-MANJARO Then I tried to install virtualbox-guest

Virtualbox: Mount shared folder in Guest FreeBSD from host Ubuntu

user34260 I have Ubuntu 12.10 as host OS and FreeBSD 9 as guest OS in Virtualbox 4.1.18. I have Samba installed in both Ubuntu and FreeBSD and shared some folders from virtualbox with the automountoption ticked as well. I also did it in right click and shareUb

How to copy paste from Ubuntu VirtualBox guest to Windows host?

Misha Moroshko I'm running VirtualBox 4.1.4 on a Windows 7 laptop with an Ubuntu 11.10 guest. I want to copy text from Ubuntu terminal and paste it into a file on Windows host. For some reason this doesn't work. Any ideas? Soekarno Start your VM, then install

Connecting to VirtualBox guest (ubuntu) from host (osx) via NAT?

Evenk I have a VirtualBox guest (running Ubuntu) configured with NAT through my host laptop (running OSX). From what I understand, with NAT configured, I can access the guest from the host machine (without any port forwarding magic), but not from any external

Run command on Ubuntu guest in VirtualBox VM from Windows host

that 88 I'm writing some code and I have an idea that should work, but I don't know how to make it work. I'm running some code with Wolfram Mathematica on a Windows host, but I have to export the files to a Linux based program running in an Ubuntu Virtualbox V

How to copy paste from Ubuntu VirtualBox guest to Windows host?

Misha Moroshko I'm running VirtualBox 4.1.4 on a Windows 7 laptop with an Ubuntu 11.10 guest. I want to copy text from Ubuntu terminal and paste it into a file on Windows host. For some reason this doesn't work. Any ideas? Soekarno Start your VM, then install

VirtualBox - how to pass modem from ubuntu host to windows guest

Carlos Castellanos Is it possible to pass a USB modem that is not recognized by the host Ubuntu 15.04 to a Windows guest? , I have Windows drivers and I want to use dialup while keeping my Ubuntu host. what should I do? Can any other virtualization software he

Connecting to VirtualBox guest (ubuntu) from host (osx) via NAT?

Evenk I have a VirtualBox guest (running Ubuntu) configured with NAT through my host laptop (running OSX). From what I understand, with NAT configured, I can access the guest from the host machine (without any port forwarding magic), but not from any external

How to copy paste from Ubuntu VirtualBox guest to Windows host?

Misha Moroshko I'm running VirtualBox 4.1.4 on a Windows 7 laptop with an Ubuntu 11.10 guest. I want to copy text from Ubuntu terminal and paste it into a file on Windows host. For some reason this doesn't work. Any ideas? Soekarno Start your VM, then install

Virtualbox: Mount shared folder in Guest FreeBSD from host Ubuntu

user34260 I have Ubuntu 12.10 as host OS and FreeBSD 9 as guest OS in Virtualbox 4.1.18. I have Samba installed in both Ubuntu and FreeBSD and shared some folders from virtualbox with the automountoption ticked as well. I also did it in right click and shareUb

Run command on Ubuntu guest in VirtualBox VM from Windows host

that 88 I'm writing some code and I have an idea that should work, but I don't know how to make it work. I'm running some code with Wolfram Mathematica on a Windows host, but I have to export the files to a Linux based program running in an Ubuntu Virtualbox V

VirtualBox - how to pass modem from ubuntu host to windows guest

Carlos Castellanos Is it possible to pass a USB modem that is not recognized by the host Ubuntu 15.04 to a Windows guest? , I have Windows drivers and I want to use dialup while keeping my Ubuntu host. what should I do? Can any other virtualization software he

Share an existing ubuntu folder on the host guest with Virtualbox

impulse I am familiar with directory sharing between Ubuntu guest and host. But now I need to share an existing ubuntu folder with the guest machine. I don't know if and how it can be done. Does anyone have any ideas? Marius Matutiae No, it can't be done in th

Share an existing ubuntu folder on the host guest with Virtualbox

impulse I am familiar with directory sharing between Ubuntu guest and host. But now I need to share an existing ubuntu folder with the guest machine. I don't know if and how it can be done. Does anyone have any ideas? Marius Matutiae No, it can't be done in th

Configure VirtualBox host-only networking: OSX host, Ubuntu guest

Greg K Solved: By reconfiguring the vbox network settings to 192.168.21.19 (in VirtualBox->Preferences->Network), and commenting out the line specifying the gateway (since it's not needed, only the host interface without external access), I This issue can be r

Configure VirtualBox host-only networking: OSX host, Ubuntu guest

Greg K Solved: By reconfiguring the vbox network settings to 192.168.21.19 (in VirtualBox->Preferences->Network), and commenting out the line specifying the gateway (since it's not needed, no external access on the host interface only), I This issue can be res

Access Ubuntu guest (VirtualBox) node.js server from Windows host

Fonsecchi I'm trying to setup a node.js server on an Ubuntu guest OS running on VirtualBox. The simple "Hello World" HTTP server works fine if I try to access it from a browser on the Ubuntu image, but I'm having trouble opening the page in a browser using the

Access Ubuntu guest (VirtualBox) node.js server from Windows host

Fonsecchi I'm trying to setup a node.js server on an Ubuntu guest OS running on VirtualBox. The simple "Hello World" HTTP server works fine if I try to access it from a browser on the Ubuntu image, but I'm having trouble opening the page in a browser using the