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:
- Allow SSH port through the host's firewall.
- 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:
- Go to the Hosts and Clusters view.
- Select the host and go to the Configuration tab.
- Click on Security Profile on the left.
- Click on the Properties... link next to the Firewall section.
- The Firewall Properties window will open. Check SSH Server under the Secure Shell section.
- 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:
- Select a host.
- Go to Manage | Settings | Security Profile.
- Click on the Edit... button next to the Firewall section.
- 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:
- Click on the Properties... link next to the Services section.
- Select SSH in the list of services and click on Options....
- Click on the Start button.
- Once the service starts, both windows can be closed.
From Web Client, perform the following steps:
- Select a host.
- Go to Manage | Settings | Security Profile.
- Scroll down to the Services section.
- Click on the Edit button.
- Select SSH from the list.
- 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.