Open insinfo opened 2 years ago
To use it, set the following environment variables:
$env:ASKPASS_PASSWORD =
With those set, the ssh_user should be able to ssh without being prompted for the password, as it is provided by askpass.
Let us know if that helps.
@tgauth, where to get the askpass.exe from in order to set its path in $env:SSH_ASKPASS
?
@tgauth Should this one be closed?
the ideal is to have a solution that doesn't need to use environment variables as in Linux. mainly for senarios to execute commands in the terminal via compiled code or scripts where you don't want to put this information in the environment variables
not to mention that askpass.exe is not natively available in PowerShell
I added a password CLI argument for SSH and SCP. I am using it on Windows but it should work on other OSs too.
To specify a password: -Z password
@dkrahmer good job, do you have the compiled binaries for download?
I created a repo release that includes Win32 binaries. https://github.com/dkrahmer/openssh-portable/releases/
@dkrahmer I downloaded your compiled version but it's not working, nothing happens when I run it
I went to open the executable in the Visual Studio debugger and saw the message that is requesting libcrypto.sll
Sorry about that. I forgot to include libcrypto.dll which must be placed in the same directory. I added it to the release.
Suggestion. Install keyring with pipx and use it as a backend. This will use to Windows Generic Credential store to save your password. Unlike the Get-Credential PS commandlet there will be no prompt for password.
pipx install keyring
keyring set ssk_askpass askpass
# Password for 'askpass' in 'ssh_askpass': <Enter Password>
# Verify here
keyring get ssh_askpass askpass
# <Should print your password>
Create a askpass_keyring_util.bat
with the content:
@echo off
keyring get ssh_askpass askpass
Set
$env:SSH_ASKPASS_REQUIRE = "force"
$env:SSH_ASKPASS = "<Path to askpass_keyring_util.bat>"`
Verify by initiating ssh connection.
@Spitfire1900 I prefer a simple solution like passing the password on the command line and not having to set environment variables or install Python
solution of @dkrahmer is the best option for me
My personal opinion: sshpass is not part of OpenSSH's umbrella. It's a side project. I think you should ask it to provide Windows binaries rather than asking it to be included here.
I'm used to using this on debian and now I'm needing to use it on windows with PowerShell and I didn't find any other option.