Topic "Automated login via Explicit TLS over FTP fails, Access denied"

Author Message
plutowalker

Guest


Hello,

I have a special problem with the command line tool of WinSCP if I want to do an automated login in a batch script via Explicit TLS over FTP like this.

winscp.com /command "option batch continue" "option confirm off" "open ftp://user:password@ftp.server.com:21 -explicit" ...

It doesn't work -> "Access denied", my assumption: the problem is the password in the line

- when i login with these login data via WinSCP GUI, it works

- when i use the command line without password, I must manually enter the password but ist works too, the login is successful

winscp.com /command "option batch continue" "option confirm off" "open ftp://user@ftp.server.com:21 -explicit"


- only when I want do an automated login with user and password in the command line, it doesn't work -> Access denied.

I suppose that the password doesn't commit like expected but I don't find a solution for my problem. Or do I make something wrong.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
You may need to URL-encode special characters:
https://winscp.net/eng/docs/session_url#special

You can use Generate URL command to have WinSCP encode it for you:
https://winscp.net/eng/docs/ui_generateurl

Or enable a password logging with /loglevel=* to see the actual password that WinSCP tries to use.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
See also https://winscp.net/eng/docs/faq_script_vs_gui
Guest




@prikryl: Great Thanks for your tip, it works now !

The problem are special characters in the password and the mandatory quotes of winscp.com /command "open ...", when I use it in one command line. It's mandatory that all FTP-commands of /command are between quotes and then the password doesn't commit correct.
I also replace the special characters in UTF8-code, but it doesn't work.

Here an example with winscp.com /command "open...":
--------------
"pass++word" -> winscp: "pass word"

or with UTF8-code-replace:
-------------------------
"pass%2B%2Bword-> winscp: "passBBword"

I don't find a solution with one command line in a batchfile like winscp.com /command "open...".

The only working solution for me was, that I put the FTP-commands in a separate script file and start the script file with "winscp.com /script=...". In this case the quotes aren't mandatory so I can disclaim the quotes in the script file and the password with special characters in the URL is recognized and commited correctly. You can see it also in the logfile.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
Anonymous wrote:
or with UTF8-code-replace:
-------------------------
"pass%2B%2Bword-> winscp: "passBBword"

This is the correct syntax for WinSCP command-line.
But not for a batch file (where you probably use the command).
The command interpreter (cmd.exe) replaces the %2 with the second argument of the batch file. So WinSCP gets passBBword if the second argument is not specified.
You have to escape the % by doubling it: pass%%2B%%2Bword.

The next version of WinSCP will be able to generate a batch file too (not only the URL), caring for this.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License