0

I am trying to setup password less login from my Mac OS X to to Ubuntu VM created by Virtual-box. I am using NAT->port forwarding option in VM and have host port as 3022. When I do

ssh -p 3022 [email protected]

from my local and I can able to login to ubuntu with password, and this works vice versa.

Now I have created public/private key file in my Mac and copied the pub key to VM (ubuntu/.ssh/authorized_keys)

So now when I do:

ssh -p 3022 [email protected]

and it's asking for the password again.

I verified the key from id_rsa.pub vs VM authorized_keys and key is same in both places

Can someone tell me if I am making any mistake in my steps?

kenorb
  • 24,736
  • 27
  • 129
  • 199
Mowgli
  • 9
  • 2
  • Did you put the private key on your computer? `ssh -p 3022 -i /path/to/private_key [email protected]` – ecube Mar 10 '16 at 00:37
  • add a `-vv` to your ssh command, this should give you a lot of verbose output, that will help you troubleshoot. Also look at your /var/log/auth.log on the Ubuntu server. – Zoredache Mar 10 '16 at 00:37
  • You may try to install `ssh-copy-id`, so it'll copy and configure RSA key for you. – kenorb Mar 10 '16 at 00:38
  • yes @ecube I tried it now I am getting Permission denied (publickey). – Mowgli Mar 10 '16 at 00:48
  • @Zoredache thanks it helps to narrow down the issue, it says invalid user. Let me delete all the existing pub&private file and create a fresh set. – Mowgli Mar 10 '16 at 00:51
  • @Moogly make sure that your target has your public key in the connecting user's `~/.ssh/authorized_keys` file. – SaxDaddy Mar 10 '16 at 00:56
  • what errors you see in the server log? – Jakuje Mar 10 '16 at 10:23
  • @Jakuje Mar 10 09:57:49 ubuntu sshd[2082]: Invalid user ubuntu from 10.0.2.2 Mar 10 09:57:49 ubuntu sshd[2082]: input_userauth_request: invalid user ubuntu [preauth] Mar 10 09:57:49 ubuntu sshd[2082]: Connection closed by 10.0.2.2 [preauth] – Mowgli Mar 10 '16 at 18:04
  • Reading that once again, I believe you will find out you don't have user `ubuntu` on your server so either create such a user or log in as some existing user. – Jakuje Mar 10 '16 at 18:07
  • it worked well by adding privatekey file and adding existing user "ssh -p 3022 -i /Users/sysuser/.ssh/wppvm [email protected]" thanks – Mowgli Mar 10 '16 at 18:37

0 Answers0