Unable to provide password for private with WinSCP command line in Windows 2008 R2

5,972

The issue was that it was expecting a password phrase for a private key which WinSCP doesn't support providing programmatically as per the FAQ at https://winscp.net/eng/docs/faq_passphrase.

The way around it was to use the Pageant agent that is provided with the WinSCP installation or as a standalone executable at https://winscp.net/eng/download.php. Hopefully this helps someone else in the future.

Share:
5,972

Related videos on Youtube

PeanutsMonkey
Author by

PeanutsMonkey

Updated on September 18, 2022

Comments

  • PeanutsMonkey
    PeanutsMonkey over 1 year

    I am following the example at https://winscp.net/eng/docs/scripting to automate the transfer of files from my PC to an SFTP server. However each time I try to provide a password for private key, it fails to authenticate.

    I am able to use the same password when using the WinSCP graphical user interface and when I explicitly type the password in the command line however not when I automate.

    My code looks as follows

    open sftp://user:password%[email protected]
    

    I have followed the suggestion at https://winscp.net/eng/docs/session_url to encode special characters hence the %21 which symbolizes an exclamation mark. Interestingly enough the example on the page does not encode the exclamation mark e.g. 4pRte!ai%[email protected]

    I have also tried using password! and that doesn't work either.