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
12
  • @user68186 yes, bash on Ubuntu 18.04. The author of the answer I linked didn't have any trouble either, but I and some other user did. I just don't know what the difference is. Apr 16, 2021 at 20:19
  • @user68186 thanks for all your effort! If I type just keepassxc & in a terminal and press enter, the gui app opens, and I get the prompt back. The GUI app continues running. That seems to contradict what you say, but it's probably just that I don't understand. Apr 16, 2021 at 20:42
  • You have autologin enabled? That would explain why secret-tool asks for a password: it is not unlocked yet.
    – vanadium
    Apr 16, 2021 at 20:49
  • 1
    @vanadium I don't have autologin enabled. The secret-tool is not asking for my sudo password. Rather KeePassXC is not able to read the password from stdin. Note, when we use secret-tool lookup... without the pipe, we see the password KeePassXC should see.
    – user68186
    Apr 16, 2021 at 20:57
  • 1
    Thanks for the explanation, I indeed misunderstood what you said about the use of &, I got it backwards. Apr 16, 2021 at 20:58

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .