Enable SSH to VirtualBox in one simple command

On your host machine, navigate to the VirtualBox directory in terminal/command prompt (in Windows, do cd C:\Program Files\Oracle\VirtualBox). Type the following command:

VBoxManage modifyvm <vmname> --natpf1 "guestssh,tcp,,2222,,22"

Replace <vmname> appropriately. Now you are able to SSH to localhost at port 2222.

Comments are closed.