1) SSH has to be enabled in both hosts. I will not detail this because it's well documented in installation guides.
2) Using vSphere client, go to "Configuration" tab for the host. Select "Security Profile" option on the left. Then "Properties" for the firewall section.
Check both SSH Server and SSH Client services.
3) Login to the console with root user. You can use popular putty in Windows or in linux you can use the command:
ssh root@xxx.xxx.xxx.xxx
(the question "Are you sure.....?" appears only the first time you connect to that server, answer "yes").
4) Verify that .ssh folder exists.
ls -la /.ssh
if the folder doesn't exist try to connect to the other host. This will create the folder:
ssh root@xxx.xxx.xxx.xxx
5) Create your private and public key
/usr/lib/vmware/openssh/bin/ssh-keygen -t dsa
When prompt for the name of the file in which to save the key, select: /.ssh/id_dsa
When prompt for passphrase, leave it empty (twice).
6) Now you have to export the public key from one host to the other and viceversa. The public key is a text file so you can cut and paste:
Copy the content of the file /.ssh/id_dsa.pub. In Linux terminal you can display content of the file with more /.ssh/id_dsa.pub and the select the text with mouse and copy it with CRTL+C ór SHIFT+CTRL+C
and add it to the file /etc/ssh/keys-root/authorized_keys on the other host. You can use vi editor:
vi /etc/ssh/keys-root/authorized_keys
(press i to enter insert mode, then CTRL+V to paste text, then ESC and finally x and ENTER to save the file).
You can add the public keys of any other host you want to authorize. Be careful to split the lines so each key is on different line.
7) There's a problem (I consider it a bug) in ESXI 5: when you reboot the host, all content of .ssh folder is cleared, so, to avoid configuring again, you can do the following steps:
move file known_hosts: mv /.ssh/known_hosts /etc/ssh/ssh_known_hosts
move identity files: mv /.ssh/id_* /etc/ssh/keys-root/
Now, if you want to ssh "to" this server you can do it as usual, but if you want to ssh "from" this server to another server, you have to use -i (identity) parameter:
ssh -l root -i /etc/ssh/keys-root/id_dsa xxx.xxx.xxx.xxx
Note: maybe you need to restart service after you moved files: /etc/init.d/SSH restart
Be careful to keep a logged terminal session while you test from another terminal session, and if something goes wrong, you can restart files to original locations.
I hope it will be useful.