When doing a scripted install it might be useful to create additional user accounts. You can easily do this with the following command:
/usr/sbin/useradd -m -p ‘\$1$ZRo.R0\$1Lk8iA0AaqVFlojm.BTmr/’ -c administrator -g users -G users -d /home/administrator -s /bin/bash administrator
The “-p” value is the encrypted password. You can create them by using the tool “grub-md5-crypt” on a linux box. Just type “grub-md5-crypt” and type your password twice and it returns a md5 encrypted password which you can use in your scripted install. Keep in mind that there can be special characters in your password, if you do a scripted install this will be misinterpreted and you these characters need a preceding “\”.
Daniel Hernandez says
Interesting you posted this today because I was actually searching on this yesterday. I had already figured it out. But how ironic you posted.
This method is good for new builds but how about if you want to add the account on new builds as well as already deployed host. I will have to dig into the RCLI to see if the RCLI can retro fit an environment.
An ESX admin would need an automated setup which allows you to login into every host which my environment already has utilizing SSH Keys. But not as clean as I would like it.
But am always looking for ways to improve the environment and keeping consistency.
So I wonder if I can modify the script below to add accounts to each existing ESX host without storing the pass in plain text. Id like to leverage using the MD5 hash. Allowing other Administrators to create there own MD5 hash that way no one truly knows there pass, and the PowerShell just gets ran across the environment.
http://communities.vmware.com/servlet/JiveServlet/download/1014729-12094/createuser3.ps1?tstart=0&start=15
Thanks for the great blog.
Daniel Hernandez says
Just to add to my existing post. The reason I also like the Powershell method is because it allows access to the VIC also. I dont know of a quick command in the service console to add a user to the VIC my experience an XML file needs to be changed.