Sunday, May 29, 2011

Access Virtualbox guest via ssh

Apparently, it is possible to access a Virtualbox guest machine running sshd via ssh from the host machine.

Using PCnet-FAST III (NAT) as network adapter,

On the host machine: (where [guest] is the name of your guest machine.

$ VBoxManage setextradata [guest] "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222
$ VBoxManage setextradata [guest] "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
$ VBoxManage setextradata [guest] "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP

To delete an entry, set the value to an empty string.

Re/Boot your guest machine.

On your host machine:

$ ssh -l [user]@localhost -p 2222

No comments: