SSH Key based authentication for vCenter using Putty
December 9, 2023Exporting and viewing LDIF from vCenter using SSH / JXplorer
If there is an requiremnt to collect the LDIF from vCenter, it can be done via 2 methods.
Export using SSH
- Login to vCenter using SSH
- Type shell and hit enter to enter the bash shell
- Enter the below command to export the ldif and exter the password when prompted
# /opt/likewise/bin/ldapsearch -b "dc=vsphere,dc=local" -s sub -D "cn=Administrator,cn=Users,dc=vsphere,dc=local" -W > $(hostname)_"`date +"%d-%m-%Y"`".ldif
Note: The command command contains the domain and if you are not sure of your SSO domain, you can run the below command
/usr/lib/vmware-vmafd/bin/vmafd-cli get-domain-name --server-name localhost
Export using JXplorer
- Download and install JXplorer.
- Open JXplorer and click File -> Connect
- Enter the below details
Host: IP or FQDN_of_vCenter
Protocol: LDAP v3
Base DN: dc=vsphere,dc=local
Security Level: User + Password
Security User DN: cn=administrator,cn=users,dc=vsphere,dc=local
Security Password: administrator password - Select LDIF > Export Full Tree
- Click Ok and save the file.
Viewing offline the LDIF exported from JXplorer
- Open JXplorer and click LDIF -> View Offline
- Select the LDIF file and select Import
- JXplorer validates for errors in the ldif and once done, click Yes
- The LDIF can be viewed
Viewing offline the LDIF exported from SSH
An additional step is required if the LDIF is exported via SSH.
If you view the LDIF exported from SSH without performing this steps, you would see some containers missing.
- Open the LDIF in notepad
- Do a Find and Replace and change the CN of domain from Uppercase to Lowercase
- Replace All and now save the ldif
Now you can open the LDIF via JXploer using the previous step