Skip to content

Instantly share code, notes, and snippets.

@lmatter
Created July 12, 2023 21:48
Show Gist options
  • Save lmatter/5f14e73f80c30eedcd0bfdacacbd26a3 to your computer and use it in GitHub Desktop.
Save lmatter/5f14e73f80c30eedcd0bfdacacbd26a3 to your computer and use it in GitHub Desktop.
Use govc without having your password in clear text or command history
#!/bin/bash
# You must set GOVC_USERNAME and GOVC_URL first
echo -n Password:
read -s pw
echo
GOVC_PASSWORD=$pw govc session.login
@lmatter
Copy link
Author

lmatter commented Jul 12, 2023

I like using govc, but hated ever having my password in cleartext in an environment variable. This keeps it always hidden.

@danpritts
Copy link

Pretty sure that it puts it in a file on disk in your home directory instead. which, admittedly isn't visible to other users on the system, but is definitely a risk.

I poked at the docs to see how to relocate said file to /dev/shm (memfs). No obvious way, although the file seems to be in ~/.govmoni/sessions - presumably a symlink would work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment