hostkey in script still fails - still requires interaction

Advertisement

ejs2010
Guest

hostkey in script still fails - still requires interaction

WinSCP 5.5.1
Win 2012 --> Linux (Isilon and web host)

I have followed the directions here for connecting using a hostkey
https://winscp.net/eng/docs/scripting#hostkey

I have created a text file:
option batch abort
option confirm off
open sftp://user@domain.com/ hostkey="ssh-rsa 1024 Host Key Info"
cd htdocs
option transfer binary
get myFile.txt D:\
close
exit

I call it using
Winscp.exe /console /script=myscript.txt

It runs and fails.

If I run it as:

WinSCP.exe /console /command "option batch abort" "open sftp://user@domain.com/ hostkey=ssh-rsa 1024 HostKey" "cd htdocs" "get file d:\" "exit"

I just get a prompt again.

I can run it without the hostkey in there and then the console stays up and I need to enter my password.

I was originally testing this against an Isilon and thought the issue was with the device, until I tried it with a web host and the same issue occurred.

Do I need to create a key pair? All searching I have done shows it works just as described in the link above.

Reply with quote

Advertisement

ejs2010
Guest

Sorry about that

I apologize.

Here you go - scrubbed except for where I forgot:

WinSCP.exe /console /command "option batch abort" "open sftp://user@domain.com/ -hostkey=""ssh-rsa 1024 KEY""" "cd htdocs" "get dearCalvin.php DearCalvin.php" "exit"

and log text
. 2014-03-05 16:00:17.156 --------------------------------------------------------------------------
. 2014-03-05 16:00:17.157 WinSCP Version 5.5.1 (Build 3970) (OS 6.1.7601 Service Pack 1 - Windows 7 Professional)
. 2014-03-05 16:00:17.157 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\
. 2014-03-05 16:00:17.157 Local account: domain\user
. 2014-03-05 16:00:17.157 Working directory: C:\Users\Me\Desktop
. 2014-03-05 16:00:17.157 Process ID: 11136
. 2014-03-05 16:00:17.157 Command-line: WinSCP.exe  /console /command "option batch abort" "open sftp://user@doain.com/ -hostkey=""ssh-rsa 1024 KEY""" "cd htdocs" "get dearCalvin.php DearCalvin.php" "exit" 
. 2014-03-05 16:00:17.157 Time zone: Current: GMT-6, Standard: GMT-6, DST: GMT-5, DST Start: 3/9/2014, DST End: 11/2/2014
. 2014-03-05 16:00:17.157 Login time: Wednesday, March 05, 2014 4:00:17 PM
. 2014-03-05 16:00:17.157 --------------------------------------------------------------------------
. 2014-03-05 16:00:17.157 Script: Retrospectivelly logging previous script records:
> 2014-03-05 16:00:17.157 Script: option batch abort
< 2014-03-05 16:00:17.157 Script: batch           abort     
> 2014-03-05 16:00:17.157 Script: open sftp://user@domain.com/ -hostkey="ssh-rsa 1024 KEY"
. 2014-03-05 16:00:17.157 --------------------------------------------------------------------------
. 2014-03-05 16:00:17.157 Session name: user@domain.com (Modified site)
. 2014-03-05 16:00:17.157 Host name: domain.com (Port: 22)
. 2014-03-05 16:00:17.157 User name: username (Password: No, Key file: No)
. 2014-03-05 16:00:17.157 Tunnel: No
. 2014-03-05 16:00:17.157 Transfer Protocol: SFTP
. 2014-03-05 16:00:17.157 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2014-03-05 16:00:17.157 Proxy: none
. 2014-03-05 16:00:17.157 Send buffer: 262144
. 2014-03-05 16:00:17.157 SSH protocol version: 2; Compression: No
. 2014-03-05 16:00:17.157 Bypass authentication: No
. 2014-03-05 16:00:17.157 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2014-03-05 16:00:17.157 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2014-03-05 16:00:17.157 SSH Bugs: A,A,A,A,A,A,A,A,A,A
. 2014-03-05 16:00:17.157 Simple channel: Yes
. 2014-03-05 16:00:17.157 Return code variable: Autodetect; Lookup user groups: A
. 2014-03-05 16:00:17.157 Shell: default
. 2014-03-05 16:00:17.157 EOL: 0, UTF: 2
. 2014-03-05 16:00:17.157 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2014-03-05 16:00:17.157 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2014-03-05 16:00:17.157 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2014-03-05 16:00:17.157 Cache directory changes: Yes, Permanent: Yes
. 2014-03-05 16:00:17.157 DST mode: 1; Timezone offset: 0h 0m
. 2014-03-05 16:00:17.157 --------------------------------------------------------------------------
. 2014-03-05 16:00:17.158 Looking up host "domain.com"
. 2014-03-05 16:00:17.163 Connecting to xxx.xxx.xxx.xxx port 22
. 2014-03-05 16:00:17.214 Waiting for the server to continue with the initialization
. 2014-03-05 16:00:17.214 Detected network event
. 2014-03-05 16:00:17.269 Detected network event
. 2014-03-05 16:00:17.269 Server version: SSH-2.0-OpenSSH_3.9p1
. 2014-03-05 16:00:17.269 Using SSH protocol version 2
. 2014-03-05 16:00:17.269 We claim version: SSH-2.0-WinSCP_release_5.5.1
. 2014-03-05 16:00:17.269 Waiting for the server to continue with the initialization
. 2014-03-05 16:00:17.319 Detected network event
. 2014-03-05 16:00:17.320 Doing Diffie-Hellman group exchange
. 2014-03-05 16:00:17.320 Waiting for the server to continue with the initialization
. 2014-03-05 16:00:17.461 Detected network event
. 2014-03-05 16:00:17.461 Doing Diffie-Hellman key exchange with hash SHA-1
. 2014-03-05 16:00:17.547 Waiting for the server to continue with the initialization
. 2014-03-05 16:00:17.623 Detected network event
. 2014-03-05 16:00:17.702 Verifying host key rsa2 0x23, long string with fingerprint ssh-rsa 1024 KEY
. 2014-03-05 16:00:17.702 Host key matches configured key
. 2014-03-05 16:00:17.702 Host key fingerprint is:
. 2014-03-05 16:00:17.702 ssh-rsa 1024 KEY
. 2014-03-05 16:00:17.702 Initialised AES-256 SDCTR client->server encryption
. 2014-03-05 16:00:17.702 Initialised HMAC-SHA1 client->server MAC algorithm
. 2014-03-05 16:00:17.702 Initialised AES-256 SDCTR server->client encryption
. 2014-03-05 16:00:17.702 Initialised HMAC-SHA1 server->client MAC algorithm
. 2014-03-05 16:00:17.702 Waiting for the server to continue with the initialization
. 2014-03-05 16:00:17.843 Detected network event
! 2014-03-05 16:00:17.844 Using username "username".
. 2014-03-05 16:00:17.844 Waiting for the server to continue with the initialization
. 2014-03-05 16:00:17.895 Detected network event
. 2014-03-05 16:00:17.895 Prompt (7, SSH password, , &Password: )

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Sorry about that

As you can see in the log, the host key is verified correctly, so it has nothing to do with host key.

You are prompted for password because you do not provide any in your script.

Reply with quote

ejs2010
Guest

Re: Sorry about that

martin wrote:

As you can see in the log, the host key is verified correctly, so it has nothing to do with host key.

You are prompted for password because you do not provide any in your script.

Thanks for the info - but I don't want the password in plain text in a file on the computer. Am I mistaken on what the hostkey does?

Reply with quote

Advertisement

You can post new topics in this forum