Last updated on Wednesday 31st of May 2023 04:49:02 PM



How to enable SSH on your ©ESXi host.

Using vim-cmd to enable SSH on host start up

First enable SSH in your host

Enabling the SSH protocol is a rather simple task in any ESXi host. Just click in the Host node, right click over Actions and go to the entry shown in the image below.

How to enable the SSH protocol in an ESXi host How to enable the SSH protocol

Keeping the service enabled across reboots is a bit more tricky, as the service will be disabled every time you restart your server.

Keeping the SSH service on across reboots of the ©ESXi host

Since ©ESXi 6.7.0 ©VMWare has decided to not switch the SSH service on, even though you might have decided to turn it on in a previous power on cycle. This means that you have to remember to switch it on again manually through the http web client every time you reboot some server.

This can be really annoying when you have to work over a remote connection through a firewall, as you might not have immediate web access to the HTML5 interface. On the other hand, the alleged security reinforcement is not quite clear, as: the SSH protocol is an industry standard and secure enough (by now), at least more secure than HTTP, which is the protocol ©ESXi enabled by default.

So, let's get to the matter. Fortunately we have the /etc/rc.local.d/local.sh file which allows us to set some start up code and we also have the vim-cmd command, which allows us to enable the SSH shell via a shell command.

vim-cmd hostsvc/enable_ssh > /dev/null 2>&1

So, to enable this service on startup we just have to add this line to the /etc/rc.local.d/local.sh file. We have prepared this code snippet for your convenience, just cut and paste to your ©ESXi shell to enable the SSH protocol on start up. Just copy and paste to your shell and press enter.

You can also use the chkconfig command that allows to manage services. Still this Linux tool has been cut down so that you can't set the service to start automatically, again, adding this command to the '/etc/rc.local.d/local.sh' file will do it.

chkconfig SSH on > /dev/null 2>&1

Another option is to use the init.d style control script at /etc/init.d/SSH:

/etc/init.d/SSH start > /dev/null 2>&1

Add any of this methods just before the exit 0 statement in your '/etc/rc.local.d/local.sh' file. The redirection at the end makes sure that any output is discarded.



Daniel J. García Fidalgo
33HOPS