Saturday, January 18, 2014

SSH connection from host to guest VM

Settings -> Network -> Adapter X -> Attached to "NAT" -> Advanced -> Port Forwarding -> insert new rules -> Host Port: 2222, Guest Port: 22
Connect via ssh:
ssh -l userid -p 2222 localhost/127.0.0.1/hostIP

Instead of "NAT" mode, you can also use "Bridged" mode to let VM get its own IP, then connect directly to guestIP without port forwarding:
ssh -l userid guestIP

BTW, guest machine can be started headlessly by:
VBoxManage startvm "VM name" --type headless
or
VBoxHeadless --startvm <uuid|name>
VBoxManage startvm runs the VM directly as a background process, while VBoxHeadless can provide detailed messages of the started VM.

No comments:

Post a Comment