When attempting to establish an SSH connection to a VMware ESXi host as the root user (for example, via PuTTY), the connection fails immediately after entering the username with the following error:
Error: No supported authentication methods available (server sent: publickey) Refer to the screenshot below:
VMware vSphere ESXi 8.0.2 and later.
Password-based SSH authentication is disabled because UsePAM and ChallengeResponseAuthentication (or PasswordAuthentication in legacy configurations) are set to no in the ESXi SSH server configuration.
For Version higher than ESXi 8.0 Update 2, direct modification of /etc/ssh/sshd_config is unsupported and is overwritten upon reboot.
Use esxcli via the ESXi Shell or Direct Console User Interface (DCUI) to configure SSH authentication parameters:
Access the ESXi host console via DCUI or iLO/iDRAC/IPMI and enable the ESXi Shell under Troubleshooting Options.
Log in to the ESXi Shell as root.
Verify the current SSH server configuration values:
esxcli system ssh server config list
Enable usepam and challengeresponseauthentication to allow password-based authentication.
esxcli system ssh server config set -k <key/property name> -v <value>esxcli system ssh server config set -k usepam -v yes
esxcli system ssh server config set -k challengeresponseauthentication -v yes
Verify that the updated settings are applied:
esxcli system ssh server config list
/etc/init.d/SSH restart
To ensure the PasswordAuthentication setting persists across reboots, establish an SSH session to the ESXi host using the root password.
Edit /etc/rc.local.d/local.sh and add the following command before exit 0 so that /etc/ssh/sshd_config updates automatically at boot:
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
The /etc/rc.local.d/local.sh file should look similar to the following:
#!/bin/sh ++group=host/vim/vmvisor/boot
# local configuration options. Note: modify at your own risk! If you do/use anything in this
# script that is not part of a stable API (relying on files to be in
# specific places, specific tools, specific output, etc) there is a
# possibility you will end up with a broken system after patching or
# upgrading. Changes are not supported unless under direction of
# VMware support.
# Note: This script will not be run when UEFI secure boot is enabled.
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
exit 0
Reboot the ESXi host to apply and verify the persistent configuration.
For Version older than ESXi 8.0 Update 2, you may directly modify /etc/ssh/sshd_config.
Information on some removed or deprecated sshd_config keys:
AcceptEnv - This has been removed from the available options.
KerberosAuthentication / GSSAPIAuthentication - Both of these are not exposed in newer versions of ESXi. Authentication is primarily managed through UsePAM
Match Address - This has been removed. The supported method for restricting SSH access by IP address in ESXi is now the ESXi Firewall rather than the ssh configuration file.