Tutorial: SSH into VirtualBox VM

less than 1 minute read

SSH into VirtualBox VM

VBoxManage modifyvm myserver --natpf1 "ssh,tcp,,3022,,22" where ‘myserver’ is the name of the created VM. Check the added rules:

VBoxManage showvminfo myserver | grep 'Rule'` That’s all! Please be sure you don’t forget to install an SSH server:

sudo apt-get install openssh-server To SSH into the guest VM, write:

ssh -p 3022 user@

OR Change the adapter type in VirtualBox to bridged, and set the guest to use DHCP or set a static IP address outside of the bounds of DHCP. This will cause the Virtual Machine to act like a normal guest on your home network. You can then port forward.