How to ssh your VirtualBox from host (Ubuntu Linux)

Last day, I went into a scenario when I had to ssh a Virtual Box (running Ubuntu 12.04) from my host machine. My MediaWiki mentor (Jeff Green) came up with the solution.
Scenario: VM Machine (name – box1, having a user bob, on port after forwarding, and box1 is accessible with an IP from Host)
1) Add the following entry to your box1, Network settings -> Adapter1 -> Port Forwarding

Name: ssh
Protocal: TCP
Host IP: 127.0.03
Host Port: 2222
Guest IP:
Guess Port: 22

2) Edit your ~/.ssh/config and add the following entries
Host box1
Port 2222
User bob

Done 🙂 Now open up the Host terminal and type in
ssh box2
What’s done :- When you give ssh box2, the request is forwarded by the ssh sevice as
ssh bob@ -p 2222
and this gets forwarded by the VBox configuration as

ssh bob@ -p 22
*Similarly, you can forward HTTPS port by
http|TCP| | 8080 | | 80
https|TCP| | 8443 | | 443

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s