mirror of
https://github.com/Matir/skel.git
synced 2026-05-26 13:35:42 -07:00
Improve remote SSH agent
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
REMOTE_LINK="${HOME}/.ssh/remote_agent.sock"
|
||||
# Roughly based on this article:
|
||||
# https://werat.github.io/2017/02/04/tmux-ssh-agent-forwarding.html
|
||||
|
||||
if test \! -e "${REMOTE_LINK}" -a -n "${SSH_AUTH_SOCK}" ; then
|
||||
REMOTE_LINK="${HOME}/.ssh/ssh_auth_sock"
|
||||
|
||||
if [ "${1:-}" = "force" ] && [ -S "${SSH_AUTH_SOCK}" ] ; then
|
||||
ln -sf "${SSH_AUTH_SOCK}" "${REMOTE_LINK}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test \! -S "${REMOTE_LINK}" -a -S "${SSH_AUTH_SOCK}" ; then
|
||||
ln -sf "${SSH_AUTH_SOCK}" "${REMOTE_LINK}"
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
# Update environment on reconnect
|
||||
set -g update-environment "DISPLAY WINDOWID SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION"
|
||||
|
||||
# Use symlink socket
|
||||
set-environment -g 'SSH_AUTH_SOCK' ~/.ssh/ssh_auth_sock
|
||||
|
||||
# Custom binds
|
||||
bind K confirm kill-server
|
||||
bind X confirm kill-window
|
||||
|
||||
Reference in New Issue
Block a user