VMware ESXi authorized_keys File Behavior: Deletion and Regeneration
search cancel

VMware ESXi authorized_keys File Behavior: Deletion and Regeneration

book

Article ID: 420050

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

The behavior of the authorized_keys file on VMware ESXi systems needs clarification, specifically whether this file can be deleted and if it regenerates automatically after deletion.

Environment

  • vSphere ESXi 7.x
  • vSphere ESXi 8.x

Cause

The authorized_keys file on VMware ESXi is manually managed for securing SSH access using public/private key pairs. It is not a system-generated or automatically maintained file. When the authorized_keys file is deleted, ESXi does not automatically recreate it because its presence and content depend entirely on the user's configuration for key-based SSH authentication.

Resolution

If the authorized_keys file is deleted, key-based SSH authentication will fail, and the file must be manually restored to re-enable this feature.

  1. Manual Restoration: Manually recreate the authorized_keys file in the appropriate location (/etc/ssh/keys/<<username>>/authorized_keys).

  2. Add Keys: Add the required public keys back into the file.

Alternatively, password-based login can be used until the public keys are re-added.