I have used --pw-stdin in a script to open and unlock KeePassXC upon login, but it stopped working when I updated keepassxc to version 2.1.4.
This command should work fine to start and unlock KeePassXC:
keepassxc --keyfile ~/folder/keyfile.key --pw-stdin ~/anotherFolder/database.kdbx <<< password
KeePassXC starts, but is still in a locked state. I have to open it up from the tray, and input the password to unlock it.
Did you update from 2.1.3?
@droidmonkey yes I updated from 2.1.3.r245.gc4d6fa8
@droidmonkey this has started working again at some point so I'm closing this issue.
I am having the exact issue. Did you reboot or something like that?
@peperunas I think the issue disappeared with the latest update I did.
[2017-05-22 09:31] [ALPM] upgraded keepassxc-git (2.1.3.r245.gc4d6fa8-1 -> 2.1.4.r396.ga75746c7-1)
[2017-06-18 13:51] [ALPM] upgraded keepassxc-git (2.1.4.r396.ga75746c7-1 -> 2.1.4.r428.gf817eaa5-1)
I had the issue with 2.1.4.r396.ga75746c7, however 2.1.3.r245.gc4d6fa8 worked as expected, and 2.1.4.r428.gf817eaa5 also works fine. My best guess is that something in one of these commits fixed the issue: https://github.com/keepassxreboot/keepassxc/compare/a75746c...f817eaa
Try updating to the latest version (2.2.0) and see if you still have the issue. If that doesn't work try a build at f817eaa.
Tried build f817eaa and latest version 2.2.0. Still not working.
Hi @peperunas, I did some experimenting.. rebooted computer.. keepassxc started and unlocked automatically as expected.. exited keepassxc and tried to restart it manually from the terminal with "keepassxc --keyfile ~/path_to.key --pw-stdin ~/path_to.kdbx <<< password" but it did not work. The database was not unlocked. I then restarted the computer again and keepassxc did NOT unlock on autostart. Really strange. Basically it seems like the testing I did somehow broke keepassxc again?
Hi @droidmonkey, reopening this issue again since something strange is going on. Perhaps some temp/cache file is to blame?
I wonder if its a combo of a latent .lock file and single instance perhaps.
Yes, probably it's caused by the single instance, we need to dig more into this
I'm experiencing the same issue. It somehow works only, if there's no database in the history. If you clear every database tab with ^w, exit the application and then issue the command with --pw-stdin, it works.
I can confirm that closing (CTRL-W) the database solves this issue.
2017-07-03 19:32 GMT+02:00 Jan Hicken notifications@github.com:
I'm experiencing the same issue. It somehow works only, if there's no
database in the history. If you clear every database tab with ^w, exit
the application and then issue the command with --pw-stdin, it works.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/keepassxreboot/keepassxc/issues/590#issuecomment-312700247,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFwP622I0DJ7hMBVM-9Jk8aVbvjLntdwks5sKSWngaJpZM4Njasp
.
--
- Giulio
@janhicken @peperunas @droidmonkey @TheZ3ro I can also confirm. I made sure "remember last databases", "remember last key files and security dongles" and "load previous databases on startup" was unchecked in the settings, and then I cleared the "recent history" of databases. Now KeePassXC automatically unlocks on startup using --pw-stdin every time. Should be possible to figure out what is causing the issue now?
In Windows not work too. =(
Operating system: Windows 7 SP 1 (6.1)
CPU architecture: x86_64
Kernel: winnt 6.1.7601
KeePassXC - Version 2.2.0
Revision: caa49a8ef3ee28ed478192389b21d61107b3b8e0
P.S. Thanks to all the participants for creating the fork and developing the project! I've been waiting for this fork for two years.
I'm also unable to get this to work, the password never gets send, the CTRL-W method doesn't seem to work for me either.
OS: Windows 10
KeePassXC 2.2.0 64-bit
The fix is to ignore the previous opened databases if --pw-stdin is issued. Easy fix, i got this.
I guess I'm late to the party but here's a helpful screen recording: https://youtu.be/F5wEaE5QNBg.
not work. =(
Operating system: Windows 7 SP 1 (6.1)
CPU architecture: x86_64
Kernel: winnt 6.1.7601
KeePassXC - Version 2.2.2 32 bit
Revision: 6d46717
Run:
echo 123 | KeePassXC.exe /pw-stdin xxx
Result:

Run:
echo 123 | KeePassXC.exe --pw-stdin xxx
Result:

Run:
echo 123 | KeePassXC.exe xxx --pw-stdin
echo 123 | KeePassXC.exe xxx /pw-stdin
same result.
It doesnt work in windows. Totally separate issue though.
Just got version 2.2.2 and it works now again.
Greetings
Any ideas why the -stdin option works for me, when I use it over the terminal, but not, if I use the exactly same command in the startup applications to start keepassxc when logging in?
keepassxc --pw-stdin ~/Google\ Drive/Other/logins.kdbx <<< supersecretpassword
@g0r3, try with sh -c "keepassxc --pw-stdin /home/g0r3/Google\ Drive/Other/logins.kdbx <<< supersecretpassword" instead, that should work.
Mmmh... thank you for your reply
Trying it in the startup application keepassxc doesn't start at all, using the shell it complains about
sh: 1: Syntax error: redirection unexpected
Moving the second quotation mark after "kdbx" it works on the terminal, but again not over startup applications
@g0r3, strange.. that works perfectly fine for me.. you could setup a bash script otherwise, and run that?
#!/bin/bash
keepassxc --pw-stdin ~/Google\ Drive/Other/logins.kdbx <<< supersecretpassword
Thanks, your suggestion with the script brought me on the right track! I am using ubuntu and this is a bash != dash thing.
If I use
bash -c "keepassxc --pw-stdin ~/Google\ Drive/Other/logins.kdbx <<< supersecretpassword"
(bash instead of sh) it works perfectly fine also in the startup applications
If I use
bash -c "keepassxc --pw-stdin ~/Google\ Drive/Other/logins.kdbx <<< supersecretpassword"
(bash instead of sh) it works perfectly fine also in the startup applications
But of course you shouldn't save your password in cleartext within the command. You can instead save the pass in the gnome keyring:
https://gist.github.com/dAnjou/b99f55de34b90246f381e71e3c8f9262
Mehh...
The new release seems to have broke it again :(((
The regression has already been fixed in #1608 and will be released with 2.3.1.
hi - maybe somebody is interressted: win10 -64 bit - this works for me with autostart and autologin (win batch file):
start "xxx" C:\KeePassXC-2.3.0-Win64\KeePassXC.exe --pw-stdin
timeout /t 3
sendkeys-x64 -s "password"
sendkey enter
taskkill /IM keepassxc.exe >nul
exit
sendkeys.exe and sendkey.exe are commandtools (look for it) which I copied to system32-folder.
in keepassxc you have to set under options: minimize to tray when close.
The regression has already been fixed in #1608 and will be released with 2.3.1.
when is this going to be released? Just to know if I should wait for release or use the fixed version..
Soon.
hi - maybe somebody is interressted: win10 -64 bit - this works for me with autostart and autologin (win batch file):
start "xxx" C:\KeePassXC-2.3.0-Win64\KeePassXC.exe --pw-stdin timeout /t 3 sendkeys-x64 -s "password" sendkey enter taskkill /IM keepassxc.exe >nul exitsendkeys.exe and sendkey.exe are commandtools (look for it) which I copied to system32-folder.
in keepassxc you have to set under options: minimize to tray when close.
Hi, where i can download sendkeys.exe and sendkey.exe are commandtools??? Thanks
The regression has already been fixed in #1608 and will be released with 2.3.1. BUT
try this: https://drive.google.com/drive/folders/1od7aZXJBcW0msO3a-NZ7FHDcexKVjTLG?usp=sharing
I will delete this link in a couple of hours - give me a short reply after download
Thanks very much , downloaded
what is the correct command to start keepassxc with the password in Windows? in linux works well
@dacorsa I'm sorry - I don't use it anymore - maybe you should look for their forum or homepage to get your question answered
Most helpful comment
The fix is to ignore the previous opened databases if --pw-stdin is issued. Easy fix, i got this.