This past weekend I was finishing up a couple of demo recordings for my VMworld sessions in case the live demos fail for whatever reason, which has happened to me in the past. A few of the demos involve the vSphere Web Client UI and I thought instead of wasting time and potentially fat fingering credentials up on stage, I would try to do everything I can to remove any potential hiccups. In vSphere 6.0, the vCenter Single Sign-On page is now completely in HTML and this not only means you can customize the UI as I have shown here but you can also do some other neat tricks with it.
I decided to update the HTML page to automatically pre-fill both the SSO username and password, so that when I need to login to the vSphere Web Client, I just have to hit the tab key and then click on the login button.
Disclaimer: Outside of a home lab or demo purposes, there is really no good reason for this. I can already hear Mike Foley sighing right now 😉 This also means that anyone who knows the address of your vSphere Web Client can just login, so you may want to only pre-fill the username and still type out the password in case you are concerned with that.
To pre-fill the value for the SSO username and/or password, you will need to edit the following file:
- Windows VC: C:\ProgramData\VMware\vCenterServer\runtime\VMwareSTSService\webapps\websso\WEB-INF\views\unpentry.jsp
- VCSA: /usr/lib/vmware-sso/vmware-sts/webapps/websso/WEB-INF/views/unpentry.jsp
For pre-filling the username, you will need to add a "value" property along with its actual value in the following section:
<input id="username" class="margeTextInput" type="text" value="*protected email*"/>
For pre-filling the password, you will need to add a "value" property along with its actual value in the following section:
<input id="password" class="margeTextInput" type="password" value="VMware1!"/>
Once you have saved your changes, you can then reload the browser and you should see that the vSphere Web Client now has both the username and password automatically pre-filled when the webpage loads.
Even better than using LastPass for this same purpose. Great idea!
I normally use a Password Manager for variety of reasons/benefits but in the case where you don't want to rely on external systems or networking, this is the next best thing. This is especially useful for isolated/lab environments 🙂
Thanks a lot for sharing this information.
When using an external Platform Service Controller (PSC), you need to update the unpentry.jsp on the PSC.
Once more driven back to this great post !!!
Awesome, and indeed, if using an external PSC, change the value there !
Thanks. Worked in vSphere 6.5, but for some reasons the Login button is deactivated until I change at least one character in the User Name field
Well, it seems to be a default behaviour of the login web page which keeps Login button deactivated until Username field is changed
Yes, this is expected as the UI is ensuring there's actual user input and is not aware of the pre-filled credentials. Simply hit "tab" which brings cursor to password field and hit enter
To always enable the login button, login to vCSA and edit /usr/lib/vmware-sso/vmware-sts/webapps/websso/resources/js/websso.js.
Just above the "setCSDInstalled();" line, add a line that says "enableLoginButton();", and save. No restart needed, just refresh the login page.
It seems you can still simply select the password field and hit enter 🙂
For ESXi host client for 6.5, is there a way to have pre-filled credentials?
Thanks work like charm...!!!
It is great! But I tried to replicate the method to ESXi host with no luck. There is a file /usr/lib/vmware/hostd/docroot/ui/views/login.html containing the required fields but changing it will have no effect. Even worse the changes will not be preserved after a reboot.
Any idea how to do this for the vSphere web client for each of my ESXi servers as well please ?
How do I clear all the list of users name from the text box? This is from the vsphere Web Client for VCSA 6.5 on Chrome browser.
I tried to clear the Chrome browsing data, still I could not remove the list of users name from the text box?
Thanks. I have managed to clear that. One required to clear all browsing data. By default, it only clear the hourly.
This really works. Thanks to William. Here is a more detailed step by step guide for the Linux newbee like myself:
Go to vCenter Appliance machine or SSH to it:
1. Login as root, password is the password for "*protected email*" one.
2. type shell to enter the root command mode.
3. type "cd /usr/lib/vmware-sso/vmware-sts/webapps/websso/WEB-INF/views/" to enter the directory where the file is.
4. type "vi unpentry.jsp" to edit the file with VI.
5. Edit the username line so that it goes like this: "".
1) type "/id="username"" to locate to where the username is saved. Move the cursor to the start editing place.
2) press "i" to start inserting text. press ESC key when done.
3) press "x" to delete excessive text.
6. Repeat step 5 to edit the password line so that it goes like this: "" where "Mypassword" is your own password.
7. press ESC key to exit out of editing mode.
8. type ZZ and press enter to exit VI and save the file.
9. type "exit" to leave the shell. type "exit" again to log off.
10. Open vCenter console in browser. The user name and password should already prefilled. But you need to put the cursor at the username field and press TAB key twice to activate the "login" button, once activated, press space or use the mouse to press the login button.