Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Automation from Database

I was asking (also) for log from GUI.

Btw, I do not know how is WinSCP from Portable Apps modified. I cannot help you with that.
The original WinSCP does not have to be installed:
https://winscp.net/eng/docs/portable
No need to use modified 3rd party versions.
Bill_H

Automation from Database

Note: I am using WinSCP via Portable Apps. There is no need to install into Windows if I don't have to. Here is a log from a successful action using the URL/Code in the command...
C:\Windows\system32>winscp.com "ftpes://MyCo:***;x-name=FtpsMyCo@www.somebank.com/In/" /nointeractiveinput /script="D:\MyScript.txt" /log="D:\WinSCP.log"

Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
Connecting to www.somebank.com ...
TLS connection established. Waiting for welcome message...
Connected
Starting the session...
Session started.
Active session: [1] FtpsMyCo
/In
D:\Test.txt               |           53 B |    0.1 KB/s | binary | 100%

. 2025-01-13 10:14:43.980 --------------------------------------------------------------------------
. 2025-01-13 10:14:43.980 WinSCP Version 6.3.5 (Build 14991 2024-09-10) (OS 10.0.19044 – Windows 10 Enterprise)
. 2025-01-13 10:14:43.981 Configuration: D:\PortableApps\WinSCP\App\winscp\WinSCP.ini
. 2025-01-13 10:14:43.981 Log level: Normal
. 2025-01-13 10:14:43.981 Local account: ASIX1-10\MyAdmin
. 2025-01-13 10:14:43.981 Working directory: C:\Windows\system32
. 2025-01-13 10:14:43.981 Process ID: 4080
. 2025-01-13 10:14:43.991 Ancestor processes: WinSCP, cmd, explorer, ...
. 2025-01-13 10:14:43.992 Command-line: "D:\PortableApps\WinSCP\App\winscp\WinSCP.exe" /console=6.3.5 /consoleinstance=_16520_98 ftpes://MyCo:***@www.somebank.com "/nointeractiveinput" "/script=D:\MyScript.txt" "/log=D:\WinSCP.log"
. 2025-01-13 10:14:43.992 Time zone: Current: GMT-8, Standard: GMT-8 (Pacific Standard Time), DST: GMT-7 (Pacific Daylight Time), DST Start: 3/9/2025, DST End: 11/2/2025
. 2025-01-13 10:14:43.992 Login time: Monday, January 13, 2025 10:14:43 AM
. 2025-01-13 10:14:43.992 --------------------------------------------------------------------------
. 2025-01-13 10:14:43.992 Script: Retrospectively logging previous script records:
< 2025-01-13 10:14:43.992 Script: Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
. 2025-01-13 10:14:43.992 --------------------------------------------------------------------------
. 2025-01-13 10:14:43.992 Session name: FtpsMyCo (Ad-Hoc site)
. 2025-01-13 10:14:43.992 Host name: www.somebank.com (Port: 21)
. 2025-01-13 10:14:43.992 User name: MyCo (Password: Yes, Key file: No, Passphrase: No)
. 2025-01-13 10:14:43.992 Transfer Protocol: FTP
. 2025-01-13 10:14:43.992 Ping type: Dummy, Ping interval: 30 sec; Timeout: 15 sec
. 2025-01-13 10:14:43.992 Disable Nagle: No
. 2025-01-13 10:14:43.992 Proxy: None
. 2025-01-13 10:14:43.992 Send buffer: 262144
. 2025-01-13 10:14:43.992 UTF: Auto
. 2025-01-13 10:14:43.992 FTPS: Explicit TLS/SSL [Client certificate: No]
. 2025-01-13 10:14:43.992 FTP: Passive: Yes [Force IP: Auto]; MLSD: Auto [List all: Auto]; HOST: Auto
. 2025-01-13 10:14:43.992 Session reuse: Yes
. 2025-01-13 10:14:43.992 TLS/SSL versions: TLSv1.2-TLSv1.3
. 2025-01-13 10:14:43.992 Local directory: default, Remote directory: /In/, Update: Yes, Cache: Yes
. 2025-01-13 10:14:43.992 Cache directory changes: Yes, Permanent: Yes
. 2025-01-13 10:14:43.992 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2025-01-13 10:14:43.992 Timezone offset: 0h 0m
. 2025-01-13 10:14:43.992 --------------------------------------------------------------------------
< 2025-01-13 10:14:44.007 Script: Connecting to www.somebank.com ...
. 2025-01-13 10:14:44.007 Connecting to www.somebank.com ...
. 2025-01-13 10:14:44.123 Connected with www.somebank.com, negotiating TLS connection...
< 2025-01-13 10:14:44.228 220 Welcome to the SomeBank FTP Secure Server
> 2025-01-13 10:14:44.228 AUTH TLS
< 2025-01-13 10:14:44.336 234 Using authentication type TLS
. 2025-01-13 10:14:44.567 Verifying certificate for "" with fingerprint ********** and 20 failures
. 2025-01-13 10:14:44.567 Certificate common name "*.somebank.com" matches hostname
. 2025-01-13 10:14:44.568 Certificate for "" matches cached fingerprint and failures
. 2025-01-13 10:14:44.569 Using TLSv1.2, cipher TLSv1.2: ECDHE-RSA-AES256-GCM-SHA384, 2048 bit RSA, ECDHE-RSA-AES256-GCM-SHA384    TLSv1.2 Kx=ECDH     Au=RSA   Enc=AESGCM(256)            Mac=AEAD
< 2025-01-13 10:14:44.569 Script: TLS connection established. Waiting for welcome message...
. 2025-01-13 10:14:44.569 TLS connection established. Waiting for welcome message...
> 2025-01-13 10:14:44.569 USER MyCo
< 2025-01-13 10:14:44.674 331 Password required for MyCo
> 2025-01-13 10:14:44.675 PASS ********************
< 2025-01-13 10:14:44.789 230 Logged on
> 2025-01-13 10:14:44.790 SYST
. 2025-01-13 10:14:44.893 FileZilla server detected.
< 2025-01-13 10:14:44.893 215 UNIX emulated by FileZilla
> 2025-01-13 10:14:44.893 FEAT
< 2025-01-13 10:14:44.996 211-Features:
< 2025-01-13 10:14:44.996  MDTM
< 2025-01-13 10:14:44.996  REST STREAM
< 2025-01-13 10:14:44.996  SIZE
< 2025-01-13 10:14:44.996  MLST type*;size*;modify*;
< 2025-01-13 10:14:44.996  MLSD
< 2025-01-13 10:14:44.996  AUTH SSL
< 2025-01-13 10:14:44.996  AUTH TLS
< 2025-01-13 10:14:44.996  PROT
< 2025-01-13 10:14:44.996  PBSZ
< 2025-01-13 10:14:44.996  UTF8
< 2025-01-13 10:14:44.996  CLNT
< 2025-01-13 10:14:44.996  MFMT
< 2025-01-13 10:14:44.996  EPSV
< 2025-01-13 10:14:44.996  EPRT
< 2025-01-13 10:14:44.996 211 End
> 2025-01-13 10:14:44.996 CLNT WinSCP-release-6.3.5
< 2025-01-13 10:14:45.101 200 Don't care
> 2025-01-13 10:14:45.101 OPTS UTF8 ON
< 2025-01-13 10:14:45.206 202 UTF8 mode is always enabled. No need to send this command.
> 2025-01-13 10:14:45.207 PBSZ 0
< 2025-01-13 10:14:45.311 200 PBSZ=0
> 2025-01-13 10:14:45.311 PROT P
< 2025-01-13 10:14:45.417 200 Protection level set to P
< 2025-01-13 10:14:45.418 Script: Connected
. 2025-01-13 10:14:45.418 Connected
. 2025-01-13 10:14:45.419 --------------------------------------------------------------------------
. 2025-01-13 10:14:45.419 Using FTP protocol.
. 2025-01-13 10:14:45.420 Doing startup conversation with host.
< 2025-01-13 10:14:45.420 Script: Starting the session...
> 2025-01-13 10:14:45.422 PWD
< 2025-01-13 10:14:45.527 257 "/" is current directory.
. 2025-01-13 10:14:45.527 Changing directory to "/In/".
> 2025-01-13 10:14:45.527 CWD /In/
< 2025-01-13 10:14:45.635 250 CWD successful. "/In" is current directory.
. 2025-01-13 10:14:45.635 Getting current directory name.
> 2025-01-13 10:14:45.636 PWD
< 2025-01-13 10:14:45.739 257 "/In" is current directory.
. 2025-01-13 10:14:45.739 Startup conversation with host finished.
< 2025-01-13 10:14:45.740 Script: Session started.
< 2025-01-13 10:14:45.740 Script: Active session: [1] FtpsMyCo
> 2025-01-13 10:14:45.745 Script: pwd
< 2025-01-13 10:14:45.745 Script: /In
> 2025-01-13 10:14:45.747 Script: put "D:\Test.txt" "Test.txt"
. 2025-01-13 10:14:45.747 Copying 1 files/directories to remote directory "/In" - total size: 53
. 2025-01-13 10:14:45.747   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask: Test.txt
. 2025-01-13 10:14:45.748   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; EncryptNewFiles: Yes; ExcludeHiddenFiles: No; ExcludeEmptyDirectories: No; InclM: ; ResumeL: 0
. 2025-01-13 10:14:45.748   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2025-01-13 10:14:45.748 File: 'D:\Test.txt' [2025-01-13T18:08:52.002Z] [53]
. 2025-01-13 10:14:45.751 Copying "D:\Test.txt" to remote directory started.
. 2025-01-13 10:14:45.751 Binary transfer mode selected.
. 2025-01-13 10:14:45.751 Starting upload of D:\Test.txt
> 2025-01-13 10:14:45.751 TYPE I
< 2025-01-13 10:14:45.857 200 Type set to I
> 2025-01-13 10:14:45.858 PASV
< 2025-01-13 10:14:45.963 227 Entering Passive Mode (40,76,92,2,195,126)
> 2025-01-13 10:14:45.965 STOR Test.txt
. 2025-01-13 10:14:45.965 Connecting to nn.nn.nn.nn:50046 ...
< 2025-01-13 10:14:46.186 150 Opening data channel for file upload to server of "/In/Test.txt"
. 2025-01-13 10:14:46.294 Session ID reused
. 2025-01-13 10:14:46.294 Using TLSv1.2, cipher TLSv1.2: ECDHE-RSA-AES256-GCM-SHA384, 2048 bit RSA, ECDHE-RSA-AES256-GCM-SHA384    TLSv1.2 Kx=ECDH     Au=RSA   Enc=AESGCM(256)            Mac=AEAD
. 2025-01-13 10:14:46.294 TLS connection established
< 2025-01-13 10:14:46.424 226 Successfully transferred "/In/Test.txt"
> 2025-01-13 10:14:46.425 MFMT 20250113180852 Test.txt
< 2025-01-13 10:14:46.554 213 modify=20250113180852; /In/Test.txt
. 2025-01-13 10:14:46.554 Upload successful
. 2025-01-13 10:14:46.555 Transfer done: 'D:\Test.txt' => '/In/Test.txt' [53]
. 2025-01-13 10:14:46.556 Copying finished: Transferred: 53, Elapsed: 0:00:00, CPS: 65/s
> 2025-01-13 10:14:46.556 Script: exit
. 2025-01-13 10:14:46.557 Script: Exit code: 0
. 2025-01-13 10:14:46.562 Disconnected from server


