2

I have installed ubuntu as my guest Os using vmware as a virtual machine. I want to host a ssh server in my virtual machine(Ubuntu) and access it via ssh client in my windows.

First of all , how to start a ssh server in ubuntu ? And how to achieve the above ?

1
  • Which VMware product did you use - VMplayer? Workstation? Oct 31, 2010 at 19:17

2 Answers 2

3

Log into your Ubuntu VM. Open a terminal and type:

sudo apt-get install openssh-server

Switch to your host Windows. Open a command window and cd your way to C:\Program Files\Oracle\VirtualBox

Type the following:

VBoxManage setextradata "guestname" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222
VBoxManage setextradata "guestname" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage setextradata "guestname" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP

Change guestname to be as it appears in the VirtualBox application, keeping the quotes.

Shutdown the Ubuntu VM - VirtualBox seems to require the guest OS be fully restarted after the above change. Start the VM again. You do not need to log in.

Open an SSH client on the host Windows. Connect to localhost, port 2222. Use the username and password you set for Ubuntu.

That should do it! It's slightly complex, but it only needs to be done once per VM.

3
  • I'm using vmware. Any idea of how to do this in vmware player.
    – Hemanth
    Oct 28, 2010 at 7:11
  • @Grant Palin - I am running an Ubuntu Host and guest and ran the above commands. Trying to restart the VM I get Failed to open a session for the virtual machine LFS Host. Configuration error: Failed to get the "MAC" value (VERR_CFGM_VALUE_NOT_FOUND). Result Code: NS_ERROR_FAILURE (0x80004005) Component: Console Interface: IConsole {1968b7d3-e3bf-4ceb-99e0-cb7c913317bb} Jan 5, 2012 at 22:32
  • @George Mauer I believe more recent versions of VirtualBox provide the ability to change the above settings via the GUI, making the above commands redundant. Jan 6, 2012 at 0:49
0

To install the most common ssh server:

aptitude install openssh-server 

It should start up automatically and run whenever you start Ubuntu, assuming you make the correct choices during setup.

To use it in a virtual machine you will need to give the VM its own IP address. I know how to do that in VirtualBox, but not VMWare. Generally, look for a setting that refers to NAT (Network Address Translation) and turn that OFF.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .