Topic "Script/Command line using Public Key authentication"

Author Message
[View user's profile]

Joined: 2007-05-13
Posts: 2

I would like to automate a remote synchronization from my backup server to my production server. Currently I have a saved session called "test" with working private/public key. Now I need to script a login using that session.

winscp3.exe /console
open test <--- need to be able to pass the ssh_key phrase here

Any tips would be appreciated.

Thank you


Valgarv wrote:

winscp3.exe /console
open test <--- need to be able to pass the ssh_key phrase here

There are two ways around the issue. The less secure choice is to remove the passphrase from the key. You are depending entirely on file-system permissions to keep the key secret then. Security-wise, it's no different that having the passphrase in a plain-text file. In either case, if someone gets access to the file, they have what amounts to your password.

The more secure approach is to use an agent (such as Pageant) to store the key in memory. The agent provides the key to WinSCP and/or PuTTY whenever authentication to a remote server is required.

I put a shortcut to Pageant in my startup folder so I'm prompted for the passphrase when I log in. My decrypted key is stored in memory until I log out and/or reboot. When the machine is off my key is still passphrase-protected, encrypted, and unreadable without reading my mind.

You can post new topics in this forum


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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License