Here's the log of the unsuccessful command...
C:\Windows\system32>winscp.com FtpsMyCo /nointeractiveinput /script="D:\MyScript.txt" /log="D:\WinSCP.log"

Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
Searching for host...
Host "FtpsVantage" does not exist.
No session.

. 2025-01-13 10:18:05.632 --------------------------------------------------------------------------
. 2025-01-13 10:18:05.632 WinSCP Version 6.3.5 (Build 14991 2024-09-10) (OS 10.0.19044 – Windows 10 Enterprise)
. 2025-01-13 10:18:05.633 Configuration: D:\PortableApps\WinSCP\App\winscp\WinSCP.ini
. 2025-01-13 10:18:05.633 Log level: Normal
. 2025-01-13 10:18:05.633 Local account: ASIX1-10\MyAdmin
. 2025-01-13 10:18:05.633 Working directory: C:\Windows\system32
. 2025-01-13 10:18:05.633 Process ID: 11624
. 2025-01-13 10:18:05.645 Ancestor processes: WinSCP, cmd, explorer, ...
. 2025-01-13 10:18:05.645 Command-line: "D:\PortableApps\WinSCP\App\winscp\WinSCP.exe" /console=6.3.5 /consoleinstance=_2808_976 "FtpsMyCo" "/nointeractiveinput" "/script=D:\MyScript.txt" "/log=D:\WinSCP.log"
. 2025-01-13 10:18:05.645 Time zone: Current: GMT-8, Standard: GMT-8 (Pacific Standard Time), DST: GMT-7 (Pacific Daylight Time), DST Start: 3/9/2025, DST End: 11/2/2025
. 2025-01-13 10:18:05.645 Login time: Monday, January 13, 2025 10:18:05 AM
. 2025-01-13 10:18:05.646 --------------------------------------------------------------------------
. 2025-01-13 10:18:05.646 Script: Retrospectively logging previous script records:
< 2025-01-13 10:18:05.646 Script: Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
. 2025-01-13 10:18:05.646 --------------------------------------------------------------------------
. 2025-01-13 10:18:05.646 Session name: FtpsMyCo (Ad-Hoc site)
. 2025-01-13 10:18:05.646 Host name: FtpsMyCo (Port: 22)
. 2025-01-13 10:18:05.646 User name:  (Password: No, Key file: No, Passphrase: No)
. 2025-01-13 10:18:05.646 Tunnel: No
. 2025-01-13 10:18:05.646 Transfer Protocol: SFTP (SCP)
. 2025-01-13 10:18:05.646 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2025-01-13 10:18:05.646 Disable Nagle: No
. 2025-01-13 10:18:05.646 Proxy: None
. 2025-01-13 10:18:05.646 Send buffer: 262144
. 2025-01-13 10:18:05.646 Compression: No
. 2025-01-13 10:18:05.646 Bypass authentication: No
. 2025-01-13 10:18:05.646 Try agent: Yes; Agent forwarding: No; KI: Yes; GSSAPI: Yes
. 2025-01-13 10:18:05.646 GSSAPI: KEX: No; Forwarding: No; Libs: gssapi32,sspi,custom; Custom:
. 2025-01-13 10:18:05.646 Ciphers: aes,chacha20,aesgcm,3des,WARN,des,blowfish,arcfour; Ssh2DES: No
. 2025-01-13 10:18:05.646 KEX: ntru-curve25519,ecdh,dh-gex-sha1,dh-group18-sha512,dh-group17-sha512,dh-group16-sha512,dh-group15-sha512,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2025-01-13 10:18:05.646 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2025-01-13 10:18:05.646 Simple channel: Yes
. 2025-01-13 10:18:05.646 Return code variable: Autodetect; Lookup user groups: Auto
. 2025-01-13 10:18:05.646 Shell: default
. 2025-01-13 10:18:05.646 EOL: LF, UTF: Auto
. 2025-01-13 10:18:05.646 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2025-01-13 10:18:05.646 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2025-01-13 10:18:05.646 SFTP Bugs: Auto,Auto
. 2025-01-13 10:18:05.646 SFTP Server: default
. 2025-01-13 10:18:05.646 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2025-01-13 10:18:05.646 Cache directory changes: Yes, Permanent: Yes
. 2025-01-13 10:18:05.646 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2025-01-13 10:18:05.646 DST mode: Unix
. 2025-01-13 10:18:05.646 --------------------------------------------------------------------------
< 2025-01-13 10:18:05.646 Script: Searching for host...
. 2025-01-13 10:18:05.647 Looking up host "FtpsMyCo" for SSH connection
< 2025-01-13 10:18:07.909 Script: Host "FtpsMyCo" does not exist.

