Response from https://askubuntu.com/questions/362280/enter-ssh-passphrase-once
Update: seems to be a bug from 13.10:
https://bugs.launchpad.net/ubuntu/+source/libpam-ssh/+bug/1247169
Anyway running the following commands the problem was fixed for me:
How to fix
I fixed this by entering the following commands:
$ ssh-agent bash
This creates a new bash process that allows you to add private keys.
When adding a new private key you will be prompted for the passphrase
once and only once.
And then:
$ ssh-add /home/username/.ssh/id_rsa Enter passphrase for /home/username/.ssh/id_rsa: Identity added:
/home/username/.ssh/id_rsa (/home/username/.ssh/id_rsa)
...where username is your username. You can do the same using $USER
variable:
$ ssh-add /home/$USER/.ssh/id_rsa
And the problem was fixed.
Duplicate:
Git enter long passphrase for every push
Git keeps asking me for my ssh key passphrase
EDIT
The only way I know is to use something using expect
#!/usr/bin/expect -f
set timeout -1
spawn ssh -o PubkeyAuthentication=no host.example.com
expect -exact "Password: "
send -- "secret\r"
expect {\$\s*} { interact }
and probably deal with ssh-config's ProxyCommand or use python version which is more complex and allow keeping credentials in config file.
And as a note - the only acceptable solution (secure and convenient) is ssh keys based auth.