Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

jamescollett

prompt for passphrase

Did the FAQ help? I have the same issue and cannot figure out how to automate the supply of the passphrase.

Maybe we should not use a passphrase when implementing automation of SFTP?
martin

Re: Passing the private key passphrase

Please read FAQ. If that does not help, come back.
Dave10

Passing the private key passphrase

I'm trying to completely script a transfer using SFTP using the command line console. I've gotten to the point where everything works except when it gets to the point of authenticating, it wants the private key passphrase. No surprise there. But, I can't seem to find any documentation about how to send the passphrase natively within WinSCP (eg: in an INI file) or doing it through Pagaent. If I use the GUI, it's fine and I get connected to the remote host. I'm aware that having the passphrase in a text file is a bad idea, but humor me for now. Any ideas?

Here's my log output:

. 2009-06-23 16:08:31.925 Looking up host "sftp.myhost.com"
. 2009-06-23 16:08:31.956 Connecting to xxx.xxx.xxx.xxx port 22
. 2009-06-23 16:08:32.128 Server version: SSH-2.0-Connect:Enterprise_UNIX_2.4.02
. 2009-06-23 16:08:32.128 We claim version: SSH-2.0-WinSCP_release_4.1.9
. 2009-06-23 16:08:32.143 SSPI: acquired credentials for: backup@domain.INT
. 2009-06-23 16:08:32.143 Constructed service principal name 'host/sftp.myhost.com'
. 2009-06-23 16:08:32.143 GSSKEX disabled: The specified target is unknown or unreachable

. 2009-06-23 16:08:32.143 Using SSH protocol version 2
. 2009-06-23 16:08:32.221 Doing Diffie-Hellman group exchange
. 2009-06-23 16:08:32.331 Doing Diffie-Hellman key exchange with hash SHA-1
. 2009-06-23 16:08:32.940 Host key fingerprint is:
. 2009-06-23 16:08:32.940 ssh-rsa 1024 xx:xx:xx:xx:8e:48:a4:bc:bd:46:e8:3d:1f:c2:44:55
. 2009-06-23 16:08:32.940 Initialised AES-256 CBC client->server encryption
. 2009-06-23 16:08:32.940 Initialised HMAC-SHA1 client->server MAC algorithm
. 2009-06-23 16:08:32.940 Initialised AES-256 CBC server->client encryption
. 2009-06-23 16:08:32.940 Initialised HMAC-SHA1 server->client MAC algorithm
. 2009-06-23 16:08:33.143 Reading private key file "C:\Program Files (x86)\WinSCP\privatekey.ppk"
! 2009-06-23 16:08:33.143 Using username "USERNAME".
. 2009-06-23 16:08:33.206 Offered public key
. 2009-06-23 16:08:33.268 Offer of public key accepted
! 2009-06-23 16:08:33.268 Authenticating with public key "rsa-key-20090623"
. 2009-06-23 16:08:33.268 Prompt (2, SSH key passphrase, , Passphrase for key "rsa-key-20090623": )
! 2009-06-23 16:08:43.268 Wrong passphrase
. 2009-06-23 16:08:43.268 Prompt (2, SSH key passphrase, , Passphrase for key "rsa-key-20090623": )
. 2009-06-23 16:08:53.269 Disconnected: Unable to authenticate