Automated login via Explicit TLS over FTP fails, Access denied

Advertisement

plutowalker
Guest

Automated login via Explicit TLS over FTP fails, Access denied

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.

Reply with quote

Advertisement

Guest

Re: Automated login via Explicit TLS over FTP fails, Access denied

@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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Automated login via Explicit TLS over FTP fails, Access denied

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.

Reply with quote

Advertisement

You can post new topics in this forum