How to SSH into a Virtual Machine in Parallels Desktop

I was pulling my hair out the other day trying to connect to a VM in Parallels Desktop. It’s fairly straightforward, yet rather complex at the same time. Here’s how to do it step by step.

In this example I’m running Parallels Desktop 8 under Mac OS X 10.9 Mavericks, and my Guest OS CentOS 6.5.

Configuring your VM

Before starting the VM, start Parallels Desktop and head over to

  • Virtual Machine
  • Configure
  • Hardware
  • Network

You’ll get to a screen like this:

Screen Shot 2014-02-12 at 17.21.16

Make sure the tick box is “Connected”. Under Type you get a drop-down menu with three options:

  • Shared Network: gives your VM access to your internet/network connection, much like a “split”
  • Bridged Network (with several options): creates a new IP address for your VM and attaches it to whichever device you choose. Stick to the “Default Adapter” here unless you know what you’re doing. This will let other devices on your network connect to the VM.
  • Host-Only Network: also creates a new IP address for your VM, but only lets your Mac connect to the instance. Other devices on the network won’t be able to connect (more secure).

Pick Bridged (Default Adapter) or Host-Only, then start your VM.

Configuring CentOS

We need to find out which IP our instance has. The easiest way to do this is to run ifconfig:

The second line of the output holds our answer: “inet addr: 10.x.x.x”. Make a note of this address, you’ll be connecting to your VM via this IP.

Next we need to make sure that the SSH demon allows outside root connections. You do this by hacking the following file:

/etc/ssh/sshd_config

Make sure the following two options are commented out (i.e. do not have a # in front of them):

If you had to un-comment either line, make sure you restart the SSH demon:

Login to your instance via SSH

If all went well you should now be able to open a Terminal window on your Mac (or any machine on the same network if you’ve selected the “Brided” option in Parallels Desktop) like so:

Obviously, replace 10.2.3.4 with your own IP address.

Watch the screencast

 

Catch this episode on my WP Guru Podcast:

Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.

One thought on “How to SSH into a Virtual Machine in Parallels Desktop

Add your voice!