Book Image

VMware vCenter Cookbook

By : Kostantin Kuminsky
Book Image

VMware vCenter Cookbook

By: Kostantin Kuminsky

Overview of this book

Table of Contents (15 chapters)
VMware vCenter Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Accessing hosts via SSH


In certain cases, you may need to access the ESXi host via SSH. This may be needed to run a script, troubleshoot an issue, or use a command or a feature not available via vSphere Client.

How to do it...

SSH access to ESXi hosts is disabled by default and can be enabled using the ESXi console and command line or through vCenter. To enable it from vCenter:

  1. Allow SSH port through the host's firewall.

  2. Start the SSH service on the host.

Opening the SSH port on the firewall

To allow the SSH port through the firewall on the ESXi host, execute the following steps:

  1. Go to the Hosts and Clusters view.

  2. Select the host and go to the Configuration tab.

  3. Click on Security Profile on the left.

  4. Click on the Properties... link next to the Firewall section.

  5. The Firewall Properties window will open. Check SSH Server under the Secure Shell section.

  6. Click on the Firewall button to allow only certain IP addresses to connect. Click on OK when finished to apply the changes.

In Web Client, perform the following steps:

  1. Select a host.

  2. Go to Manage | Settings | Security Profile.

  3. Click on the Edit... button next to the Firewall section.

  4. Select the SSH Server option and click on OK as shown in the next screenshot.

    Tip

    To allow connections from only certain IP addresses, uncheck the Allow connections from any IP address option and enter the IP addresses separated by commas.

Starting an SSH service

To start an SSH service on the host from the same place under Configuration | Security Profile:

  1. Click on the Properties... link next to the Services section.

  2. Select SSH in the list of services and click on Options....

  3. Click on the Start button.

  4. Once the service starts, both windows can be closed.

From Web Client, perform the following steps:

  1. Select a host.

  2. Go to Manage | Settings | Security Profile.

  3. Scroll down to the Services section.

  4. Click on the Edit button.

  5. Select SSH from the list.

  6. Click on Start.

There's more…

Now you will be able to access the ESXi command line using the SSH client.

Note

Note that when SSH service is running on the host, vCenter marks it with a yellow exclamation mark as it is a configuration issue. Enabling SSH is considered to be an insecure practice.