I've got problem with ssh login after fresh installment of ubuntu 12.04 server edition on a virtual machine (based on VM player).

The host machine is Win7.

Openssh server version 1.0.1

Every time I tried login from the host vm is installed, it promotes: Authentication Fail, and I am pretty sure my password is OK.

I actually tried putty and some other clients and several user names, all fail.

There is no log from /var/log/auth.log And I've enabled PasswordAuthentication in my /etc/ssh/sshd_config and restarted sshd.

Interesting thing is I can login from vm machine itself using either localhost or external IP. So wondering whether there is any special setting forbid ssh login remotely?

Any hint would be a great help.

  • What network adapter are you using? If you're using NAT, you'll need to use port forwarding.
    – kobaltz
    Oct 12 '13 at 0:15
  • @kobaltz , yes I am using NAT, could you pls elaborate more on port forwarding? Any configuration I need to enable?
    – botao
    Oct 12 '13 at 0:42
  • I posted settings for VirtualBox. VM Player should have similar features.
    – kobaltz
    Oct 12 '13 at 1:13

To enable port forwarding, you will need to go under your NAT network Adapter settings and go under the Advanced section. Click on Port Forwarding.

enter image description here

Then create a new entry with the host and guest ports as 22.

enter image description here

Think of the NAT NIC as your HOST machine being a Router and the Guest VM being a device behind that router. You need to port forward any connections to the VM. From your HOST OS, you can now SSH onto the port 22 using or localhost from your HOST OS. It will forward the SSH connection request to the VM.

The alternative to this is to use a Bridge Adapter which will make the VM act as a physical computer on that network and will pull an IP Address from your Router's DHCP Server. As far as any other computer, device or resource is concerned, this VM is a physical computer on that network.

Another alternative is to use the Host Only Adapter. This will create a bond between the HOST OS and the Guest VM. This is handy since it does not require any sort of HOST network to have full access to the VM.

I do a lot of development on my laptop HOST machine and will use a combination of the NAT and Host Only vNICS. I port forward the necessary ports to my VM so I can locally access them and will also use the Host Only for samba file sharing. On my desktop machine, I'll use the Bridge Adapter since this compute never moves networks. The Laptop HOST acts funny when I switch between the Ethernet and WLan adapters and also whenever I'm on different networks.

  • Thanks for the details. But to be more clear, I can ssh to get 'Pls enter password' promoted, I guess that means connectivity to port 22 on vm is OK from my host machine. I suspect the NAT for VMPlayer is more like 'Host Only' for virtualbox, but I am not sure on this
    – botao
    Oct 12 '13 at 2:48
  • I switched to virtual box and setup the port mapping. Now everything is working fine. Thanks very much
    – botao
    Oct 12 '13 at 3:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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