update.
when you ssh into vm instance you have to ssh into hdp sandbox by using following command ssh root@localhost -p 2222 . first time you login enter your password and ready to go.
tip: when you start your vm wait for atleast 10 minutes before ssh into the vm because it takes time to start all services . Alternatively , you can login into ambari and click on OPS on top left to check whether all services have started or not. once it is 100% complete you can then login into the instance.