SSH to the Ubuntu host machine from a Ubuntu VirtualBox guest?

8,702

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

The answer says:

So Match blocks need to be at the end of the sshd_config file.

Sure enough, that solved everything for me.

In fact, it solved my related problems beyond the scope of this question too. My related issue was getting an androVM running and fully function within VirtualBox. I was just using the Ubuntu server for testing to narrow down the issue. In androVM I wanted to use ES File Manager in Android to access files on the host Ubuntu machine via SFTP. Now that works.

Share:
8,702

Related videos on Youtube

MountainX
Author by

MountainX

You may be interested in the story of SE moderator Monica Cellio and how she was unfairly treated by the corporate management of this site. More info here. An update is available. Let's hope we can cultivate a more fair environment for content creators and moderators going forward.

Updated on September 18, 2022

Comments

  • MountainX
    MountainX over 1 year

    I would like to SSH into my host (Kubuntu 12.04 64 bit) machine from a VirtualBox guest running Ubuntu 12.04 32 bit. The host has the latest VirtualBox from the Ubuntu repos (4.1.12). The guest was a preconfigured VM I downloaded from VirtualBoxImages.com.

    The problem is that my sshd_config does not allow login except with PubkeyAuthentication and I need to be able to use PasswordAuthentication from this VirtualBox guest (for reasons that are probably outside 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 a message like this: init: ssh main process (7352) terminated with status 255

    Why? What am I doing wrong? I have used match blocks almost identical to that in the past, so I'm baffled.

    This question is relevant but it didn't help me: How can I allow SSH password authentication from only certain IP addresses?

    I can guess my issue might be related to the VirtualBox network interface...

    In VirtualBox I'm using "Host Only" for Adapter 1 (with the default vboxnet0). With this, the host has an interface vboxnet0 with IP 192.168.56.1. That's the reason for my match block IP address above.

    (I also set up Adapter 2 as "NAT" so my guest can have outside Internet access). 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 opposite way of the connection I want).

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

    • Sajan Parikh
      Sajan Parikh about 11 years
      Just to make sure, are you sure you are connecting to the correct SSH port on the host machine? Made sure that the SSH server has been started on the host machine? I would also disable any firewall as well.