Unable to SSH Virtual box centos from my Mac

I am unable to SSH my Centos which i installed in my Virtual box from my Macbook

HI @sanchitjain0592

You might consider using Vagrant to drive Virtualbox for you. It handles much of the configuration for you

Sorry, I am not aware with this tool. Do we have any other solution?

Vagrant is very useful, and I recommend you look into it. It is free and available for all platforms. They maintain a libary of pre-configured base images for virtualbox which means you don’t have to go through the installation of the operating system, and will configure password-less ssh directly out the box.

Either way, back to the manual procedure

I don’t have a mac so I can’t debug this directly, but the following should be set up in Virtualbox for your VM

A network adapter connected to NAT:
image

Then press the port forwarding button, where you will need to add a forwarding for SSH

  • Name - ssh
  • Protocol - tcp
  • Host IP - 127.0.0.1
  • Host Port - 2222 (can be any free port, but using this for the example)
  • Guest IP - Leave empty
  • Guest port - 22

Once that is all configured, and assuming the ssh daemon is running inside the vm, then

ssh -p 2222 [email protected]

where user is whatever user you set up when you ran the centos install

Hi @sanchitjain0592 ,
Can you please check the service of SSH?
Share the output of ip a command.

Regards,