martin wrote:
Richo wrote:
winscp.exe:
Supports -hostkey but not -filezilla nor /script
winscp.com:
Supports -filezilla and /script but not -hostkey
That's not correct. Both support all these switches.
If you have a specific problem, please show us what do you do and what problem/error do you get. A log file is always useful.
Thanks Martin, that is helpful to know. I guess I must just have a syntax error.
I have just shown the winscp.com interface details below.
# Example #1 - I expected this to fail as no hostkey was entered and it confirms I need the -hostkey switch.
Expected host key was not configured, use -hostkey switch.
* 2020-02-19 11:26:19.239 (Exception) **Expected host key was not configured, use -hostkey switch.**
# Example #2 - I expected to succeed as the hostkey was entered but it fails at the command line level indicating the -hostkey switch is unknown, a log file was not generated.
# Example #3 - I expected to succeed as everything was entered on the command line rather than in the script file but it could not even see the -hostkey switch on the command line and the log shows the -hostkey switch was both accepted and not accepted.
Expected host key was not configured, use -hostkey switch.
. 2020-02-19 11:41:08.272 Switch: /hostkey=ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
* 2020-02-19 11:41:08.600 (Exception) **Expected host key was not configured, use -hostkey switch.**
# Example #1
## Command Line:
"C:\Program Files (x86)\WinSCP\WinSCP.com" /script="C:\NSS\SFTP Client Profile\TestWinSCP.script" /log="C:\NSS\SFTP Client Profile\WinSCP-%date:~10,4%-%date:~7,2%-%date:~4,2%.log" /ini=nul /loglevel=2 /command "option batch continue" "option confirm on"
## Script:
open -filezilla "TestEnv"
exit
## Error:
In scripting you should not rely on saved sites, use this command instead:
open sftp://user@site.local/ -rawsettings ProxyPort=0
Searching for host...
Connecting to host...
Authenticating...
Expected host key was not configured, use -hostkey switch.
Host key fingerprint is ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=.
Authentication failed.
Exit code: 1
Max roundtrip: 0
## Log File:
. 2020-02-19 11:26:18.895 --------------------------------------------------------------------------
. 2020-02-19 11:26:18.895 WinSCP Version 5.17 (Build 10191) (OS 6.3.9600 - Windows Server 2012 R2 Standard)
. 2020-02-19 11:26:18.895 Configuration: nul
. 2020-02-19 11:26:18.895 Log level: Debug 2
. 2020-02-19 11:26:18.895 Local account: dom\user
. 2020-02-19 11:26:18.895 Working directory: C:\NSS\SFTP Client Profile
. 2020-02-19 11:26:18.895 Process ID: 3368
. 2020-02-19 11:26:18.895 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=5.17.0 /consoleinstance=_2964_97 "/script=C:\NSS\SFTP Client Profile\TestWinSCP.script" "/log=C:\NSS\SFTP Client Profile\WinSCP-2020-02-19.log" "/ini=nul" "/loglevel=2" "/command" "option batch continue" "option confirm on"
. 2020-02-19 11:26:18.895 Switch: /console=5.17.0
. 2020-02-19 11:26:18.895 Switch: /consoleinstance=_2964_97
. 2020-02-19 11:26:18.895 Switch: /script=C:\NSS\SFTP Client Profile\TestWinSCP.script
. 2020-02-19 11:26:18.895 Switch: /log=C:\NSS\SFTP Client Profile\WinSCP-2020-02-19.log
. 2020-02-19 11:26:18.895 Switch: /ini=nul
. 2020-02-19 11:26:18.895 Switch: /loglevel=2
. 2020-02-19 11:26:18.895 Switch: /command
. 2020-02-19 11:26:18.895 Parameter: option batch continue
. 2020-02-19 11:26:18.895 Parameter: option confirm on
. 2020-02-19 11:26:18.895 Time zone: Current: GMT+10 (E. Australia Standard Time), No DST
. 2020-02-19 11:26:18.895 Login time: Wednesday, 19 February 2020 11:26:18 AM
. 2020-02-19 11:26:18.895 --------------------------------------------------------------------------
. 2020-02-19 11:26:18.895 Script: Retrospectively logging previous script records:
> 2020-02-19 11:26:18.895 Script: open -filezilla "TestEnv"
> 2020-02-19 11:26:18.895 Script: Switch: -filezilla
> 2020-02-19 11:26:18.895 Script: Parameter: TestEnv
< 2020-02-19 11:26:18.895 Script: In scripting you should not rely on saved sites, use this command instead:
< 2020-02-19 11:26:18.895 Script: open sftp://user@site.local/ -rawsettings ProxyPort=0
. 2020-02-19 11:26:18.895 --------------------------------------------------------------------------
. 2020-02-19 11:26:18.895 Session name: TestEnv (Ad-Hoc site)
. 2020-02-19 11:26:18.895 Host name: site.local (Port: 22)
. 2020-02-19 11:26:18.895 User name: user (Password: No, Key file: No, Passphrase: No)
. 2020-02-19 11:26:18.895 Tunnel: No
. 2020-02-19 11:26:18.895 Transfer Protocol: SFTP (SCP)
. 2020-02-19 11:26:18.895 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2020-02-19 11:26:18.895 Disable Nagle: No
. 2020-02-19 11:26:18.895 Proxy: None
. 2020-02-19 11:26:18.895 Send buffer: 262144
. 2020-02-19 11:26:18.895 SSH protocol version: 2; Compression: No
. 2020-02-19 11:26:18.895 Bypass authentication: No
. 2020-02-19 11:26:18.895 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: Yes
. 2020-02-19 11:26:18.895 GSSAPI: Forwarding: No; Libs: gssapi32,sspi,custom; Custom:
. 2020-02-19 11:26:18.895 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2020-02-19 11:26:18.895 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2020-02-19 11:26:18.895 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2020-02-19 11:26:18.895 Simple channel: Yes
. 2020-02-19 11:26:18.895 Return code variable: Autodetect; Lookup user groups: Auto
. 2020-02-19 11:26:18.895 Shell: default
. 2020-02-19 11:26:18.895 EOL: LF, UTF: Auto
. 2020-02-19 11:26:18.895 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2020-02-19 11:26:18.895 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2020-02-19 11:26:18.895 SFTP Bugs: Auto,Auto
. 2020-02-19 11:26:18.895 SFTP Server: default
. 2020-02-19 11:26:18.895 Local directory: c:\localdir, Remote directory: /dir/sub, Update: Yes, Cache: Yes
. 2020-02-19 11:26:18.895 Cache directory changes: Yes, Permanent: Yes
. 2020-02-19 11:26:18.895 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2020-02-19 11:26:18.895 DST mode: Unix
. 2020-02-19 11:26:18.895 --------------------------------------------------------------------------
. 2020-02-19 11:26:18.895 Looking up host "site.local" for SSH connection
. 2020-02-19 11:26:18.958 Connecting to 192.168.0.1 port 22
. 2020-02-19 11:26:19.005 Selecting events 63 for socket 776
. 2020-02-19 11:26:19.005 Waiting for the server to continue with the initialization
. 2020-02-19 11:26:19.005 Looking for incoming data
. 2020-02-19 11:26:19.005 Looking for network events
. 2020-02-19 11:26:19.005 We claim version: SSH-2.0-WinSCP_release_5.17
. 2020-02-19 11:26:19.005 Detected network event
. 2020-02-19 11:26:19.005 Enumerating network events for socket 776
. 2020-02-19 11:26:19.005 Enumerated 18 network events making 18 cumulative events for socket 776
. 2020-02-19 11:26:19.005 Handling network write event on socket 776 with error 0
. 2020-02-19 11:26:19.005 Handling network connect event on socket 776 with error 0
. 2020-02-19 11:26:19.005 Looking for network events
. 2020-02-19 11:26:19.036 Detected network event
. 2020-02-19 11:26:19.036 Enumerating network events for socket 776
. 2020-02-19 11:26:19.036 Enumerated 1 network events making 1 cumulative events for socket 776
. 2020-02-19 11:26:19.036 Handling network read event on socket 776 with error 0
. 2020-02-19 11:26:19.036 Waiting for the server to continue with the initialization
. 2020-02-19 11:26:19.036 Looking for incoming data
. 2020-02-19 11:26:19.036 Looking for network events
. 2020-02-19 11:26:19.052 Remote version: SSH-2.0-SFTP Server
. 2020-02-19 11:26:19.052 Using SSH protocol version 2
. 2020-02-19 11:26:19.052 No GSSAPI security context available
. 2020-02-19 11:26:19.052 Detected network event
. 2020-02-19 11:26:19.052 Enumerating network events for socket 776
. 2020-02-19 11:26:19.052 Enumerated 1 network events making 1 cumulative events for socket 776
. 2020-02-19 11:26:19.052 Handling network read event on socket 776 with error 0
. 2020-02-19 11:26:19.052 Waiting for the server to continue with the initialization
. 2020-02-19 11:26:19.052 Looking for incoming data
. 2020-02-19 11:26:19.052 Looking for network events
. 2020-02-19 11:26:19.052 Doing ECDH key exchange with curve Curve25519 and hash SHA-256
. 2020-02-19 11:26:19.176 Detected network event
. 2020-02-19 11:26:19.176 Enumerating network events for socket 776
. 2020-02-19 11:26:19.176 Enumerated 1 network events making 1 cumulative events for socket 776
. 2020-02-19 11:26:19.176 Handling network read event on socket 776 with error 0
. 2020-02-19 11:26:19.176 Waiting for the server to continue with the initialization
. 2020-02-19 11:26:19.176 Looking for incoming data
. 2020-02-19 11:26:19.176 Looking for network events
. 2020-02-19 11:26:19.239 Host key fingerprint is:
. 2020-02-19 11:26:19.239 ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
. 2020-02-19 11:26:19.239 Verifying host key rsa2 xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx with fingerprints ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
. 2020-02-19 11:26:19.239 Attempt to close connection due to fatal exception:
* 2020-02-19 11:26:19.239 Host key fingerprint is ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=.
* 2020-02-19 11:26:19.239 (Exception) **Expected host key was not configured, use -hostkey switch.**
. 2020-02-19 11:26:19.239 Closing connection.
. 2020-02-19 11:26:19.239 Selecting events 0 for socket 776
# Example #2
## Command Line:
"C:\Program Files (x86)\WinSCP\WinSCP.com" /script="C:\NSS\SFTP Client Profile\TestWinSCP.script" /log="C:\NSS\SFTP Client Profile\WinSCP-%date:~10,4%-%date:~7,2%-%date:~4,2%.log" /ini=nul /loglevel=2 /command "option batch continue" "option confirm on"
## Script:
open -filezilla "TestEnv" -hostkey="ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx="
exit
## Error:
Unknown switch 'hostkey'.
Exit code: 1
Max roundtrip: 0
## Log File: nil
# Example #3
## Command Line:
C:\NSS\SFTP Client Profile>"C:\Program Files (x86)\WinSCP\WinSCP.com" /script="C:\NSS\SFTP Client Profile\TestWinSCP.script" /log="C:\NSS\SFTP Client Profile\WinSCP-2020-02-19.log" /ini=nul /loglevel=2 /command "option batch continue" "option confirm on" open -filezilla "TestEnv" -hostkey="ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx="
## Script:
exit
## Error:
Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
In scripting you should not rely on saved sites, use this command instead:
open sftp://user@site.local/ -rawsettings ProxyPort=0
Searching for host...
Connecting to host...
Authenticating...
Expected host key was not configured, use -hostkey switch.
Host key fingerprint is ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=.
Authentication failed.
Exit code: 1
Max roundtrip: 16
## Log File:
. 2020-02-19 11:41:08.272 --------------------------------------------------------------------------
. 2020-02-19 11:41:08.272 WinSCP Version 5.17 (Build 10191) (OS 6.3.9600 - Windows Server 2012 R2 Standard)
. 2020-02-19 11:41:08.272 Configuration: nul
. 2020-02-19 11:41:08.272 Log level: Debug 2
. 2020-02-19 11:41:08.272 Local account: dom\user
. 2020-02-19 11:41:08.272 Working directory: C:\NSS\SFTP Client Profile
. 2020-02-19 11:41:08.272 Process ID: 4088
. 2020-02-19 11:41:08.272 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=5.17.0 /consoleinstance=_6060_184 "/script=C:\NSS\SFTP Client Profile\TestWinSCP.script" "/log=C:\NSS\SFTP Client Profile\WinSCP-2020-02-19.log" "/ini=nul" "/loglevel=2" "/command" "option batch continue" "option confirm on" "open" "-filezilla" "TestEnv" "-hostkey=ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx="
. 2020-02-19 11:41:08.272 Switch: /console=5.17.0
. 2020-02-19 11:41:08.272 Switch: /consoleinstance=_6060_184
. 2020-02-19 11:41:08.272 Switch: /script=C:\NSS\SFTP Client Profile\TestWinSCP.script
. 2020-02-19 11:41:08.272 Switch: /log=C:\NSS\SFTP Client Profile\WinSCP-2020-02-19.log
. 2020-02-19 11:41:08.272 Switch: /ini=nul
. 2020-02-19 11:41:08.272 Switch: /loglevel=2
. 2020-02-19 11:41:08.272 Switch: /command
. 2020-02-19 11:41:08.272 Parameter: option batch continue
. 2020-02-19 11:41:08.272 Parameter: option confirm on
. 2020-02-19 11:41:08.272 Parameter: open
. 2020-02-19 11:41:08.272 Switch: /filezilla
. 2020-02-19 11:41:08.272 Parameter: TestEnv
. 2020-02-19 11:41:08.272 Switch: /hostkey=ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
. 2020-02-19 11:41:08.272 Time zone: Current: GMT+10 (E. Australia Standard Time), No DST
. 2020-02-19 11:41:08.272 Login time: Wednesday, 19 February 2020 11:41:08 AM
. 2020-02-19 11:41:08.272 --------------------------------------------------------------------------
. 2020-02-19 11:41:08.272 Script: Retrospectively logging previous script records:
< 2020-02-19 11:41:08.272 Script: Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
< 2020-02-19 11:41:08.272 Script: In scripting you should not rely on saved sites, use this command instead:
< 2020-02-19 11:41:08.272 Script: open sftp://user@site.local/ -rawsettings ProxyPort=0
. 2020-02-19 11:41:08.272 --------------------------------------------------------------------------
. 2020-02-19 11:41:08.272 Session name: TestEnv (Ad-Hoc site)
. 2020-02-19 11:41:08.272 Host name: site.local (Port: 22)
. 2020-02-19 11:41:08.272 User name: user (Password: No, Key file: No, Passphrase: No)
. 2020-02-19 11:41:08.272 Tunnel: No
. 2020-02-19 11:41:08.272 Transfer Protocol: SFTP (SCP)
. 2020-02-19 11:41:08.272 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2020-02-19 11:41:08.272 Disable Nagle: No
. 2020-02-19 11:41:08.272 Proxy: None
. 2020-02-19 11:41:08.272 Send buffer: 262144
. 2020-02-19 11:41:08.272 SSH protocol version: 2; Compression: No
. 2020-02-19 11:41:08.272 Bypass authentication: No
. 2020-02-19 11:41:08.272 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: Yes
. 2020-02-19 11:41:08.272 GSSAPI: Forwarding: No; Libs: gssapi32,sspi,custom; Custom:
. 2020-02-19 11:41:08.272 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2020-02-19 11:41:08.272 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2020-02-19 11:41:08.272 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2020-02-19 11:41:08.272 Simple channel: Yes
. 2020-02-19 11:41:08.272 Return code variable: Autodetect; Lookup user groups: Auto
. 2020-02-19 11:41:08.272 Shell: default
. 2020-02-19 11:41:08.272 EOL: LF, UTF: Auto
. 2020-02-19 11:41:08.272 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2020-02-19 11:41:08.272 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2020-02-19 11:41:08.272 SFTP Bugs: Auto,Auto
. 2020-02-19 11:41:08.272 SFTP Server: default
. 2020-02-19 11:41:08.272 Local directory: c:\localdir, Remote directory: /dir/sub, Update: Yes, Cache: Yes
. 2020-02-19 11:41:08.272 Cache directory changes: Yes, Permanent: Yes
. 2020-02-19 11:41:08.272 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2020-02-19 11:41:08.272 DST mode: Unix
. 2020-02-19 11:41:08.272 --------------------------------------------------------------------------
. 2020-02-19 11:41:08.272 Looking up host "site.local" for SSH connection
. 2020-02-19 11:41:08.319 Connecting to 192.168.0.1 port 22
. 2020-02-19 11:41:08.351 Selecting events 63 for socket 776
. 2020-02-19 11:41:08.351 Waiting for the server to continue with the initialization
. 2020-02-19 11:41:08.351 Looking for incoming data
. 2020-02-19 11:41:08.351 Looking for network events
. 2020-02-19 11:41:08.351 We claim version: SSH-2.0-WinSCP_release_5.17
. 2020-02-19 11:41:08.351 Detected network event
. 2020-02-19 11:41:08.351 Enumerating network events for socket 776
. 2020-02-19 11:41:08.351 Enumerated 18 network events making 18 cumulative events for socket 776
. 2020-02-19 11:41:08.351 Handling network write event on socket 776 with error 0
. 2020-02-19 11:41:08.351 Handling network connect event on socket 776 with error 0
. 2020-02-19 11:41:08.351 Looking for network events
. 2020-02-19 11:41:08.397 Detected network event
. 2020-02-19 11:41:08.397 Enumerating network events for socket 776
. 2020-02-19 11:41:08.397 Enumerated 1 network events making 1 cumulative events for socket 776
. 2020-02-19 11:41:08.397 Handling network read event on socket 776 with error 0
. 2020-02-19 11:41:08.397 Waiting for the server to continue with the initialization
. 2020-02-19 11:41:08.397 Looking for incoming data
. 2020-02-19 11:41:08.397 Looking for network events
. 2020-02-19 11:41:08.397 Remote version: SSH-2.0-SFTP Server
. 2020-02-19 11:41:08.397 Using SSH protocol version 2
. 2020-02-19 11:41:08.413 No GSSAPI security context available
. 2020-02-19 11:41:08.413 Detected network event
. 2020-02-19 11:41:08.413 Enumerating network events for socket 776
. 2020-02-19 11:41:08.413 Enumerated 1 network events making 1 cumulative events for socket 776
. 2020-02-19 11:41:08.413 Handling network read event on socket 776 with error 0
. 2020-02-19 11:41:08.413 Waiting for the server to continue with the initialization
. 2020-02-19 11:41:08.413 Looking for incoming data
. 2020-02-19 11:41:08.413 Looking for network events
. 2020-02-19 11:41:08.413 Doing ECDH key exchange with curve Curve25519 and hash SHA-256
. 2020-02-19 11:41:08.538 Detected network event
. 2020-02-19 11:41:08.538 Enumerating network events for socket 776
. 2020-02-19 11:41:08.538 Enumerated 1 network events making 1 cumulative events for socket 776
. 2020-02-19 11:41:08.538 Handling network read event on socket 776 with error 0
. 2020-02-19 11:41:08.538 Waiting for the server to continue with the initialization
. 2020-02-19 11:41:08.538 Looking for incoming data
. 2020-02-19 11:41:08.538 Looking for network events
. 2020-02-19 11:41:08.585 Host key fingerprint is:
. 2020-02-19 11:41:08.585 ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
. 2020-02-19 11:41:08.585 Verifying host key rsa2 xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx with fingerprints ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
. 2020-02-19 11:41:08.600 Attempt to close connection due to fatal exception:
* 2020-02-19 11:41:08.600 Host key fingerprint is ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=.
* 2020-02-19 11:41:08.600 (Exception) **Expected host key was not configured, use -hostkey switch.**
. 2020-02-19 11:41:08.600 Closing connection.
. 2020-02-19 11:41:08.600 Selecting events 0 for socket 776