In vSphere 5, an administrator can manage the ESXi host from the command line using esxcli commands, such as esxcli network vswitch standard. The commands are available using the Direct Console User Interface (DCUI) to access the ESXi shell, using a remote application like putty to ssh into the host, or through the vSphere Command-Line Interface (vCLI).
A second method to access the command line is by utilizing an application such as putty to ssh into the ESXi host. In order for ssh to work you must enable the sshd service on the ESXi host. And a third method to run command line commands is thru vCLI. The vCLI provides a command-line interface for ESXi hosts. The central system that VMware uses is a downloadable appliance called vMA. vMA enables administrators to run scripts that interact with ESXi hosts and VMware vCenter Server systems without having to authenticate each time.
Direct Console User Interface (DCUI)
- When the DCUI screen appears, press F2 Customize the System and login as root.
- Scroll to Troubleshooting Options and press Enter.
- Choose Enable ESXi shell and press Enter.
- Press Esc until you return to the main DCUI screen.
To enable ssh from the vsphere Client
- Select the host and click the Configuration tab.
- Click Security Profile in the Software panel.
- In the Services area, click Properties.
- Select ssh and click Options.
- Change the ssh options. To change the Startup policy across reboots, click Start and stop with host and reboot the host.
- Click OK.
First method from the Direct Console User Interface (DCUI)
- Hit Alt+F1, if TSM is enabled, log in with root credentials, else
- Once the DCUI screen appears, press F2 and login as root to enable the TSM.
- Navigate down the screen and choose Troubleshooting Options, and press enter.
- Troubleshooting Options provides additional options for TSM in ESXi 4.1.
<Enable/Disable> Local Tech Support – Access command line via Alt+F1 on the console.
<Enable/Disable> Remote Tech Support (ssh) – ssh access on the console of the ESXi host.
Modify Tech Support Timeout – Tech Support Mode will be disabled after a certain amount of time.
Second Method from the vSphere Client
- From the vSphere Client, select the host and click Configuration tab.
- Then choose Security profile and Properties.
- Here you can enable Local Tech Support as well as Remote Tech Support (ssh). They are enabled
- if the Daemon is running, and disabled if the Daemon is Stopped.
- If you want to enable either mode, highlight the mode, then choose Options.
- Now you can modify the Startup Policy or change the Service to Start, then click OK.
Access the local TSM (Local Tech Support):
At the main DCUI screen, press Alt+F1, login.
Access the remote TSM:
Use a utility, such as putty, to establish an ssh connection.
ESX 4.x and Earlier
If you are using an ESX 4.x or earlier host, then you will need to use a third-party tool like putty to ssh into the ESX box. Essentially, you are logging into the service console, which is running Red Hat Linux. The challenge comes with ESXi because ESXi does not have a service console, although it is possible to setup a virtual appliance called vMA to run the command line. Instead let’s look at a method called Tech Support Mode, which is a hidden or unsupported method to gain command line access to the host. Essentially, you are enabling the ssh daemon directly on VMware’s proprietary version of Unix where the hypervisor is running, enabling the root user to either log in directly on the console of the ESXi host, or log in remotely via ssh.
ESXi 3.5 or 4.0
- To start, check the techSupportMode setting. To make sure this setting is correct, log into the vCenter Server, using the vSphere Client. Depending on version, this may not be necessary.
- Select the ESXi host and choose the Configuration tab, then select Advanced Settings in the Software panel. In the left pane, click VMkernel.
- Enable VMkernel.Boot.techSupportMode and click OK. Reboot the ESXi host if you need to enable technical support mode.
- To use Tech Support Mode, log in to the ESXi host using the Direct Console User Interface (DCUI).
- Press Alt+F1 to display the console screen.
- Enter by typing unsupported to start the Tech Support Mode process. Note that no text will appear on the console window.
- Enter the password for the root user, and you should than see an ssh prompt.