assistance with ftp to cloud server

Advertisement

crperpall
Joined:
Posts:
1

assistance with ftp to cloud server

I'm attempting to connect to a cloud server using traditional ftp protocol and I want to grab a file and bring it to a local directory. The cloud server is hosted by a vendor and they control the permissions on the directories. We have a landing point that we hit when using a traditional ftp client and I want to get to the /lsapps/email/out directory. We are also using a secure vpn to their domain which allows us to use regular ftp protocol. It seems in the logs that the script is looking for sftp, even though in my connection string, I specify ftp://.

I have the following script with user/pass hashed out for security:
"C:\Program Files (x86)\WinSCP\WinSCP.exe" ^
"/log=D:\Lawson_em_files\winscp.log /command /ini=nul /loglevel=2*"  ^
"open ftp://**********@*********.com:***********@10.xx.xx.xx:21" ^
"cd /lsapps/email/out" ^
"get *.EM" ^
"put *.EM D:\Lawson_em_files\" ^
"exit"

Here are the logs:
2020-07-30 08:48:58.876 WinSCP Version 5.15.3 (Build 9730) (OS 6.3.9600 - Windows Server 2012 R2 Standard)
. 2020-07-30 08:48:58.876 Configuration: nul
. 2020-07-30 08:48:58.876 Log level: Debug 2, Logging passwords
. 2020-07-30 08:48:58.876 Local account: XXXX\XXXXXXXX
. 2020-07-30 08:48:58.876 Working directory: C:\Windows\system32
. 2020-07-30 08:48:58.876 Process ID: 7436
. 2020-07-30 08:48:58.876 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe"  /log=D:\Lawson_em_files\winscp.log /command /ini=nul /loglevel=2*  
. 2020-07-30 08:48:58.876 "open ftp://**********@*********.com:***********@10.xx.xx.xx:21" "cd /lsapps/email/out" ^
. 2020-07-30 08:48:58.876 Switch:    /log=D:\Lawson_em_files\winscp.log
. 2020-07-30 08:48:58.876 Switch:    /command
. 2020-07-30 08:48:58.876 Switch:    /ini=nul
. 2020-07-30 08:48:58.876 Switch:    /loglevel=2*
. 2020-07-30 08:48:58.876 Parameter: 
. 2020-07-30 08:48:58.876 open ftp://**********@*********.com:***********@10.xx.xx.xx:21
. 2020-07-30 08:48:58.876 Parameter: cd /lsapps/email/out
. 2020-07-30 08:48:58.876 Parameter: ^
. 2020-07-30 08:48:58.876 Time zone: Current: GMT-4, Standard: GMT-5 (Eastern Standard Time), DST: GMT-4 (Eastern Daylight Time), DST Start: 3/8/2020, DST End: 11/1/2020
. 2020-07-30 08:48:58.876 Login time: Thursday, July 30, 2020 8:48:58 AM
. 2020-07-30 08:48:58.876 --------------------------------------------------------------------------
. 2020-07-30 08:48:58.876 Script: Retrospectively logging previous script records:
< 2020-07-30 08:48:58.876 Script: Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
. 2020-07-30 08:48:58.876 --------------------------------------------------------------------------
. 2020-07-30 08:48:58.876 Session name: 
. 2020-07-30 08:48:58.876 open ftp (Ad-Hoc site)
. 2020-07-30 08:48:58.876 Host name: 
. 2020-07-30 08:48:58.876 open ftp (Port: 22)
. 2020-07-30 08:48:58.876 User name:  (Password: No, Key file: No, Passphrase: No)
. 2020-07-30 08:48:58.876 Tunnel: No
. 2020-07-30 08:48:58.876 Transfer Protocol: SFTP (SCP)
. 2020-07-30 08:48:58.876 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2020-07-30 08:48:58.876 Disable Nagle: No
. 2020-07-30 08:48:58.876 Proxy: None
. 2020-07-30 08:48:58.876 Send buffer: 262144
. 2020-07-30 08:48:58.876 SSH protocol version: 2; Compression: No
. 2020-07-30 08:48:58.876 Bypass authentication: No
. 2020-07-30 08:48:58.876 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: Yes
. 2020-07-30 08:48:58.876 GSSAPI: Forwarding: No; Libs: gssapi32,sspi,custom; Custom: 
. 2020-07-30 08:48:58.876 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2020-07-30 08:48:58.876 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2020-07-30 08:48:58.876 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2020-07-30 08:48:58.876 Simple channel: Yes
. 2020-07-30 08:48:58.876 Return code variable: Autodetect; Lookup user groups: Auto
. 2020-07-30 08:48:58.877 Shell: default
. 2020-07-30 08:48:58.877 EOL: LF, UTF: Auto
. 2020-07-30 08:48:58.877 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2020-07-30 08:48:58.877 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2020-07-30 08:48:58.877 SFTP Bugs: Auto,Auto
. 2020-07-30 08:48:58.877 SFTP Server: default
. 2020-07-30 08:48:58.877 Local directory: default, Remote directory: //**********@*********.com:***********@10.xx.xx.xx:21, Update: Yes, Cache: Yes
. 2020-07-30 08:48:58.877 Cache directory changes: Yes, Permanent: Yes
. 2020-07-30 08:48:58.877 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2020-07-30 08:48:58.877 DST mode: Unix
. 2020-07-30 08:48:58.877 --------------------------------------------------------------------------
. 2020-07-30 08:48:58.877 Looking up host "
. 2020-07-30 08:48:58.877 open ftp" for SSH connection

I can't tell if the connection string is actually connecting? If it is, it's definitely not doing anything further with changing directories or moving files. I'm not sure my syntax is correct on that either. Yesterday I was able to validate the connection string was working and I would get "230 connected" message. I still had the problem with the script not doing anything further after establishing the connection. I've validated that the manual entry of the username and password in winscp client works. Again, I'm not using sftp connection since we have the vpn therefore I don't have a key or footprint.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
33,846
Location:
Prague, Czechia

Re: assistance with ftp to cloud server

You have the command-line all wrong.
1) Wrong indentation 2) Wrong order of parameters 3) Wrong quotes

It should be like this:
"C:\Program Files (x86)\WinSCP\WinSCP.exe" ^
  /log=D:\Lawson_em_files\winscp.log /ini=nul /loglevel=2* /command ^
  "open ftp://**********@*********.com:***********@10.xx.xx.xx:21" ^
  "cd /lsapps/email/out" ^
  "get *.EM" ^
  "put *.EM D:\Lawson_em_files\" ^
  "exit"
Also the put command seems wrong, but I do not know what you wanted to achieve, so I cannot advise there.

Some references:
- https://winscp.net/eng/docs/commandline
- https://winscp.net/eng/docs/guide_automation
- https://winscp.net/eng/docs/faq_batch_file

Reply with quote

Advertisement

You can post new topics in this forum