I want to ssh from `user@local` to `user@remote` several times per day with an encrypted SSH key, a situation which `ssh-agent` handles with a good trade-off between security and usability.

I'd also like to not have to remember to run `ssh-add` before `ssh`'ing—I'd rather be asked for my password the first time I need it, and then have it automatically be remembered for, say, eight hours.

So: I think I want to use `ssh-add` roughly where I think `$SSH_ASKPASS` is used, except `ssh-add` doesn't feed `ssh` the password it wants, as far as I understand. Is my understanding correct? If so, the obvious solution seems to be writing a script which asks for a password, runs `ssh-add` and then echoes the password back to `ssh`. Does this sound like the right approach? Is there a better way? If not, do you have a pointer or two to get started on this script?

(I use ssh from linux console, xterm and emacs `*shell*` buffers; X-wise the solution doesn't need to do anything fancy.)