Virtualbox – SSH from host OS into guest OS

This would be a very short post on how to ssh into your guest OS from your host OS in virtualbox.

Though there are other ways in which you could access your guess OS from your host, I found the Port Forwarding method to be extremely easy to implement.

Note: I assume that you have installed an operating system in virtualbox and that openssh-server is installed in it

and the steps are,

  • Click on Settings in your virtualbox manager
  • Click on Network
  • Assuming that the default network type is NAT, click on Port Forwarding
  • On the  Port Forwarding Rules window, create a new rule by clicking on Add new port forwarding rule
  • Fill the table with following details that are necessary and rest can be left blank,
    • Name
    • Protocol – TCP (filled by default)
    • Host port – . Ex: 3000 (make sure its not being used elsewhere)
    • Guest port – 22 (since ssh runs on port 22)
  • Click  Ok on both Port Forwarding Rules and Network window

Note: You need not restart your VM and this can be done before you start or after you have started your guest OS

To test if you are able to ssh into your guest OS, make sure its up and running. Then from your host OS terminal type in the following,

ssh -p @127.0.0.1

Ex: ssh -p 3000 vms20591@127.0.0.1

and that’s it. You can now ssh into your guest OS. I found this from a stackoverflow post which made me to write this post.

I know what y’all thinking, “Picture is worth a thousand words”. Here you go !

Step 1: Click on Settings

1

Step 2: Select Network

2

Step 3: Add a new rule and Ok it

3

Step 4: Left window shows terminal from my host OS Linux Mint where I ssh into my guest OS Trisquel running in a virtualbox to the right

4

I basically write this post for others who wanted to try this and as a way for myself to remember what I have learned and to be reminded if I forget it 🙂 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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