I hope this helps. Thanks,
Bill_H

Automation from Database

I've posted two replies but they don't show up. Hmm. I still cannot "open" a site. I have no idea where the site "file" resides. The GUI shows the site but the data for this site seems to be in one of the "winscp.ini" files (in "..\data\settings" or "..\app\winscp"). I've read a lot of documentation and I can't seem to find where a site "configuration" is stored nor where I can load it from; if I don't know where it goes I can't say where it loads from. The GUI abstracts this information so I haven't a clue where it is actually stored so I can retrieve it (if retrieval is a designed feature).

I've run logs but I posted those too and that post doesn't seem to show up either. The logs seem to indicate I'm running SFTP not FTPS and, again, I don't know what that means either. I executed "winscp.com" but the log indicates I used "winscp.exe".

I'm trying to do the simplest task; use WinSCP to connect one server to another to upload several defined files and get several other files. I can only do this using the session URL/Code but that execution returns to me a comment that using a session URL/Code is deprecated. Using an "open <site>" within a script doesn't work. I suspect this is because WinSCP.com cannot find the "site" and I have no clue where it would be, because I am not given an option to, for instance, save it as something on my file system.

Thanks,
martin

Re: Automation from Database

There's no difference between SFTP and FTPS (there's no such thing as SFTPS) in this respect. If saving site works for SFTP, it must work for FTPS too. And vice versa. Your script is most probably loading its configuration from other place than your GUI. Enable logging in both and check the log headers for configuration source. Or post the logs here, if you need help.

