ESXi Shell Access
An ESXi system includes a direct console that allows you to start and stop the system and to perform a limited set of maintenance and troubleshooting tasks. The direct console includes the ESXi Shell. The ESXi Shell includes a set of fully supported ESXCLI commands and a set of commands for troubleshooting and remediation. You must enable access to the ESXi Shell from the direct console of each system. You can enable access to the local ESXi Shell or access to the ESXi Shell with SSH.
ESXi Shell Local Access
The ESXi Shell is disabled by default. You can enable the ESXi Shell for troubleshooting from the direct console. All ESXCLI commands that are available in the ESXi Shell are also included in the vCLI package. Install the vCLI package or deploy the vMA virtual appliance, and run commands against your ESXi hosts, instead of running commands in the ESXi Shell itself. See Getting Started with vSphere Command-Line Interfaces.
Enabling the ESXi Shell
You can enable the ESXi Shell from the direct console, from the vSphere Client, or from the vSphere Web Client. Enabling the ESXi Shell means making it accessible as a local console available directly or over an out-of-band network.
To enable the ESXi Shell from the Direct Console
1
2
Scroll to Troubleshooting Options, and press Enter.
3
Select Enable ESXi Shell and press Enter.
On the left, Enable ESXi Shell changes to Disable ESXi Shell. On the right, ESXi Shell is Disabled changes to ESXi Shell is Enabled.
4
a
Select Modify ESXi Shell timeout and press Enter.
b
5
You can enable the ESXi Shell from the vSphere Client.
To enable the local or remote ESXi Shell from the vSphere Client
1
Select the host, click the Configuration tab, and click Security Profile in the Software panel.
2
3
Select ESXi Shell and click Options.
4
To enable access permanently, click Start and stop with host. The change will take effect the next time you reboot the host.
5
Click OK.
After you have enabled the ESXi Shell, you can use it from that monitor or through an out-of-band network connection.
To enable to local or remote ESXi Shell from the vSphere Web Client
1
Select the host, click the Manage tab, and click Settings.
2
Under System, select Security Profile.
3
4
5
When you select Start and stop manually, the service does not start when you reboot the host. If you want the service to start when you reboot the host, select Start and stop with host.
6
Select Start to enable the service.
7
Click OK.
After you have enabled the ESXi Shell, you can use it from that monitor or through an out-of-band network connection.
Setting Timeouts for the ESXi Shell
The ESXi Shell supports availability timeout and idle timeouts. By default, each timeout is disabled.
Availability timeout. The amount of time that can elapse before you must log in after the ESXi Shell is enabled. After the timeout period, the service is disabled and users are not allowed to log in. Corresponds to the UserVars.ESXiShellTimeOut advanced setting.
Idle timeout. The amount of time that can elapse before the user is logged out of an idle interactive sessions. Changes to the idle timeout apply the next time a user logs in to the ESXi Shell and do not affect existing sessions. Corresponds to the UserVars.ESXiShellInteractiveTimeOut advanced setting.
To set ESXi Shell timeouts from the Direct Console
1
From the Troubleshooting Mode Options menu, select Modify ESXi Shell and SSH timeouts and press Enter.
2
3
4
To set ESXi Shell timeouts from the vSphere Web Client
1
Select the host in the inventory, click the Manage tab, and click Settings.
2
Under System, select Advanced System Settings.
3
4
a
Select UserVars.ESXiShellTimeOut and click the Edit icon
a
You must restart the SSH service and the ESXi Shell service for the timeout to take effect.
5
a
Select UserVars.ESXiShellInteractiveTimeOut and click the Edit icon
a
You must restart the SSH service and the ESXi Shell service for the timeout to take effect.
6
Accessing the ESXi Shell with the Direct Console
After you enable ESXi Shell access, you can access the local shell.
To access the local ESXi Shell
1
2
When you type the password, characters are not displayed on the console.
3
To log out, type exit in the shell.
4
Remote Access to ESXi Shell Using SSH
If Secure Shell is enabled for the ESXi Shell, you can run shell commands by using a Secure Shell client such as SSH or PuTTY.
Enabling SSH for the ESXi Shell
By default, you cannot access the ESXi Shell using a Secure Shell client. You can enable SSH access from the direct console.
To enable SSH access in the direct console
1
2
Scroll to Troubleshooting Options, and press Enter.
3
Select Enable SSH and press Enter once.
On the left, Enable SSH changes to Disable SSH. On the right, SSH is Disabled changes to SSH is Enabled.
4
You can enable remote command execution from the vSphere Client.
To enable SSH from the vSphere Client
1
2
Click Security Profile in the Software panel.
3
4
Select SSH and click Options.
5
To enable SSH permanently, click Start and stop with host. The change takes effect the next time you reboot the host.
6
After you have enabled SSH, you can use an SSH client to log in to the ESXi Shell and run ESXi Shell commands.
Accessing the ESXi Shell with SSH
If SSH is enabled on your ESXi host, you can use an SSH client to run commands on that shell.
To access the ESXi Shell with SSH
1
2
Precise directions vary depending on the SSH client you use. See vendor documentation and support.
3
ESXi Shell Commands
The ESXi Shell includes several sets of commands.
esxcfg- commands
The esxcfg- commands available in the service console are deprecated. The commands will be removed from the ESXi Shell in a future release. See Reference to Replacements for Service Console Commands.
localcli commands
Set of troubleshooting commands for use with VMware Technical Support. localcli commands are equivalent to ESXCLI commands but bypass the host daemon (hostd).
Warning: localcli commands are only for situations when hostd is unavailable and cannot be restarted. After you run a localcli command, you must restart hostd. Using localcli commands in other situations is not supported. An inconsistent system state and potential failure can result.
ESXCLI Commands
The ESXi Shell in ESXi 5.0 and later includes a large set of new ESXCLI namespaces and commands. The complete ESXCLI command set is also part of the vCLI package. The ESXCLI command syntax in ESXi 5.0 and later is more flexible than the syntax in ESXi 4 and supports multiple namespaces.
esxcli [dispatch_option] <namespace> [namespace, ...] <cmd> [cmd_options]
Each command can use an arbitrary number of namespaces, and different commands have a different number of elements. All commands have also been reviewed for consistency and most commands have been renamed. For example:
Each get command returns single values.
esxcli hardware memory get
The list commands are used for multiple return values.
esxcli hardware cpu list
Many commands have options. Use an equal sign or a space between the option and the option value.
esxcli storage nfs add --host=<host_name> --share=<share_name> --volume=<volume_name>
esxcli storage nfs add --host <host_name> --share <share_name> --volume <volume_name>
Important For a complete list of ESXCLI commands, see the vSphere Command-Line Interface Reference. The vSphere Command-Line Interface Concepts and Examples document illustrates how to perform common tasks with ESXCLI or vicfg- commands.
Shell Commands
In contrast to VMware ESX, VMware ESXi does not include a console OS with a large set of shell commands and other software. However, a small set of shell commands is available in the ESXi Shell.
You can see a list of commands in /usr/bin. When you list the commands with ls -al, notice that several of the utilities are redirected to commands appropriate in the vSphere environment. The following commands produce different results than typical shell commands.
Important vmkvsitools is intended for use with VMware Technical Support. Do not use vmkvsitools to manage your system.
Go to /usr/bin and run ls -a to see a complete list.