I'm trying to connect from Windows 2003 server to unix server using openssh and private/public keys but keeps asking for Private key passphare and Windows password.

I already added the public key on Authorized keys on linux ( if i connect using putty and the private key works fine). But I need to connect using bash script without request password and passphrase.

This is the command:

ssh -v -i privatefile -p 2022 user@server

This is the log:

OpenSSH_3.7.1p1, SSH protocols 1.5/2.0, OpenSSL 0.9.7b 10 Apr 2003
debug1: Connecting to SERVER port 2022.
debug1: Connection established.
debug1: identity file privatefile type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.7.1p1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-sha1 none
debug1: kex: client->server aes128-cbc hmac-sha1 none
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'SERVER' is known and matches the RSA host key.
debug1: Found key in /cygdrive/c/Users/PAMA1/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
D:\Entrada\z_Bkp>NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received

Anyone gaining unauthorized access will be subject to PROSECUTION.

debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mi
debug1: Next authentication method: publickey
debug1: Trying private key: bilaetlopenssh
Enter passphrase for key 'bilaetlopenssh':
debug1: Next authentication method: keyboard-interactive
Enter your Windows password :
  • I'm not sure you can entirely automate that process without compromising your key passphrase ?
    – avia
    Commented Oct 27, 2021 at 2:20
  • 1
    "but keeps asking for Private key passphrase" – This is expected. The passphrase and the password are different concepts. If you want to connect without being asked, there are two ways: (1) Remove the passphrase from the key. (2) Supply the passphrase automatically somehow. Note this will require storing the passphrase in a file that needs to be protected; protecting it is as hard as protecting the key file, so there is no point in having the passphrase in the first place (unless you are going to provide the passphrase like from another computer). Commented Oct 27, 2021 at 4:58

1 Answer 1


if using putty, you can use puttygen to store the key dynamically the private key, entering password key once (that is until reboot).

recommanded action is to save a session with remote hosts, remote user and key used, and run command using that session.

\path\name\to\putty.exe -load "mysession"

so to copy using putty's pscp :

\path\name\to\pscp.exe -load "mysession" local-file.txt remote:/path/file.txt
\path\name\to\pscp.exe -load "mysession" remote:/path/file.txt local-file.txt

In unix world puttygen is called ssh-add, I don't have WSL to test it.

  • You are a genius! it works with: \path\name\to\pscp.exe -load "mysession" local-file.txt remote:/path/file.txt Commented Oct 27, 2021 at 13:40

You must log in to answer this question.

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