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 root@192.168.50.13

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

Configuring Event Viewer Log Size on Windows

May 24, 2023

How to Detect Who Changed the File/Folder NTFS...

May 24, 2023

How to Create, Change, and Remove Local Users...

May 17, 2023

View Success and Failed Local Logon Attempts on...

May 2, 2023

Querying Windows Event Logs with PowerShell

May 2, 2023

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

  • Configuring Event Viewer Log Size on Windows

    May 24, 2023
  • How to Detect Who Changed the File/Folder NTFS Permissions on Windows?

    May 24, 2023
  • Enable Single Sign-On (SSO) Authentication on RDS Windows Server

    May 23, 2023
  • Allow Non-admin Users RDP Access to Windows Server

    May 22, 2023
  • How to Create, Change, and Remove Local Users or Groups with PowerShell?

    May 17, 2023
  • Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows

    May 16, 2023
  • View Success and Failed Local Logon Attempts on Windows

    May 2, 2023
  • Fix: “Something Went Wrong” Error When Installing Teams

    May 2, 2023
  • Querying Windows Event Logs with PowerShell

    May 2, 2023
  • Configure Windows LAPS (Local Administrator Passwords Solution) in AD

    April 25, 2023

Follow us

  • Facebook
  • Twitter
  • RSS
Popular Posts
  • Configuring Port Forwarding in Windows
  • Manage Windows Updates with PSWindowsUpdate PowerShell Module
  • Installing RSAT Administration Tools on Windows 10 and 11
  • Start Menu or Taskbar Search Not Working in Windows 10/11
  • How to Delete Old User Profiles in Windows?
  • Get-ADUser: Find Active Directory User Info with PowerShell
  • How to Hide Installed Programs in Windows 10 and 11?
Footer Logo

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


Back To Top