Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
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. –  Sajan Parikh Apr 29 '13 at 3:41
    
I rewrote the question. The problem is in fact that SSH is not running. The match block I added is making sshd terminate. So my question is now related to this match block. Thanks –  MountainX Apr 29 '13 at 6:01
add comment

2 Answers 2

up vote 1 down vote accepted

I found the solution at Unix & Linux StackExchange in this question: http://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|improve this answer
add comment

Put the net adapter in bridged mode on the virtual box, that will let your router assign it a network address, then you can use ssh with any system on the network
just use ifconfig to get the address for the server
You don't need a nat adapter
then just use ssh user@192.168.100.X

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.