Wednesday, December 10, 2014

Allowing SSH to ESXi Servers with public/private key authentication


If you have a large number of ESXi hosts that you need to SSH to and they have various passwords and so on, (this is not super secure, so do at your own security assessment)

Just like you can do this on a Unix host, you can do the same for ESXi:

1.  Generate a Public/Private key on the linux host:

cd ~/.ssh
ssh-keygen -t rsa

This will create two files in ~/.ssh: id_rsa and id_rsa.pub.

In ESX 5.X,  the location of authorized_keys is: /etc/ssh/keys-<username>/authorized_keys

So you can do this:

scp /root/.ssh/id_rsa.pub remote-ESXi-host:/etc/ssh/keys-root/authorized_keys

Like this for example:

scp /root/.ssh/id_rsa.pub 192.168.3.102:/etc/ssh/keys-root/authorized_keys

Of course if you want to do this from more than one host, then just add to the authorized_keys file rather than overwriting it....


No comments:

Post a Comment