ivicaa ivicaa - 4 days ago 4
Bash Question

WinSCP.com: how to skip the password prompt in the script if key authentication fails

I'm using WinSCP CLI to script a file transfer. I'm using the private/public key authentication only, the password is not set.

WinSCP.com /nointeractiveinput
/command "open sftp://USER@HOST/ -privatekey=PATH_TO_KEY ..."
...


I am testing error situations now. One error situation is that key authentication can fail. In this case the password prompt is presented and the script blocks. Calling
/nointeractiveinput ...
doesn't help, since it will not skip the password prompt.

Question: What can I do to skip the password promt and let the script fail if key authentication doesn'?

Answer

The /nointeractiveinput switch should actually help in this scenario.

Make sure you are using the latest version of WinSCP.

Comments