ssh-add: how to automatically insert private key passphrase?

3

2

I'm using ssh-add to add a private key in order to call lftp after that. It happens that my private key contains a passphrase and I need to automatically fill it when required. I'm able to overcome this issue by simply removing the passphrase, but I believe I'm removing an important security step of the protocolo on doing this.

The code I'm using:

ssh-agent bash -c 'ssh-add /cygdrive/C/$1/id_rsa & lftp -u myUser, -e \"mirror --verbose / /cygdrive/C$1/Output; bye\" sftp://domain.com -p 22'

The passphrase is prompted after ssh-add and before lftp. Is there any way of specifying the passphrase, by inputing it statically in this piece of code or by referencing an external file (for example a .txt - I'm using Windows) or storing it in some special file/store?

Thank you.

pacojones

Posted 2014-12-13T09:07:47.587

Reputation: 51

Take a look at this question http://stackoverflow.com/questions/3466626/add-private-key-permanently-with-ssh-add-on-ubuntu.

– Pascal Wittmann – 2016-08-12T11:02:05.657

No answers