Note: VMware vSphere ESXi 7.0 does not support preserving SSH-Keys for non-root users.
To allow SSH access to ESXi or ESX hosts with public/private key authentication:
- Generate public/private keys on ESXi. For more information, see the OpenBSD Reference Manual section in the OpenBSD.
Note: The preceding link was valid as of June 22, 2016. If you find the link to be broken, provide feedback on the article and a VMware employee will update the article as necessary.
Notes:
- These instructions generate two files in ~/.ssh: id_rsa and id_rsa.pub.
- Starting from ESXi 5.x, the ssh-keygen command is located at /usr/lib/vmware/openssh/bin.
- On the ESXi host, store the public key content, id_rsa.pub in ~/.ssh/authorized_keys. (e.g. cat id_rsa.pub >> authorized_keys)
Notes:
- For ESXi 5.x, 6.0, 6.5, 6.7 and 7.0, the authorized_keys is located at: /etc/ssh/keys-<username>/authorized_keys
- More than one key can be stored in this file.
- To allow root access, change PermitRootLogin no to PermitRootLogin yes in the /etc/ssh/sshd_config file.
- To disable password login, ensure that the ChallengeResponseAuthentication and PasswordAuthentication are set to no.
- Reload the service:
6. Copy id_rsa to local desktop, and use it as the private key to SSH ESXi host