file upload fails using comand prompt, but ok using GUI **Solved**

Advertisement

frostie
Joined:
Posts:
2
Location:
New Zealand

file upload fails using comand prompt, but ok using GUI **Solved**

I'm trying to upload a small file to an azure server. I can do tis without a problem using the GUI, but I need to be able to perform this using the command line.


Using the command line arguments generated by WinSCP for a successful transfer, this is the command I am using:-


winscp.exe /log="C:\temp\WinSCP.log" /ini=nul /command "open ftpes://username:password@192.168.1.1/" -certificate="xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx" "put c:\temp\curlman.txt /upload" "exit"

The log file is here:-
. 2018-11-29 15:19:57.194 --------------------------------------------------------------------------
. 2018-11-29 15:19:57.194 WinSCP Version 5.13.5 (Build 8967) (OS 6.1.7601 Service Pack 1 - Windows 7 Professional)
. 2018-11-29 15:19:57.194 Configuration: nul
. 2018-11-29 15:19:57.194 Log level: Normal
. 2018-11-29 15:19:57.194 Local account: NZFF-DT00\UserName
. 2018-11-29 15:19:57.194 Working directory: c:\Program Files (x86)\WinSCP
. 2018-11-29 15:19:57.194 Process ID: 20672
. 2018-11-29 15:19:57.195 Command-line: winscp.exe /log="C:\temp\WinSCP.log" /ini=nul /command "open ftpes://UserName:***@192.168.1.1/" -certificate="xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx" "put c:\temp\curlman.txt /upload"
. 2018-11-29 15:19:57.195 Time zone: Current: GMT+13, Standard: GMT+12 (New Zealand Standard Time), DST: GMT+13 (New Zealand Daylight Time), DST Start: 30/09/2018, DST End: 1/04/2018
. 2018-11-29 15:19:57.195 Login time: Thursday, 29 November 2018 3:19:57 p.m.
. 2018-11-29 15:19:57.195 --------------------------------------------------------------------------
. 2018-11-29 15:19:57.195 Script: Retrospectively logging previous script records:
< 2018-11-29 15:19:57.195 Script: Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
. 2018-11-29 15:19:57.195 --------------------------------------------------------------------------
. 2018-11-29 15:19:57.195 Session name: put c (Ad-Hoc site)
. 2018-11-29 15:19:57.195 Host name: put c (Port: -1)
. 2018-11-29 15:19:57.196 User name: (Password: No, Key file: No, Passphrase: No)
. 2018-11-29 15:19:57.196 Tunnel: No
. 2018-11-29 15:19:57.196 Transfer Protocol: SFTP (SCP)
. 2018-11-29 15:19:57.196 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2018-11-29 15:19:57.196 Disable Nagle: No
. 2018-11-29 15:19:57.196 Proxy: None
. 2018-11-29 15:19:57.196 Send buffer: 262144
. 2018-11-29 15:19:57.196 SSH protocol version: 2; Compression: No
. 2018-11-29 15:19:57.196 Bypass authentication: No
. 2018-11-29 15:19:57.196 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: Yes
. 2018-11-29 15:19:57.196 GSSAPI: Forwarding: No; Libs: gssapi32,sspi,custom; Custom:
. 2018-11-29 15:19:57.196 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2018-11-29 15:19:57.196 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2018-11-29 15:19:57.196 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2018-11-29 15:19:57.196 Simple channel: Yes
. 2018-11-29 15:19:57.196 Return code variable: Autodetect; Lookup user groups: Auto
. 2018-11-29 15:19:57.196 Shell: default
. 2018-11-29 15:19:57.196 EOL: LF, UTF: Auto
. 2018-11-29 15:19:57.196 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2018-11-29 15:19:57.196 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2018-11-29 15:19:57.196 SFTP Bugs: Auto,Auto
. 2018-11-29 15:19:57.196 SFTP Server: default
. 2018-11-29 15:19:57.196 Local directory: default, Remote directory: /upload, Update: Yes, Cache: Yes
. 2018-11-29 15:19:57.196 Cache directory changes: Yes, Permanent: Yes
. 2018-11-29 15:19:57.196 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2018-11-29 15:19:57.196 DST mode: Unix
. 2018-11-29 15:19:57.196 --------------------------------------------------------------------------
. 2018-11-29 15:19:57.197 Looking up host "put c" for SSH connection
. 2018-11-29 15:19:59.471 --------------------------------------------------------------------------
. 2018-11-29 15:19:59.471 WinSCP Version 5.13.5 (Build 8967) (OS 6.1.7601 Service Pack 1 - Windows 7 Professional)
. 2018-11-29 15:19:59.472 Configuration: nul
. 2018-11-29 15:19:59.472 Log level: Normal
. 2018-11-29 15:19:59.472 Local account: NZFF-DT00\UserName
. 2018-11-29 15:19:59.472 Working directory: c:\Program Files (x86)\WinSCP
. 2018-11-29 15:19:59.472 Process ID: 20672
. 2018-11-29 15:19:59.474 Command-line: winscp.exe /log="C:\temp\WinSCP.log" /ini=nul /command "open ftpes://UserName:***@192.168.1.1/" -certificate="xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx" "put c:\temp\curlman.txt /upload"
. 2018-11-29 15:19:59.474 Time zone: Current: GMT+13, Standard: GMT+12 (New Zealand Standard Time), DST: GMT+13 (New Zealand Daylight Time), DST Start: 30/09/2018, DST End: 1/04/2018
. 2018-11-29 15:19:59.474 Login time: Thursday, 29 November 2018 3:19:59 p.m.
. 2018-11-29 15:19:59.474 --------------------------------------------------------------------------
. 2018-11-29 15:19:59.474 Script: Retrospectively logging previous script records:
< 2018-11-29 15:19:59.474 Script: Searching for host...
< 2018-11-29 15:19:59.474 Script: Host "put c" does not exist.
. 2018-11-29 15:19:59.475 Script: Failed
> 2018-11-29 15:19:59.475 Script: open ftpes://UserName:***@192.168.1.1/
. 2018-11-29 15:19:59.475 --------------------------------------------------------------------------
. 2018-11-29 15:19:59.475 Session name: UserName@192.168.1.1 (Ad-Hoc site)
. 2018-11-29 15:19:59.475 Host name: 192.168.1.1 (Port: 21)
. 2018-11-29 15:19:59.475 User name: UserName (Password: Yes, Key file: No, Passphrase: No)
. 2018-11-29 15:19:59.475 Transfer Protocol: FTP
. 2018-11-29 15:19:59.475 Ping type: Dummy, Ping interval: 30 sec; Timeout: 15 sec
. 2018-11-29 15:19:59.475 Disable Nagle: No
. 2018-11-29 15:19:59.475 Proxy: None
. 2018-11-29 15:19:59.475 Send buffer: 262144
. 2018-11-29 15:19:59.475 UTF: Auto
. 2018-11-29 15:19:59.475 FTPS: Explicit TLS/SSL [Client certificate: No]
. 2018-11-29 15:19:59.475 FTP: Passive: Yes [Force IP: Auto]; MLSD: Auto [List all: Auto]; HOST: Auto
. 2018-11-29 15:19:59.475 Session reuse: Yes
. 2018-11-29 15:19:59.475 TLS/SSL versions: TLSv1.0-TLSv1.2
. 2018-11-29 15:19:59.475 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2018-11-29 15:19:59.475 Cache directory changes: Yes, Permanent: Yes
. 2018-11-29 15:19:59.475 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2018-11-29 15:19:59.475 Timezone offset: 0h 0m
. 2018-11-29 15:19:59.475 --------------------------------------------------------------------------
. 2018-11-29 15:19:59.493 Connecting to 192.168.1.1 ...
. 2018-11-29 15:19:59.497 Connected with 192.168.1.1, negotiating TLS connection...
< 2018-11-29 15:19:59.595 220 Microsoft FTP Service
> 2018-11-29 15:19:59.595 AUTH TLS
< 2018-11-29 15:19:59.645 234 AUTH command ok. Expecting TLS Negotiation.
. 2018-11-29 15:20:00.009 Verifying certificate for "" with fingerprint xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx and 20 failures
. 2018-11-29 15:20:00.009 Asking user:
. 2018-11-29 15:20:00.009 **The server's certificate is not known. You have no guarantee that the server is the computer you think it is.**
. 2018-11-29 15:20:00.009
. 2018-11-29 15:20:00.009 Server's certificate details follow:
. 2018-11-29 15:20:00.009
. 2018-11-29 15:20:00.009 Issuer:
. 2018-11-29 15:20:00.009 - Organization: DEV-mERPS-SA
. 2018-11-29 15:20:00.009
. 2018-11-29 15:20:00.009 Subject:
. 2018-11-29 15:20:00.009 - Organization: DEV-mERPS-SA

