Ubuntu – Cant ssh a virtualbox instance – Permission denied, please try again

14.04permissionssshvirtualbox

Im using ubuntu and Im trying to create a ssh connection between my ubuntu desktop and virtualbox ubuntu instance.

I have my ubuntu virtualbox instante configured with bridge, and in my ubuntu desktop Im trying to connect to my virtualbox instance like this: sudo ssh nameofvminstance

I enter the correct password of my vbox instance, but Im having always the same message: "Permission denied, please try again".

Do you see why this can be happening?

Best Answer

Remove sudo, just do:

ssh nameofvminstance

then enter the password.

If you do sudo ssh nameofvminstance, then you are basically trying to log in to the host nameofvminstance as root, if thats the case then at first you need to enter the password of your account in the host computer to get the sudo access and then the password of the root account of nameofvminstance.

Now if you do ssh nameofvminstance, its basically a short form of ssh username@nameofvminstance where the username in the remote computer is the same as the currently logged in user of the host machine i.e. you can use this format if both usernames are same otherwise you need to mention the username as ssh username@nameofvminstance.