Log into a VMware ESXi using SSH keys

  1. In the vSphere Client, select the host, click on the Configuration tab, select Security Profile, and click on Properties... in the upper right corner (on the line which is labeled as Services):

  2. If SSH is not running, select its entry and click on Options...:

  3. Click on Start, select Start and stop with host, and close both dialog windows by clicking on Ok:

  4. On a Linux or Unix box, create a key pair without passphrase:
    ssh-keygen -N "" -f id_esxi
    This creates two files - id_esxi and id_esxi.pub.
  5. Append the public key to /etc/ssh/keys-root/authorized_keys on your ESXi box:
    cat id_esxi.pub | ssh root@HOSTNAME_OR_IP_ADDRESS 'cat >>/etc/ssh/keys-root/authorized_keys'
  6. From now on, you can ssh into your ESXi box by just using the private key:
    ssh -i id_esxi root@HOSTNAME_OR_IP_ADDRESS