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
Select the server you want to grant SSH access
Select "Configuration" tab
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:
Select "Properties..." option
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):
As 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:
Log 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":
Replace 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:
As 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:
For 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.