0

Based on this extremely useful answer Start KeePassXC on boot I've almost got the desired result of unlocking keepassxc on login to work.

However, I (and another user who answer-commented about the same issue) have one problem remaining that keep it from being useful. Namely, per the linked answer, I give the command...

secret-tool lookup keepass <database_name> | keepassxc --pw-stdin <path-to-your-database>.kbdx

...and this works in that keepassxc is started... but I get this prompt on the next line after the command

Database password:

and the script hangs waiting for input.

The parts of the script work... I can issue

secret-tool lookup keepass <database_name>

and I get the right password typed out.

I can issue

echo <password> | keepassxc --pw-stdin <path-to-your-database>.kbdx

and it starts keepassxc and logs in... but I still get the prompt and the script hanging.

If I do

echo <password> | keepassxc --pw-stdin <path-to-your-database>.kbdx &

I still get the prompt and hang, but I can hit enter and it works.

So it appears that I need to supply an enter somehow?

  • Ubuntu version: 18.04
  • keepassxc version: 2.6.4

1 Answers1

1

Short answer

What you see is normal behaviour. The terminal will be released only once KeePassXC terminates.

Long answer

The Database password: prompt that you see on the terminal is a result of the --pw-stdin option you provided to the keepassxc option. Since there is a pipe, standard input is not your keyboard, but the output of the previous echo command.

As long as KeepassXC is running, your prompt is blocked. That is normal and happens with any other program. For example, try starting nautilus at the terminal.

You can release the prompt by moving that process to the background: press Ctrl+Z, then type bg to continue running the process in the background. fg will bring it to the foreground again. That is "traditional" terminal practice.

With the process on the foreground, the terminal will be released when you quit KeePassXC, either from quiting it in the graphical user interface, or pressing Ctrl+C in the terminal.

This behavior is unnoticed when you do not run the command from a terminal emulator, e.g. from a desktop launcher or from a shortcut key binding, or even using the Alt+F2 run dialog.

vanadium
  • 97,564