Securing ESXi Connections: Using Non-Root Users with vCenter Server
Why Use Non-Root Users for ESXi Management?
Using the root account for ESXi host management in Data Center Virtualization (DCV) environments creates several security and operational challenges:
Security Concerns
-
Shared Account Risks: The root user is a well-known administrative account that poses audit and security risks when shared across multiple systems.
-
Audit Difficulties: In vCenter Server (VCSA) or Cloud Foundation (SDDC) environments, using shared root accounts creates difficulties for IT audits and accountability.
-
Over-Privileged Access: The root user has full administrative control of ESXi and serves as the connection method for adding hosts to vCenter, Cloud Foundation, backup solutions, and storage arrays.
-
Operational Dependencies: IT security processes often require changing root passwords on scheduled intervals, which affects VM control, host connections in VCSA/SDDC, backup solutions, and storage connections.
Best Practice Approach
- Implement dedicated administrative accounts for ESXi-vCenter connections
- Reduce dependency on root account credentials
- Enhance security posture and audit compliance
Method 1: Local User Account Configuration
Prerequisites and Understanding
In ESXi 7.0+, additional authorization configuration is required when adding ESXi hosts to vCenter Server with non-root users. Without proper configuration, you may encounter authentication errors such as "Cannot complete login due to incorrect username or password."
Step-by-Step Configuration Process
Step 1: Create the Automation Script
Create a Python script named esxi_non_root_setup.py with the following code:
Step 2: Upload and Execute the Script
-
Upload the script to your ESXi host using SSH tools like PuTTY or WinSCP to the
/tmpdirectory. -
Connect to ESXi via SSH as root user.
-
Execute the script with the following command:
BASH -
Provide the root password when prompted.
Step 3: Verify Configuration
After successful execution, verify that:
- The new user has been created with appropriate permissions
- Lockdown mode is properly configured
- The new user can connect to ESXi from vCenter
Step 4: Add ESXi Host to vCenter
Use the new non-root account credentials when adding the ESXi host to vCenter Server through the vSphere Client.
Method 2: Active Directory User Configuration
Prerequisites
- ESXi host must be joined to Active Directory domain
- AD user must be created and assigned to appropriate groups
Step-by-Step Configuration
Step 1: Create AD User and Group
On your Active Directory server:
- Create a new user account (e.g.,
svc-vcenter-esxi) - Create or use an existing group (e.g.,
ESX Admins) - Add the new user to the
ESX Adminsgroup
Step 2: Domain Join ESXi Host
Join the ESXi host to your Active Directory domain using the vSphere Client or ESXi Shell.
Step 3: Configure AD Group Permissions
The ESX Admins group from Active Directory will be automatically assigned administrative privileges on the ESXi host.
Step 4: Add Host Using AD Credentials
When adding the ESXi host to vCenter, use the AD user credentials in the format:
DOMAIN\usernameor[email protected]
Security Considerations and Best Practices
Account Management
- Service Account Naming: Use descriptive names like
svc-vcenter-esxiorsystem-esxi-connection - Password Policy: Implement strong passwords (8-16+ characters with complexity)
- Account Type: Use service accounts, not personal accounts
- Password Rotation: Consider whether to enable periodic password changes based on security requirements
Privilege Management
- Principle of Least Privilege: Grant only necessary permissions
- Regular Reviews: Periodically audit account permissions
- Monitoring: Implement logging for account usage
Lockdown Mode Benefits
- Enhanced Security: Prevents direct root access
- Audit Trail: Better accountability for administrative actions
- Compliance: Helps meet security compliance requirements
Troubleshooting Common Issues
Authentication Failures
- Verify user account exists and is enabled
- Check that required permissions are assigned
- Ensure account is not locked or expired
Lockdown Mode Issues
- Confirm the user is in the lockdown exception list
- Verify the user has appropriate administrative privileges
- Check that the vpxuser account can be created
Connection Problems
- Validate network connectivity between systems
- Check firewall rules for required ports
- Verify time synchronization between systems
Operational Considerations
Host Disconnection vs. Removal
Understanding the difference between disconnecting and removing a host from vCenter:
- Disconnect: Suspends monitoring and management but keeps host and VMs in inventory. Performance metrics are preserved.
- Remove: Removes host and VMs from inventory completely. Historical performance data is lost.
Credential Management
When using the root password to add a host to vCenter, the system establishes connection credentials that maintain communication between ESXi and vCenter, even if the ESXi root password is later changed.
Summary
Using non-root users for ESXi-vCenter connections provides significant security and operational benefits:
- Enhanced Security: Reduces risk of shared account compromises
- Better Auditability: Clear accountability for administrative actions
- Operational Resilience: Reduces dependency on root password changes
- Compliance: Helps meet security compliance requirements
Of the two methods, using Active Directory users is generally recommended as it provides centralized account management and security controls separate from ESXi systems, secured with AD encryption and policies.
Following these practices will help ensure secure and compliant DCV deployments while maintaining operational efficiency.
References
- Adding ESXi 7 to vCenter Server with Non-Root User
- VMware vSphere Security Documentation
- Active Directory Integration Best Practices for vSphere