I'm not sure what "caveat" is there about your other approach.
Bill_H

Automation from Database

We have a client who uses a new bank that uses FTPS instead of SFTP. Our scripting to upload and download files to/from the bank has to be changed for this single client/bank. Currently, all of our SFTP scripts executes the command-line command to make the connection and run a script. The connection uses a site profile with basic info to connect; we connect once with this site profile via a GUI and accept the key then save the profile as a separate file and store it where the command-line command can access it during execution. The script is built from the database and saved in a specific location that is referenced in the command-line, so it all runs together.

When I follow the same process using WinSCP I use WinSCP.com and reference the site as follows:
winscp FtpsMyCo /nointeractiveinput /script="E:\MyScript.txt"

This fails with the following:
Searching for host...

Host "FtpsMyCo" does not exist.

I notice this site is stored in ...\data\settings\winscp.ini in a [Sessions\FtpsMyCo] section of the .ini file. So this fails.

Next I copied the "Generate session URL/code" results and replaced this, quoted, in the winscp.com command instead of the site name and it works just fine but with a caveat...
E:\UDAccounts\Vantage>winscp.com "ftpes://MyCo:xxxxxx;x-name=FtpsMyCo@ftps.somebank.com/" /nointeractiveinput /script="E:\MyScript.txt"

Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
Connecting to ftps.somebank.com ...
TLS connection established. Waiting for welcome message...
Connected
Starting the session...
Session started.
Active session: [1] FtpsMyCo
/In
E:\MyScript.txt |        1083
 KB | 1100.0 KB/s | binary | 100%

Trying to use the site name doesn't work so how am I to use the site information to make the connection, since the site contains all info needed to connect? Thanks,