Can I make ssh-agent wait until I use ssh to prompt for a password?

3

1

I have ssh-agent set up to automatically start and prompt when I open a terminal window, as is explained here. It gets somewhat annoying though since many times when I open a shell I don't plan on using ssh for anything. Is there a way to delay this password prompt until I try to use ssh?

In other words, the first time I use SSH I want a password prompt, all subsequent times I don't want one, and I don't want one if I'm not about to use SSH.

Clueless

Posted 2010-10-20T04:16:40.243

Reputation: 339

Answers

1

You'd have to write (or find) an agent proxy that would detect absence of the key in the agent and prompt for the passphrase when the key is requested, then load the key into the real agent.

Ignacio Vazquez-Abrams

Posted 2010-10-20T04:16:40.243

Reputation: 100 516

Refer to https://stackoverflow.com/a/24347344/4573065 + its comments for a good way to acieve this.

– ST-DDT – 2018-07-10T09:23:55.450

Sounds like a weekend project to me. – Clueless – 2010-10-20T08:18:17.573

2So, have you implemented it? – Vi. – 2011-08-20T18:54:58.867