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: Problem with WinSCP cli syntax

You are missing quotes and actual commands to perform after the connection is opened:
WinSCP.com /command "open ftp://username:password@mydomain.com/" ... /log="C:\Users\Admin\winscp.log" /loglevel=0

For a start, it's easier to use a script file, instead of specifying everything on commandline.
https://winscp.net/eng/docs/guide_automation#commands
richardspeter39

success in winscp-gui.log and failure in winscp-cmd.log

Attached are winscp-gui.log and winscp-cmd.log showing log of successful connect using the GUI
and then a failed connection using the cmd line. In the GUI log I see "Accepted data connection". But in the cmd log I see a message re (Port: 22) as well as some error messages saying:
Failed to connect to 66.198.240.48: Network error: Connection refused
Knocking FTP port.
FTP port opened, will suggest using FTP protocol.
Script: Network error: Connection to "mi3-cl9-its2.a2hosting.com" refused.
The server rejected SFTP connection, but it listens for FTP connections.
Did you want to use FTP protocol instead of SFTP? Prefer using encryption.
richardspeter39

Re: Problem with WinSCP cli syntax

Thanks for good tips in link Martin. I saw more useful responses using
WinSCP.com /command open ftp://username:password@mydomain.com/ /log="C:\Users\Admin\winscp.log" /loglevel=0

WinSCP prompted for host name which I inputted, then I got this error output:
Searching for host...

Network error: Connection to "(hostname.com)" refused.
The server rejected SFTP connection, but it listens for FTP connections.
Did you want to use FTP protocol instead of SFTP? Prefer using encryption.

Bottom of winscp.log was also revealing, as so:
. 2025-01-13 13:32:19.357 Connecting to 00.000.000.00 port 22
. 2025-01-13 13:32:21.624 Failed to connect to 00.000.0000.00: Network error: Connection refused
. 2025-01-13 13:32:21.625 Knocking FTP port.
. 2025-01-13 13:32:21.673 FTP port opened, will suggest using FTP protocol.
< 2025-01-13 13:32:21.675 Script: Network error: Connection to "(myhostservername).com" refused.
< 2025-01-13 13:32:21.675 The server rejected SFTP connection, but it listens for FTP connections.
< 2025-01-13 13:32:21.675 Did you want to use FTP protocol instead of SFTP? Prefer using encryption.

Note: After seeing port 22 reported, I looked for a way to change it to 21 but could not find any way to change port # in WinSCP GUI!? Will look more. Also, I Do want to use FTP protocol instead of SFTP. So 2 settings need changing.
richardspeter39

Problem with WinSCP cli syntax

I have WinSCP v6.3.5 with a a login setup saved for logging into my domain server for purpose of seeing a list of files that I have on my server. Settings shown below:
FTP with No encryption, port 21, Username
I enter password when prompted and I then see the files on my server. Works fine.

So no problem using the WinSCP GUI but thus far I have been unable to successfully find a WinSCP cli syntax to do the same!?
This is one of the syntax formats I tried:
WinSCP.com /command "open ftp://username:password@mydomain.com/"

Output message below:
Connecting to mydomain.com ...

Access denied.
Authentication failed.

I really need a working syntax for this
and will be grateful if someone can help!
Will also make a donation if this gets resolved.