SSH from ESX host to ESX host with No Password

0 Comments ESX 3.5 Tips, ESXi 3.5 Tips, Security

Sometimes you need to script a job that SSH’s into another ESX host, problem is you will be prompted for a password—pretty much taking out all the automation aspect of a script.

There is a way around this.  Simply generate a public SSH key and place it in an authorized_keys file on your 2nd, 3rd, 4th, etc. ESX host.

First we generate the key on the host you wish to SSH from:

[[email protected] .ssh]# ssh-keygen -t dsa

Generating public/private dsa key pair.

Enter file in which to save the key (/root/.ssh/id_dsa):

Using the default location is just fine.  We then take the contents of the file (located by default in /root/.ssh/) and place it into a file called authorized_keys which would be in the /root/.ssh/ folder of your destination ESX host.

After this has been done, I can now SSH from my primary ESX host to my secondary without being prompted for a password:

[[email protected] root]# ssh dpcrcvmesx2

Last login: Fri Jan 16 14:04:19 2009 from

[[email protected] root]#