Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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: login fail, but runs multiple downloads

I cannot imagine what might go wrong with the simple batch file from your original post.
Is it really that simple?
Did you try to preserve/log contents of the batch file just before you run winscp.com, to double check that the contents is as you expected?
If the commands are fixed this way, why do you even generate the script?
If you wanted to avoid having yet another script file (beside the batch file), you can instead specify the commands on WinSCP command-line.
Example here: https://winscp.net/eng/docs/faq_batch_file#newline_escaping
This way, WinSCP will log the commandline including the commands, what will ease debugging.
fuzzy50

Re: login fail, but runs multiple downloads

I modified the log. The job runs at 07:20. My second attempt to get the file was at 08:57.

Actually, I see the first attempt never tried a get on the file. Something happened during the script creation:
< 2022-01-24 07:20:03.090 Script: transfer        ascii     
> 2022-01-24 07:20:03.090 Script: close

Maybe virus scanner? I don't know, we have painfully slow VM's sometimes. I guess the solution is to create the script once and not create it on the fly.
martin

Re: login fail, but runs multiple downloads

There are over 50 sessions in that log. What should I look for? Can you post logs of two sessions only?
1) Log of session where there were three transfers, although there should have been one only.
2) Log of subsequent rerun that went as expected.
fuzzy50

Re: login fail, but runs multiple downloads

I have attached the log.
martin

Re: login fail, but runs multiple downloads

Please attach complete WinSCP log.
fuzzy50

login fail, but runs multiple downloads

I run
echo open sftp://myuser:mypass@redhat7server.com>files\get.scr
echo cd /opt/csv>>files\get.scr
echo option transfer ascii>>files\get.scr
echo get my.csv>>files\get.scr
echo close>>files\get.scr
echo exit>>files\get.scr

Then I run:
WinSCP.com /script="get.scr"  /log="winscp_debug.log" /loglevel=0 > sendfile.log  2>&1

On Redhat side I get:
Jan 24 07:20:02 redhat7server sshd[24131]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=myhost  user=myuser

Jan 24 07:20:02 redhat7server sshd[24131]: Accepted password for myuser from myip port 59506 ssh2
Jan 24 07:20:02 redhat7server sshd[24131]: pam_unix(sshd:session): session opened for user ldapcsv by (uid=0)
Jan 24 07:20:02 redhat7server sshd[24131]: pam_unix(sshd:session): session closed for user ldapcsv

In the debug log, it appears to download the file multiple times. Yet, the file is not on disk. I see multiple
Line 7554: . 2022-01-19 07:20:02.208 Copying "/opt/csv/my.csv" to local directory started.

Line 7723: . 2022-01-20 07:20:02.214 Copying "/opt/csv/my.csv" to local directory started.
Line 7892: . 2022-01-21 07:20:02.233 Copying "/opt/csv/my.csv" to local directory started.

I reran the job and it worked and it appears to only login once this time:
Jan 24 08:57:42 myredhat7 sshd[7330]: Accepted password for myuser  from myip port 59710 ssh2

Jan 24 08:57:42 myredhat7 sshd[7330]: pam_unix(sshd:session): session opened for user myuser by (uid=0)
Jan 24 08:57:43 myredhat7 sshd[7330]: pam_unix(sshd:session): session closed for user myuser