How do I SSH into Ubuntu from an outside network? It's running in VirtualBox and the network adapter has to remain NAT. I can't seem to figure out how to set it up. Are there any ways to directly SSH into the VirtualBox session?


When the VM networking is based on NAT, you need to use port forwarding to remotely access the VM (here named ubuntu).

VBoxManage modifyvm "ubuntu" --natpf1 "guestssh,tcp,,2222,,22"

Then you'll be able to access the VM by connecting to the host on port 2222, eg:

ssh -p 2222 user@host

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.