When invoking a shell as root using ```sudo -s```, the ssh-agent plugin
starts a new agent although it already exists.
The problem boils down to a check if ssh-agent is running using
```ps x```. If that is extended to ```ps ax``` for root, then the
existing ssh-agent will still work.
On systems where the shell cannot be changed because of a strict
security policy, ssh-agent will use the syntax of whatever the
default $SHELL is.
For instance, if the default shell is tcsh, ssh-agent will use the
c-shell style (setenv).
This change forces ssh-agent to use bourne-style syntax since that
has to be later interpreted by zsh. Consequently, the environment
file will contain `export' statements from now on (instead of
`setenv').
On an OS X laptop, the variable `$HOST` changes a lot depending
on what wifi network you're connected to. This causes a lot
of `~/.ssh/environment-$HOST` files to be created and
causes multiple ssh-agents to created.
Instead, use `scutil --get ComputerName` to get something
more stable.
By default, ssh-agent stores identities forever. It has an option to
set a maximum lifetime for identites (useful to expire passphrase protected
keys). Allow this option to be set using:
zstyle :omz:plugins:ssh-agent lifetime <time>