0

I have a Ubuntu running inside a VirtualBox inside my Windows 8 desktop. I am trying to communicate between the Ubuntu and another Debian server in the network.

I have enabled Port Forwarding in VirtualBox and I am able to ssh to and from the virtual Ubuntu using a password.

I want to set up publickey authentication but I am running into issues.

Steps done so far -

  • Port forwarding in VirtualBox. Configured ports 22 to be forwarded to the VirtualBox and ssh with password works.
  • Generated public private key pair in Ubuntu and copied id_rsa.pub to authorized keys in the Debian server
  • Generated public private key pair in Debian server and copied id_rsa.pub to authorized keys in the Ubuntu
  • Generated public private key pair using PuttyGen in windows 8 and copied public key to authorized keys in Debian server
  • Changed network settings in VirtualBox into 'Bridged Adapter'. The IP address of the virtual box changed from the private VirtualBox IP to a public IP. But I am not able to ping the Debian Server now. Changed it back to NAT
  • Changed sshd_config in the Debain server to not accept passwords and use only publickey authentication - now Ubuntu is not able to communicate with the Debain with "Permission denied (publickey)" error.

Can someone please point out if I am missing some steps or doing something wrong.

Any help is greatly appreciated.

  • 1
    What got not working by changing sshd_config on the Debian server? It's not blocking password authentication? Or no longer accepting public key authentication? Please show how you changed sshd_config, and how Ubuntu says when you do ssh -v to Debian. – yaegashi Jun 30 '15 at 17:48
  • 1
    Your question says "trying to access the Ubuntu from another Debian server" but several of your steps only seem pertinent if you are trying to access the Debian server from Ubuntu. Can you clarify which direction you actually mean? – steeldriver Jun 30 '15 at 18:09
  • 1
    On Debian you need to generate a key pair (not only a public key). What do you see when do ssh -v from Debian to Ubuntu? – ott-- Jun 30 '15 at 18:10
  • 1
    Have you ever succeeded to ssh log in to Debian using pubkey authentication (i.e. seeing no password prompt) even once before changing VirtualBox networking or Debian's sshd_config? I don't think those changes actually affect pubkey auth. – yaegashi Jun 30 '15 at 18:25
  • 1
    You shouldn't change anything in sshd_config until you can confirm pubkey auth settings are complete. Double check you have a pubkey line in ~/.ssh/authorized_keys in Debian, then do ssh -v -i id_rsa debian from Ubuntu with corresponding private key. See what ssh says and what it logs in /var/log/auth.log in Debian. – yaegashi Jun 30 '15 at 19:17

Your Answer

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

Browse other questions tagged or ask your own question.