Last active
July 31, 2022 09:53
-
-
Save riedel/808529121892efdba444ac82df4c5f15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SSH_AUTH_SOCK=`mktemp -u /tmp/ssh-agent.XXXXXXXXX` | |
nohup socat </dev/null >/dev/null 2>&1 UNIX-LISTEN:$SSH_AUTH_SOCK,umask=066,fork EXEC:"npiperelay -ei //./pipe/openssh-ssh-agent",pipes & | |
SSH_AGENT_PID=$! | |
disown -ah | |
if [ -z ${1+x} ]; then | |
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK;export SSH_AUTH_SOCK;" | |
echo "SSH_AGENT_PID=$SSH_AGENT_PID; export SSH_AGENT_PID;" | |
echo "echo Agent pid $SSH_AGENT_PID;" | |
exit 0 | |
else | |
(tail --pid $$ -f /dev/null; kill $SSH_AGENT_PID) & | |
SSH_AUTH_SOCK=$SSH_AUTH_SOCK exec $* | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Needs https://github.com/jstarks/npiperelay. Also works with putty plink. See https://superuser.com/questions/1526348/share-ssh-agent-socket-or-any-other-named-pipe-between-windows-10-and-cygwin