I don't know why it wouldn't work.

Is the global environment still correct (tmux showenv -g SSH_AUTH_SOCK)?

What about the session (tmux showenv SSH_AUTH_SOCK)?

What does echo $SSH_AUTH_SOCK show in a new pane?

tmux logs?

On Tue, 3 Feb 2026 at 10:27, 'Tobias Damisch' via tmux-users <
[email protected]> wrote:

> Problem:
>
> Reattaching to a tmux session after a SSH session with -A agent
> forwarding broke and reconnected makes the agent not work from inside tmux.
>
> I used to make persistent auth sock forwarding work with this trick
> under tmux next-3.4:
>
>
> MAKE SSH AUTH_SOCK AGENT FORWARDING WORK IN TMUX
> -----------------------------------------------------
> put:
> # first, unset update-environment[SSH_AUTH_SOCK] (idx 3), to prevent
> # the client overriding the global value
> set-option -g -u update-environment[3]
> # And set the global value to our static symlink'd path:
> set-environment -g SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock
>
> ..into .tmux.conf
>
> vim ~/.ssh/rc
> -----------------------------------------------------------------------
> #!/bin/sh
>
> # On SSH connection, create stable auth socket path for Tmux usage
> if test "$SSH_AUTH_SOCK"; then
>      ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
> fi
>
> # do initialization stuff that would be done if rc was not there,
> # but is not done automatically if it is there *rolleyes*
> # (copied straight from 'man sshd')
> if read proto cookie && [ -n "$DISPLAY" ]; then
>          if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
>                  # X11UseLocalhost=yes
>                  echo add unix:`echo $DISPLAY |
>                      cut -c11-` $proto $cookie
>          else
>                  # X11UseLocalhost=no
>                  echo add $DISPLAY $proto $cookie
>          fi | xauth -q -
> fi
> -----------------------------------------------------------------------
>
> However, this doesn't seem to work on all machines I pushed tmux 3.6 to.
> Any clues to what needs to be changed in order for it to work again?
> Or: Any better, more modern solutions to the problem?
>
> Cheers,
>          Tobias
>
> --
> You received this message because you are subscribed to the Google Groups
> "tmux-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion, visit
> https://groups.google.com/d/msgid/tmux-users/80822341-c859-499d-8149-2f1cb147874e%40gmx.at
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion, visit 
https://groups.google.com/d/msgid/tmux-users/CAEdLfcFTqTVakf0EjijHLASRK7jq1n8dTaVKYYea2MSa0Q1n-A%40mail.gmail.com.

Reply via email to