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....


Tuesday, December 9, 2014

VMware NFS datastores inactive (unmounted) after reboot

This comes up once in a while, you reboot a server, or a storage, and the datastores that are NFS mounted don't come up.  (In this case, I used update manager to patch some ESXi hosts, and it happened.

This is what it looks like:


The resolution is quite simple, you *could* just unmount the NFS stores and remount them, however that can take time, the easy way is to SSH to the host, and issue this command:

esxcfg-nas -r





that's it!