Enable SSH access to ESX 4.x VMware Server

Ricardo MartínezInformation Security
Published:
As an ESX VMware OS Administrator, sometimes we need to get remote terminal access to the servers, the reasons can be multiple: our user interface crashed, server cannot be accessed via GUI but can be pinged, terminal access is the only option to use some functions or just to feel the power of the command prompt.

The SSH protocol can be used to get access to the remote terminal of your servers. Why not telnet? telnet is a plain-text protocol which can be easily violated. Read more: wiki.

Now, to get access to the terminal console using SSH, first of all we need to check if the server has SSH service enabled.

SSH Server on ESX

Activating SSH Server on ESX

1.

Select the server you want to grant SSH access

2.

Select  "Configuration" tab

3.

Select "Security Profile" optionAs you can see on the image, the SSH Server is already enabled in my ESX server, if you don't have it, you need to enable it:

4.

Select "Properties..." optionSecurity Options - Properties

5.

Check the "SSH Server" optionOk, now you are ready to access via SSH to your server, but you don't have a user more than root to access.

Trying to access with root user via SSH to the server

Now, if you try to access via SSH with root user you will get the following message (i'm using OpenSSH for Windows as SSH Client in this tutorial):
Enable root access via SSHAs you can see, we cannot access via SSH with the root user, that's cause ESX has SSH root access unable by default.

Enabling root access via SSH

We need to access via SSH with another user than root:
Login normal user and ssh_config editLog in via SSH, than type the reserved word "su" to get root authentication and type the password for root user.

Next step is to edit the file sshd_config. As shown in the previous image, type "nano /etc/ssh/sshd_config" and press enter.

The following screen will apear. Scroll down and edit the option "PermitRootLogin":
PermitRootLogin ssh_config editionReplace the "no" with a "yes". Press Ctrl+o to save it, and Ctrl+x to exit.

You will have to restart the ssh service, type "/etc/init.d/sshd restart" to restart the service on the server.

Now you can exit and try log in with root user again:
Root loginAs you can see, we got access via SSH to the server.

Differences between log in directly with root and switching to root from another user

Why did we logged in with root directly if we already got root authentication via any other user? let's see the next 2 images:
Difference normal user & root user 1Difference normal user & root user 2For example, as you can see in the title bar of the first image, a normal user is logged and than switched to root user. The commands available in that case are just 2, that means minimal functions are available in that way. In the other case, on the second image you can see the root user logged directly and more functions are available (those are the most used functions by the way), so you can manage via SSH your server.

Any comments appreciated. Like if it was useful or if you just liked my article, thanks.
2
3,516 Views
Ricardo MartínezInformation Security

Comments (2)

Commented:
Great article! Have shared with all my VMWare Administrators.

-Jared
Ricardo MartínezInformation Security

Author

Commented:
Thank you! i'm glad my article is helpful for you, i think this is a knowledge that all of us that work with ESX need to know.

Regards
Ricardo

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.