launch ssh-add with a passphrase as parameter

Damien Miller djm at mindrot.org
Wed Oct 20 07:47:29 EST 2004


Patrice.Gonthier at alcatel.fr wrote:
> Hello,
> 
> I have the following problem.
> I have an application which is running and which has already request a
> passphrase to the user.
> 
> This application needs to launch ssh agent and ssh add, but I do not want
> to be prompt again for the passphrase.
> My private key is of course encrypted with the passphrase.
> 
> How can I do ?

Abuse SSH_ASKPASS:

cat > ~/.ssh/key-passphrase << EOF
your passphrase goes here
EOF
chmod 0600 .ssh/key-passphrase

cat > ~/.ssh/add-passphrase.sh << EOF
#!/bin/sh
cat ~/.ssh/key-passphrase << EOF
EOF
chmod 0700 ~/.ssh/add-passphrase.sh

DISPLAY=junk SSH_ASKPASS=~/.ssh/add-passphrase.sh ssh-add </dev/null




More information about the openssh-unix-dev mailing list