. 2018-11-29 15:20:00.009
. 2018-11-29 15:20:00.009 Valid: 27/11/2018 2:42:06 a.m. - 27/11/2019 12:00:00 a.m.
. 2018-11-29 15:20:00.009
. 2018-11-29 15:20:00.009 Fingerprint (SHA-1): xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx
. 2018-11-29 15:20:00.009
. 2018-11-29 15:20:00.009 Summary: Unable to get local issuer certificate. The error occurred at a depth of 1 in the certificate chain.
. 2018-11-29 15:20:00.010
. 2018-11-29 15:20:00.010 When connecting using an IP address, it is not possible to verify if the certificate was issued for the server. Use a hostname instead of the IP address.
. 2018-11-29 15:20:00.010
. 2018-11-29 15:20:00.010 If you trust this certificate, press Yes. To connect without storing certificate, press No. To abandon the connection press Cancel.
. 2018-11-29 15:20:00.010
. 2018-11-29 15:20:00.010 Continue connecting and store the certificate? ()


I tried this in a console enabling me to answer yes to the last question, and still no joy.

Would anyone be able to point out the error of my ways?

Many thanks

Last edited by frostie on 2018-12-02 21:08; edited 1 time in total

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
29,790
Location:
Prague, Czechia

Re: file upload fails using comand prompt, but ok using GUI

The syntax is wrong. I doubt WinSCP generated this. I assume you have put (and misplaced) the -certificate switch manually, haven't you?

It should be:
winscp.exe /log="C:\temp\WinSCP.log" /ini=nul /command "open ftpes://username:password@192.168.1.1/ -certificate=""xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx""" "put c:\temp\curlman.txt /upload" "exit"

Reply with quote

frostie
Joined:
Posts:
2
Location:
New Zealand

Thank you Martin for you help.

As well as missing the quotes that you pointed out, the 'put' was also wrong.

The command line that works is...

c:\Program Files (x86)\WinSCP>winscp.exe /log="C:\temp\WinSCP.log" /ini=nul /com
mand "open ftpes://PaulS:xxxxxxxxx21*@192.168.1.1/ -certificate=""xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx""" "cd upload" "put c:\temp\curlman.txt" "exit"

It's amazing what a weekend off, and a good nights sleep can do :-)

Thanks again for your input,

Frostie

Reply with quote

Advertisement

You can post new topics in this forum