Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Virtualization / VMWare / Enable SSH on VMware ESXi Host

September 15, 2022 PowerShellVMWare

Enable SSH on VMware ESXi Host

The remote access to the command prompt (server console) via SSH is disabled by default on VMware ESXi hosts. So, when connecting to an ESXi host over SSH, you will get the error: ssh: connect to host 192.168.50.13 port 22: Connection refused. In this article, we’ll cover all the ways to enable SSH access on VMware ESXi hosts.

Contents:
  • Enable SSH Access via DCUI Console on ESXi
  • How to Enable SSH on ESXi from the vSphere Web Client?
  • Enabling SSH on VMware ESXi with PowerShell

Enable SSH Access via DCUI Console on ESXi

You can enable SSH on your VMware ESXi host through the server’s DCUI (Direct Console User Interface). For this:

  1. Press F2 on the DCUI logon screen and enter the root password; login VMware ESXi DCUI
  2. Go to System Customization -> Troubleshooting Options, select Enable SSH, and press Enter. enable ssh on esxi host via local console

Try to connect to your ESXi host remotely using any SSH client (I’m using the built-in Windows SSH client):

ssh [email protected]

connecting esxi host via ssh

After connecting to the server console, you may use ESXi shell commands to perform various maintenance or diagnostic tasks. For example:

  • Install updates on your ESXi host
  • Check and upgrade VM hardware version
  • Force restart a virtual machine that is not responding
  • Recover an accidentally deleted VMFS datastore or expand it
  • Configure an SNMP agent on ESXi
  • Configure an iSCSI LUN on a VMware ESXi server or check if it is available
  • Reduce VMware virtual machine disk size

After you have done everything you wanted in the ESXi console, it is recommended to stop the SSH service

How to Enable SSH on ESXi from the vSphere Web Client?

You can enable SSH through the vSphere Client web interface.

If you are using a standalone ESXi host (or a free VMware Hypervisor), connect to its web interface: https://192.168.50.13/ui/#/host.

  1. Go to Manage -> Services;
  2. Select TSM-SSH in the list of services and click Start; enable TSM-SSH service
  3. By default, the SSH service on an ESXi host is started and stopped manually. You can configure the SSH service to start automatically by clicking Actions -> Policy -> Start and stop with host. start tsm-ssh automatically on esxi

In order to enable SSH on the ESXi host connected to vCenter:

  1. Find the host in the Inventory list;
  2. Go to Configure -> Services;
  3. Find the SSH service in the list and enable it by clicking Start. enable ssh using vsphere web client

Note that there is the Firewall tab in the host settings Here you can set a list of IP addresses that are allowed to connect to the ESXi host via SSH (the list is unlimited by default).

Enabling SSH on VMware ESXi with PowerShell

You can enable an SSH server on your ESXi host using PowerShell cmdlets from the VMware PowerCLI module. Suppose that the module is already installed on your computer (if not, install it using Install-Module -Name Vmware.PowerCLI command).

To connect to an ESXi host or a vCenter server, run the command below:

Connect-VIServer <vCenter_or_ESXi_host_FQDN>

If a self-signed certificate is used on your VMware vCenter server, run this command before trying to connect to it:

Set-PowerCLIConfiguration -Scope AllUsers -InvalidCertificateAction Warn

List all ESXi hosts connected to this vCenter server and the states of the SSH service on them:

Get-VMHost| Get-VMHostService | Where Key -EQ "TSM-SSH" | Select VMHost, Key, Running, Policy

check ssh service on esxi hosts via powershell

To start SSH on a specific ESXi host, run the following command:

Get-VMHostService -VMHost mun-esxi1 | Where-Object {$_.Key -eq "TSM-SSH" } | Start-VMHostService

Start-VMHostService: enable ssh using powercli

If the LockDown mode is enabled on the ESXi host, you can disable it as follows:

(Get-VMHost mun-esxi1 |get-view).ExitLockdownMode()

To enable the LockDown mode:

(Get-VMHost mun-esxi1 |get-view).EnterLockdownMode()

To stop the SSH service on all hosts at once, use the PowerShell command below:

Get-VMHost | Foreach { Stop-VMHostService -confirm:$false -HostService ($_ | Get-VMHostService | Where { $_.Key -eq "TSM-SSH"} )}

To suppress SSH login warnings on all ESXi hosts:

Get-VMHost | Get-AdvancedSetting UserVars.SuppressShellWarning |Set-AdvancedSetting -Value 1

Remember to close your PowerShell session correctly:

Disconnect-VIServer * -confirm:$false

1 comment
0
Facebook Twitter Google + Pinterest
previous post
Find Windows OS Versions and Builds in Active Directory
next post
Using PowerShell Remoting Over SSH

Related Reading

Zabbix: How to Get Data from PowerShell Scripts

October 27, 2023

Tracking Printer Usage with Windows Event Viewer Logs

October 19, 2023

PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

October 15, 2023

Reset Root Password in VMware ESXi

October 12, 2023

How to Query and Change Teams User Presence...

October 8, 2023

1 comment

Lane February 19, 2023 - 6:08 am

Super Helpful, Was the only website i could find for help with our ESXi problems.

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023
  • How to Use Ansible to Manage Windows Machines

    September 25, 2023
  • Installing Language Pack in Windows 10/11 with PowerShell

    September 15, 2023
  • Configure Email Forwarding for Mailbox on Exchange Server/Microsoft 365

    September 14, 2023
  • How to View and Change BIOS (UEFI) Settings with PowerShell

    September 13, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Fix: Remote Desktop Licensing Mode is not Configured
  • Manage Windows Updates with PSWindowsUpdate PowerShell Module
  • Configuring Port Forwarding in Windows
  • Start Menu or Taskbar Search Not Working in Windows 10/11
  • How to Install Remote Server Administration Tools (RSAT) on Windows
  • How to Delete Old User Profiles in Windows
  • Get-ADUser: Find Active Directory User Info with PowerShell
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top