]> arthur.barton.de Git - ax-zsh.git/commitdiff
ssh: Look for SSH "auth socket" in common locations
authorAlexander Barton <alex@barton.de>
Thu, 5 Sep 2019 14:57:24 +0000 (16:57 +0200)
committerAlexander Barton <alex@barton.de>
Thu, 5 Sep 2019 14:57:24 +0000 (16:57 +0200)
default_plugins/ssh/ssh.zshrc

index 830390fa14cf630e837ebbde2954a452a5f79ec6..1afc7f469116c1996f816127ca176add79dff17a 100644 (file)
@@ -27,6 +27,19 @@ ax_hostname_prompt_functions=($ax_hostname_prompt_functions _ax_ssh_prompt)
 # file becomes invalid when the session has been disconnected.
 [[ ! -r "$SSH_AUTH_SOCK" ]] && unset SSH_AUTH_SOCK
 
+# Look for common socket locations ...
+if [[ -z "$SSH_AUTH_SOCK" ]]; then
+       for s (
+               /mnt/c/Local/$LOGNAME/ssh-agent.sock
+       ); do
+               if [[ -r "$s" ]]; then
+                       export SSH_AUTH_SOCK=$s
+                       break
+               fi
+       done
+       unset s
+fi
+
 # Save SSH environment when available:
 if [[ -n "$SSH_AUTH_SOCK" && -d "$XDG_RUNTIME_DIR" ]]; then
        # Save current environment when no state exists or is invalid.