I have installed Oracle Virtual Box and RedHat on it. Can I use SSH or PuTTy from my local PC (Windows 7) to access RedHat locally? If yes then what will I enter in field of Host name? And if no then what is best way to connect to it?

  • 1
    If you can ping the IP addr of RHEL from windows, you just need to enter command: ssh username@IPADDR eg. ssh root@192.168.0.2 – Tejas Sep 1 '15 at 5:04
  • @Tejas what should be my command like ? – Paresh Zawar Sep 1 '15 at 5:05
  • If you are in bridge mode then use PuTTY as normal. If you are in NOT bridge mode then use port forwarding in PuTTY and vbox – gwillie Sep 1 '15 at 5:06
up vote 1 down vote accepted

As gwillie said in his comment, connecting to a Virtual Box guest machine depends on the network settings of that virtual machine.

The default settings seem to be NAT which will make the layer between the guest and the host behave like a NAT device (like e.g. a router) and is therefore most suited for situations that don't require access from the host to the guest.

Therefore I usually use Bridged Networking mode which puts the guest on the same network as the host, just like another machine with its own, publicly accessible IP address.

To enable bridged mode, shut down your guest and open its settings, Network, Adapter 1 and change the Attached to dropdown to Bridged Adapter. Then start your guest again and make sure it has a valid IP address on your (host = guest) network.

Assuming your guest IP address is 192.168.1.123, you can then use ssh to connect to it, like so:

ssh -Y 192.168.1.123

Note that this will use the same username as the one logged into the host machine, so the easiest configuration is to have the same usernames on the guest as on the host.

As Tejas pointed out, you can also use the ssh user@ip syntax to connect as a different user.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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