summaryrefslogtreecommitdiff
path: root/plugins/ssh-agent
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/ssh-agent')
-rw-r--r--plugins/ssh-agent/README.md4
-rw-r--r--plugins/ssh-agent/ssh-agent.plugin.zsh7
2 files changed, 9 insertions, 2 deletions
diff --git a/plugins/ssh-agent/README.md b/plugins/ssh-agent/README.md
index 00af42f01..0b96d9bb5 100644
--- a/plugins/ssh-agent/README.md
+++ b/plugins/ssh-agent/README.md
@@ -11,6 +11,8 @@ plugins=(... ssh-agent)
## Instructions
+**IMPORTANT: put these settings _before_ the line that sources oh-my-zsh**
+
To enable **agent forwarding support** add the following to your zshrc file:
```zsh
@@ -33,6 +35,6 @@ zstyle :omz:plugins:ssh-agent lifetime 4h
## Credits
-Based on code from Joseph M. Reagle: http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
+Based on code from Joseph M. Reagle: https://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
Agent-forwarding support based on ideas from Florent Thoumie and Jonas Pfenniger
diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh
index 20f97c6f1..fe4946c6d 100644
--- a/plugins/ssh-agent/ssh-agent.plugin.zsh
+++ b/plugins/ssh-agent/ssh-agent.plugin.zsh
@@ -30,7 +30,12 @@ if [[ $_agent_forwarding == "yes" && -n "$SSH_AUTH_SOCK" ]]; then
elif [[ -f "$_ssh_env_cache" ]]; then
# Source SSH settings, if applicable
. $_ssh_env_cache > /dev/null
- ps x | grep ssh-agent | grep -q $SSH_AGENT_PID || {
+ if [[ $USER == "root" ]]; then
+ FILTER="ax"
+ else
+ FILTER="x"
+ fi
+ ps $FILTER | grep ssh-agent | grep -q $SSH_AGENT_PID || {
_start_agent
}
else