hostkey parameter includes double quotes

Advertisement

Ignas
Guest

hostkey parameter includes double quotes

Hello,

I'm writing a script to connect server. Problem is that if I using double quotes, they are being included into the key. You can see it from the log:
"(Exception) **Host key does not match configured key "ssh-ed25519 256 xx:xx:xx..."!**".

If I put single quotes script simply doesn't run (just blinks cmd, but log being empty after this).

This is my script:
open sftp://root@XX.XXX.XXX.XX -privatekey=id_rsa.ppk -hostkey="ssh-ed25519 256 xx:xx:xx..."
put "license.txt" /root/license.txt
exit

And I'm calling script like this:
.\WinSCP.exe /console /script="prod_to_server.txt" /ini=nul /log="scriptLog.log"

How to omit quotes in the hostkey?
Thank you in advance!

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,285
Location:
Prague, Czechia

Re: hostkey parameter includes double quotes

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, use /log=path_to_log_file command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Ignas
Guest

Providing log

. 2018-05-10 16:09:56.464 --------------------------------------------------------------------------
. 2018-05-10 16:09:56.464 WinSCP Version 5.13.1 (Build 8265) (OS 10.0.16299 - Windows 10 Home)
. 2018-05-10 16:09:56.464 Configuration: nul
. 2018-05-10 16:09:56.464 Log level: Normal
. 2018-05-10 16:09:56.464 Local account: Ignas
. 2018-05-10 16:09:56.464 Working directory: C:\Program Files (x86)\WinSCP
. 2018-05-10 16:09:56.464 Process ID: 11640
. 2018-05-10 16:09:56.465 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" "/script=prod_to_server.txt" /ini=nul /log=scriptLog.log
. 2018-05-10 16:09:56.465 Time zone: Current: GMT+3, Standard: GMT+2 (FLE Standard Time), DST: GMT+3 (FLE Summer Time), DST Start: 2018-03-25, DST End: 2018-10-28
. 2018-05-10 16:09:56.465 Login time: Thursday, May 10, 2018 16:09:56
. 2018-05-10 16:09:56.465 --------------------------------------------------------------------------
. 2018-05-10 16:09:56.465 Script: Retrospectively logging previous script records:
> 2018-05-10 16:09:56.465 Script: open sftp://root@xx.xxx.xxx.xx -privatekey=id_rsa.ppk -hostkey="ssh-ed25519 256 xx:xx:xx..."
. 2018-05-10 16:09:56.465 --------------------------------------------------------------------------
. 2018-05-10 16:09:56.465 Session name: root@xx.xxx.xxx.xx (Ad-Hoc site)
. 2018-05-10 16:09:56.465 Host name: xx.xxx.xxx.xx (Port: 22)
. 2018-05-10 16:09:56.465 User name: root (Password: No, Key file: Yes, Passphrase: No)
. 2018-05-10 16:09:56.465 Tunnel: No
. 2018-05-10 16:09:56.465 Transfer Protocol: SFTP
. 2018-05-10 16:09:56.465 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2018-05-10 16:09:56.465 Disable Nagle: No
. 2018-05-10 16:09:56.465 Proxy: None
. 2018-05-10 16:09:56.465 Send buffer: 262144
. 2018-05-10 16:09:56.465 SSH protocol version: 2; Compression: No
. 2018-05-10 16:09:56.465 Bypass authentication: No
. 2018-05-10 16:09:56.465 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: Yes
. 2018-05-10 16:09:56.465 GSSAPI: Forwarding: No; Libs: gssapi32,sspi,custom; Custom:
. 2018-05-10 16:09:56.465 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2018-05-10 16:09:56.465 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2018-05-10 16:09:56.465 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2018-05-10 16:09:56.465 Simple channel: Yes
. 2018-05-10 16:09:56.465 Return code variable: Autodetect; Lookup user groups: Auto
. 2018-05-10 16:09:56.465 Shell: default
. 2018-05-10 16:09:56.465 EOL: LF, UTF: Auto
. 2018-05-10 16:09:56.465 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2018-05-10 16:09:56.466 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2018-05-10 16:09:56.466 SFTP Bugs: Auto,Auto
. 2018-05-10 16:09:56.466 SFTP Server: default
. 2018-05-10 16:09:56.466 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2018-05-10 16:09:56.466 Cache directory changes: Yes, Permanent: Yes
. 2018-05-10 16:09:56.466 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2018-05-10 16:09:56.466 DST mode: Unix
. 2018-05-10 16:09:56.466 --------------------------------------------------------------------------
. 2018-05-10 16:09:56.466 Looking up host "xx.xxx.xxx.xx" for SSH connection
. 2018-05-10 16:09:56.466 Connecting to xx.xxx.xxx.xx port 22
. 2018-05-10 16:09:56.501 We claim version: SSH-2.0-WinSCP_release_5.13.1
. 2018-05-10 16:09:56.543 Server version: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
. 2018-05-10 16:09:56.543 Using SSH protocol version 2
. 2018-05-10 16:09:56.543 Have a known host key of type ssh-ed25519
. 2018-05-10 16:09:56.581 Doing ECDH key exchange with curve Curve25519 and hash SHA-256
. 2018-05-10 16:09:57.220 Server also has ecdsa-sha2-nistp256/ssh-rsa host keys, but we don't know any of them
. 2018-05-10 16:09:57.220 Host key fingerprint is:
. 2018-05-10 16:09:57.236 ssh-ed25519 256 xx:xx:xx...
. 2018-05-10 16:09:57.236 Host key does not match configured key ssh-ed25519 256 xx:xx:xx...
. 2018-05-10 16:09:57.236 Attempt to close connection due to fatal exception:
* 2018-05-10 16:09:57.236 Host key fingerprint is ssh-ed25519 256 xx:xx:xx....
* 2018-05-10 16:09:57.236 (Exception) **Host key does not match configured key "ssh-ed25519 256 xx:xx:xx..."!**
. 2018-05-10 16:09:57.236 Closing connection.
. 2018-05-10 16:09:57.236 Sending special code: 12

Please note, that I hidden some sensitive information in the script.

Reply with quote

martin
Site Admin
martin avatar

Re: Providing log

Sorry, but that log is useless. Your have removed the all hostkey fingerprints. Those are fingerprints of a public key. It's not sensitive/secret at all.

Reply with quote

Advertisement

You can post new topics in this forum