jc0326
Contributor
Contributor

I have used the following Postcustomization script. Which creates a random password sends it password to the guestinfo variable and makes the user reset it upon login.

#!/bin/bash

log=/var/log/cust_output.log
if [[ "x${1}" = "xprecustomization" ]]; then
password=$(openssl rand -base64 12)
echo "root:$password" | chpasswd
vmtoolsd --cmd "info-set guestinfo.custom.password $password"
passwd --expire root
elif [[ "x${1}" = "xpostcustomization" ]]; then
echo "customization complete..." >> ${log}
fi

Reply
0 Kudos