New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--pw-stdin doesn't work on Windows #1185
Comments
I tried to get --pw-stdin to work on Windows and it just wasn't happening. The issue is mainly in how windows hands of gui apps from the cmd prompt. It is entirely different than Linux. I believe you can accomplish this using the "start" command though, ymmv. |
I've tried using the START command, but I'm entirely unsure how I'd get it to send the password from the CLI to KeePassXC, I know on the original KeePass is was -pw instead of the --pw-stdin we're using here. One thing I've noticed is that regardless of what you type for the --keyfile parameter, even if the path doesn't exist, the parameter will still be send to KeePassXC. Perhaps (I'm no expert) if a new parameter were to be made, say a clone of --keyfile, but instead this parameter would put it's information into the password box for KeePassXC, this issue could be fixed for Windows? I assume that this parameter would be a Windows exclusive parameter seeing as it is working fine for Linux, there must be a reason as to why the --keyfile parameter sends the information, but the other does not. |
Basically if you do that, anything running under your user account can get your password by harvesting the start-up script |
Can you point me in the right direction, what source files I should look at that control the CLI parameters? I'm super rusty on my coding, but I'll have a look if it means I might be able to help fix this issue, honestly it's the only thing stopping me from switching over to KeePassXC. |
Its mid way through main.cpp |
@TheChiefMeat Looking forward good news for this to be fixed. |
I haven't actually been able to work on this at all yet. Can anyone help me get past this error? I've set up the env but every time I try to compile I get:
|
You need to install libgcrypt20-dev |
Honestly having trouble finding it, couldn't see it at all on the FTP server that gnupg has: And msys2 comes up with:
|
Sorry my mistake, i was thinking Ubuntu. Here is the msys instructions per our wiki:
|
Thanks, but I'm still getting the Managed to find it on the https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/ page though and manually installed it. Edit: Builds fine now, I'll start digging into the code and see what I can do. |
You might have to do a sync by performing Pro Tip: |
Welp, that was relatively easy, I fixed the --pw-stdin bug already xD How do I merge the code to the main branch? I've never used Github before this. |
You'll want to first checkout develop, then make a new branch called |
Forgot to say, opened up a pull request with the above fix. |
I can't reproduce this
|
On Windows? With cmd.exe or Powershell? |
I'm using msys. I will test with cmd.exe and Powershell, alternatively I think I have a fix for other shells too |
Nothing, I was trying
But this doesn't seems to work. |
Msys2 works differently, since it's basically a Unix shell. |
I think I narrowed this down. If you try this:
the result will depend on your shell. In PowerShell the To use the
Redirecting a file works fine with both:
where I would expect any program that can output text on stdout will work just fine even on Windows to pipe it in. |
Can confirm that the following works with CMD even without the echo foo| before.
Having trouble with the other method though. The password box is now being ticked, but the raw password is not being piped through properly if I do:
--pw-stdin seems fine with paths, but not with anything else? |
If you want to have your password on the command line itself you can use echo like so:
But please bear in mind special characters will most likely break the echo command and as said before it's not a secure way to handle your passphrase. |
Should this issue be closed? Looks like it was fixed: #1336 (comment) |
Yup i agree |
Hello, i also have the same problem. Tried everything, but nothing works. Cant't send my password. would this be fixed in future? |
I just create file with password and use "--keyfile". Of course, this is not safety. But that’s all we have. Example: |
Hello, i know that this works. But i have to use a passwort because everyone who uses my PC can open the database. My batchfile has an input parameter like (set /p Input=Enter Crypt:) so the password isn't stored in this file! |
What's the point? Why can't you just enter the password after KeePassXC opens |
im starting different programs in a batch. Most have the same Password, so i have to fill it only once! |
I'm sorry, but I changed now to the original KeePass and the paramenter -pw: works fine for me. It is realy pity. |
i found a solution that works for me |
@BARR001 I tried that and i doesn't worked. But if use the portable version everything works fine. How do you managed, that the batch file closes after it opened the programm? My only closes from itself, if I close the programm. |
You must not include a space between the password and the pipe | |
i don't have a solution yet. The console keeps open |
there is no space. It works fine. It also works if there is no space before and after the pile, like |
Thanks @BARR001 |
But i have a new Problem so this solution is not useful for me! |
You can close the console by running it through a power shell from a batch file. @echo off
setlocal
cd /d %~dp0
set kdbx=your.kdbx
set pass=password.txt
set key=keyfile.key
set script=Start-Process -FilePath "KeePassXC.exe" -ArgumentList "%kdbx% --keyfile %key% --pw-stdin" -RedirectStandardInput "%pass%"
set script=%script:"=\"%
powershell -Command "%script%"
endlocal |
very useful, someone have a batch or powershell to open multiple databases? i tried it months ago and i cant open second or third database with stdin... example: in pass.txt
even password1\npassword2 dont work with windows ;) |
@steel4me It's easier to use the AutoOpen feature as described here: https://keepassxc.org/docs/KeePassXC_UserGuide.html#_automatic_database_opening |
I love you! Thx! Was AutoOpen always there or has been introduced in the last updates? |
facepalm, strange that i didn't found it myself, sorry |
@m-a-v kdbx://file://192.192.192.192/share if this is not possible i will mount a network drive and open it over network drive path |
hello community after starting i want to start firefox that need the proxy of KeePassXC |
You could use an AutoIt script ...
|
This feature works on Windows, you just have to use it "carefully" |
You guys could include straightforward instructions to use this feature on Windows, you know? How do i pass a password with special characters? In my case it doesn't pass % and the character following it |
try %% or % or /% |
Expected Behavior
Database is launched and unlocked, given the provided password and/or keyfile.
Current Behavior
Database fails to unlock, only successfully reading the keyfile path (however databases with only a keyfile and without a password unlock successfully).
Steps to Reproduce (for bugs)
Context
I'm trying to launch my database without any user intervention at startup, and this issue is stopping me from doing so.
Debug Info
KeePassXC - Version 2.2.2
Revision: 6d46717
Libraries:
Operating system: Windows 10 (10.0)
CPU architecture: x86_64
Kernel: winnt 10.0.14393
Enabled extensions:
The text was updated successfully, but these errors were encountered: