8

I would like to authenticate to neomutt using keepassxc. I could not find a way to send password to neomutt's stdin. How can i do that ?

I imagine something like this:

keepassxc-cli exportpass mydatabase.kdbx  [email protected]

end output would be the password it self. How can I achieve this ?

EDIT: I have found out out keepassxc-cli show Database.kdbx accounts.google.com. But it does not show password. Instead it returns PROTECTED.

Thank you for help

Jan Černý
  • 1,185
  • 2
  • 24
  • 46

2 Answers2

15

The solution is to use the -s (--show-protected) and -a (--attributes) flags as follows:

keepassxc-cli show -sa password database entry

-s will display the password instead of PROTECTED , and -a password will output only the password.

AdminBee
  • 21,637
  • 21
  • 47
  • 71
chwallen
  • 301
  • 2
  • 4
1

The solution is:

keepassxc-cli show -s Database.kdbx entryName | sed -n 3p | cut -c11-
Jan Černý
  • 1,185
  • 2
  • 24
  • 46
  • `export MYSECRETENV=$(keepassxc-cli show -q -s -a password vault.kdbx -y 2:85798674 /path/to/your/Secret\ Name)` This will silent the prompt and put the password in the ENV variable. This example also uses YubiKey, `-a password` is the name of the built-in attribute named "password". I also showed whitespace escape in `Secret\ Name`. – Dzintars Apr 18 '23 at 12:52