Topic "Private key works in GUI but not console"

Author Message
patrussell87
[View user's profile]

Joined: 2014-04-04
Posts: 1
Location: United States
I am trying to script a transfer using a private key. Everything works fine when using the GUI but the key does not authenticate when scripting the connection.
The private key is configured both in WinSCP and Pageant.

Here is my command line:
Code:
"c:\Program Files (x86)\WinSCP\WinSCP.exe"  "/console" "open USER@HOST.com" "-privatekey=G:\Documents\Key2.ppk"


And the resulting log file:
Quote:
. 2014-04-04 08:08:48.370 --------------------------------------------------------------------------
. 2014-04-04 08:08:48.371 WinSCP Version 5.5.2 (Build 4130) (OS 6.1.7601 Service Pack 1 - Windows 7 Professional)
. 2014-04-04 08:08:48.371 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\
. 2014-04-04 08:08:48.371 Local account: RENTECH\prussell
. 2014-04-04 08:08:48.371 Working directory: c:\
. 2014-04-04 08:08:48.371 Process ID: 9384
. 2014-04-04 08:08:48.371 Command-line: "c:\Program Files (x86)\WinSCP\WinSCP.exe" "/console" "open USER@HOST.com" "-privatekey=G:\Documents\Key2.ppk"
. 2014-04-04 08:08:48.371 Time zone: Current: GMT-5, Standard: GMT-6 (Central Standard Time), DST: GMT-5 (Central Daylight Time), DST Start: 3/9/2014, DST End: 11/2/2014
. 2014-04-04 08:08:48.371 Login time: Friday, April 04, 2014 8:08:48 AM
. 2014-04-04 08:08:48.372 --------------------------------------------------------------------------
. 2014-04-04 08:08:48.372 Script: Retrospectivelly logging previous script records:
< 2014-04-04 08:08:48.372 Script: Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
. 2014-04-04 08:08:48.372 --------------------------------------------------------------------------
. 2014-04-04 08:08:48.372 Session name: open USER@HOST.com (Modified site)
. 2014-04-04 08:08:48.372 Host name: HOST.com (Port: 22)
. 2014-04-04 08:08:48.372 User name: open USER (Password: No, Key file: Yes)
. 2014-04-04 08:08:48.372 Tunnel: No
. 2014-04-04 08:08:48.372 Transfer Protocol: SFTP (SCP)
. 2014-04-04 08:08:48.372 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2014-04-04 08:08:48.372 Proxy: none
. 2014-04-04 08:08:48.372 Send buffer: 262144
. 2014-04-04 08:08:48.372 SSH protocol version: 2; Compression: No
. 2014-04-04 08:08:48.372 Bypass authentication: No
. 2014-04-04 08:08:48.372 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2014-04-04 08:08:48.372 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2014-04-04 08:08:48.372 SSH Bugs: A,A,A,A,A,A,A,A,A,A
. 2014-04-04 08:08:48.372 Simple channel: Yes
. 2014-04-04 08:08:48.372 Return code variable: Autodetect; Lookup user groups: A
. 2014-04-04 08:08:48.372 Shell: default
. 2014-04-04 08:08:48.372 EOL: 0, UTF: 2
. 2014-04-04 08:08:48.372 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2014-04-04 08:08:48.372 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2014-04-04 08:08:48.372 SFTP Bugs: A,A
. 2014-04-04 08:08:48.372 SFTP Server: default
. 2014-04-04 08:08:48.372 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2014-04-04 08:08:48.372 Cache directory changes: Yes, Permanent: Yes
. 2014-04-04 08:08:48.372 DST mode: 1; Timezone offset: 0h 0m
. 2014-04-04 08:08:48.372 --------------------------------------------------------------------------
. 2014-04-04 08:08:48.372 Looking up host "HOST.com"
. 2014-04-04 08:08:48.376 Connecting to xxx.xxx.xxx.xxx port 22
. 2014-04-04 08:08:48.465 Server version: SSH-2.0-OpenSSH_5.2
. 2014-04-04 08:08:48.465 Using SSH protocol version 2
. 2014-04-04 08:08:48.465 We claim version: SSH-2.0-WinSCP_release_5.5.2
. 2014-04-04 08:08:48.507 Doing Diffie-Hellman group exchange
. 2014-04-04 08:08:48.629 Doing Diffie-Hellman key exchange with hash SHA-256
. 2014-04-04 08:08:49.305 Verifying host key rsa2 XXXXXXXXXXXXXXXXXXX

with fingerprint ssh-rsa 1024 XXXXXXXXXXXXXXXXX
. 2014-04-04 08:08:49.305 Host key matches cached key
. 2014-04-04 08:08:49.305 Host key fingerprint is:
. 2014-04-04 08:08:49.305 ssh-rsa 1024 XXXXXXXXXXXXXXXXXXXXX
. 2014-04-04 08:08:49.305 Initialised AES-256 SDCTR client->server encryption
. 2014-04-04 08:08:49.305 Initialised HMAC-SHA1 client->server MAC algorithm
. 2014-04-04 08:08:49.305 Initialised AES-256 SDCTR server->client encryption
. 2014-04-04 08:08:49.305 Initialised HMAC-SHA1 server->client MAC algorithm
. 2014-04-04 08:08:49.426 Reading private key file "G:\Documents\Loading\Key2.ppk"
. 2014-04-04 08:08:49.428 Pageant is running. Requesting keys.
. 2014-04-04 08:08:49.429 Pageant has 1 SSH-2 keys
. 2014-04-04 08:08:49.429 Pageant key #0 matches configured key file
! 2014-04-04 08:08:49.429 Using username "open USER".
. 2014-04-04 08:08:49.473 Trying Pageant key #0
. 2014-04-04 08:08:49.514 Server refused our key
. 2014-04-04 08:08:49.514 Attempting keyboard-interactive authentication
. 2014-04-04 08:08:49.557 Prompt (6, SSH server authentication, Using keyboard-interactive authentication., Password: )
. 2014-04-04 08:08:53.923 Disconnected: Unable to authenticate
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24552
Location: Prague, Czechia
Your command-line syntax is completely wrong.
Please read:
http://winscp.net/eng/docs/guide_automation
_________________
Martin Prikryl
BD98037

Guest


prikryl wrote:
Your command-line syntax is completely wrong.
Please read:
http://winscp.net/eng/docs/guide_automation



Hi,

I got the same issue: Private key works in the GUI but not console. I'm attaching the screenshot. Would you please take a look and advise?
ScreenShot.png (15.23 KB) [Download]

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24552
Location: Prague, Czechia
BD98037 wrote:
I got the same issue: Private key works in the GUI but not console. I'm attaching the screenshot. Would you please take a look and advise?

Please attach a complete log file both from GUI and script.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License