keepcalculator

06 Numbers and Powers

ESXi Enable SSH: Steps and Security Notes

Card No. 06·79826 · Updated · Standard formula, shown below

To enable SSH on an ESXi host, you can use the vSphere Client (HTML5) by navigating to the host’s Configure tab, selecting Services under System, finding SSH, and clicking Start, or use the Direct Console User Interface (DCUI) or the esxcli command line. The quickest method is via the DCUI: press F2, log in as root, go to Troubleshooting Options, then Enable SSH, and press Enter to confirm. This article explains each method in detail, covers security considerations, and answers common questions about SSH access on ESXi.

Why Enable SSH on ESXi?

ESXi is a bare-metal hypervisor from VMware (now part of Broadcom). Normally, you manage it through the vSphere Client or the DCUI. SSH gives you a command-line shell to the ESXi host itself, which is useful for:

  • Running advanced troubleshooting commands that are not available in the GUI, such as esxcli commands for network, storage, and service management.
  • Accessing logs directly (/var/log/vmkernel.log, /var/log/hostd.log) for deep debugging.
  • Running scripts that automate host-level tasks.
  • Recovering from certain misconfigurations when the vCenter Server is unreachable.

However, VMware disables SSH by default because it is a security risk. An open SSH port exposes the host to brute-force attacks and unauthorized access if credentials are weak. Always enable SSH only when needed and disable it after you finish.

Method 1: Using the vSphere Client (HTML5)

This is the most common method for environments managed by vCenter Server or a standalone host.

  1. Log in to the vSphere Client.
  2. Select the host in the inventory.
  3. Go to the Configure tab.
  4. Under System, click Services.
  5. Locate SSH in the list.
  6. Click Start to start the service (it will run until the next reboot).
  7. Optionally, click Edit Startup Policy and choose Start and stop with host to make it persist across reboots. This is not recommended for security reasons unless you have a strong firewall.

If the host is managed by vCenter, the service will start immediately. If it is a standalone host, the same steps apply.

Method 2: Using the Direct Console (DCUI)

This works when you have physical or remote console access (e.g., iLO, iDRAC, or IPMI).

  1. Press F2 to customize the system.
  2. Log in with the root credentials.
  3. Select Troubleshooting Options.
  4. Select Enable SSH.
  5. Press Enter to toggle it to "Enabled".
  6. Press Esc to exit.

The DCUI method starts the SSH service immediately and also sets the startup policy to "Start and stop with host" by default. To change that, you would need to use the vSphere Client or esxcli.

Method 3: Using esxcli (Remote or Local)

If you already have SSH access (or access via the ESXi Shell), you can use the command line to control the service.

esxcli network firewall ruleset set -r sshServer -e true
esxcli system service ssh start
esxcli system service ssh set --enabled true
  • The first command opens the firewall port for SSH (usually port 22).
  • The second starts the SSH service immediately.
  • The third sets the service to start automatically with the host (persistent).

To check the current status:

esxcli system service ssh get
esxcli network firewall ruleset list | grep ssh

Security Considerations and Best Practices

Enabling SSH on ESXi is a serious security decision. The host is a critical infrastructure component, and SSH provides a root shell. Follow these practices:

  • Disable SSH when not in use. The default is off for a reason. Re-enable it only for the duration of your troubleshooting.
  • Use strong passwords. ESXi does not support SSH keys out of the box (you can add them manually, but it’s not standard). A weak password is an open door.
  • Restrict network access. Use the ESXi firewall to allow SSH only from specific management IPs. You can do this in the vSphere Client under Firewall rules.
  • Consider using a jump host. Instead of exposing ESXi SSH to the internet, put it behind a VPN or a bastion host.
  • Monitor logs. Check /var/log/auth.log or /var/log/shell.log for failed login attempts.

A common misconception is that ESXi SSH is the same as the ESXi Shell. They are different: the ESXi Shell is a local console shell (accessible via DCUI or Alt+F1), while SSH is a remote shell. You can enable one without the other.

Common Problems and Troubleshooting

If SSH does not start or you cannot connect, check these:

  • Firewall rules. The SSH server firewall ruleset must be enabled. Use esxcli network firewall ruleset list to verify.
  • Service not started. Check with esxcli system service ssh get. If it says "Stopped", start it.
  • Network connectivity. Can you ping the host? Is the management network reachable? SSH binds to the management interface.
  • Root login disabled? By default, root can log in via SSH. If you have changed the policy (e.g., via Active Directory), you might need to use a different user.
  • Lockdown mode. If the host is in lockdown mode, SSH access is blocked except for the exception users. Disable lockdown mode temporarily.

If you get a "Connection refused" error, the service is likely not running. If you get "Connection timed out", the firewall is likely blocking the port.

Alternatives to SSH

For many tasks, you do not need SSH:

  • vSphere Client covers most day-to-day management, including logs and performance charts.
  • PowerCLI (VMware’s PowerShell module) can run many esxcli commands remotely without SSH.
  • vCenter Server APIs allow programmatic access to host configuration.
  • ESXi Shell (local console) is a safer alternative if you have physical access, as it does not expose a network port.

Use SSH only when you need direct host-level commands that are not exposed through the APIs.

Frequently Asked Questions

How do I enable SSH on ESXi permanently?

To make SSH start automatically with the host, use the vSphere Client: go to Services, select SSH, click Edit Startup Policy, and choose "Start and stop with host". Alternatively, run esxcli system service ssh set --enabled true via the command line. Remember that this is a security risk, so only do it if you have a strong firewall and monitoring.

Can I use SSH keys to log in to ESXi?

Yes, but it is not a supported configuration. You can manually add your public key to /etc/ssh/keys-root/authorized_keys on the host. However, this file is not persistent across reboots unless you also make changes to the host’s configuration (e.g., using a vSphere Auto Deploy script or a custom VIB). VMware recommends using passwords or a centralized authentication solution.

Is SSH enabled by default in ESXi?

No. SSH is disabled by default in ESXi for security reasons. The ESXi Shell is also disabled by default. You must explicitly enable either one.

What port does ESXi SSH use?

ESXi SSH uses the standard SSH port 22. You can change the port in the SSH server configuration, but it is not recommended because it can break management tooling and is not a true security measure (port scanning will find it anyway).

How do I disable SSH on ESXi?

Use the same methods in reverse. In the vSphere Client, go to Services, find SSH, and click Stop. In the DCUI, go to Troubleshooting Options and select Disable SSH. Via esxcli, run esxcli system service ssh stop and esxcli system service ssh set --enabled false. Also, close the firewall ruleset with esxcli network firewall ruleset set -r sshServer -e false.

Why can’t I SSH to ESXi even though the service is running?

Check the firewall ruleset first. Run esxcli network firewall ruleset list | grep ssh. If it shows "false", enable it. Also check if the host is in lockdown mode. If you are using a different user than root, ensure that user has shell access. Finally, verify that the management network is reachable from your client.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →