Persisting changes to root file system on VMware ESXi 4.0

I had a need to get a host to ssh into a ESXi host without password. Obviously this is done with a public key, but everything changed on your ESXi gets lost on reboot, so here’s how to do it.

On your remote host:

ssh-keygen -t rsa

(Choose default location, and do not enter a password)

On your ssh-enabled ESXi:

mkdir /.ssh

Back on the remote host:

scp ~/.ssh/id_rsa.pub :/.ssh/authorized_keys

Check that you can now log in without password requirements.

Now the fun part – persisting the /.ssh/authorized_keys file. On the ESXi host:

busybox tar c - /.emptytgz /.ssh | gzip > /bootbank/oem.tgz

This will obviously destroy the contents of you oem.tgz file, so if you’ve installed with a custom ESXi image these changes get lost (but hey, if you did that, you already know about oem.tgz).

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.