Files
firestuff/markdown/2016-02-28-ssh-agent-forwarding-screen.md
2019-04-25 02:45:09 +00:00

21 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--# set var="title" value="SSH agent forwarding & screen" -->
<!--# set var="date" value="2016-02-28" -->
<!--# include file="include/top.html" -->
ssh-agent forwarding and screen not playing nicely is one of those things that Ive dealt with so long that it just became routine. Resume a screen from a previous connection? Outgoing SSH wont work, and thats just the way it is. One day this week, I finally decided to see if I can fix it, and fortunately the Internet [provides](https://gist.github.com/martijnvermaat/8070533). That doc has a bunch of complexity about X forwarding, which I havent cared about in years, so heres the distilled version. Youll need to have already [set up agent forwarding](https://developer.github.com/guides/using-ssh-agent-forwarding/). On the host with your screen session:
tee ~/.ssh/rc <<'END'
if test "$SSH_AUTH_SOCK"; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi
END
tee -a ~/.screenrc <<END
setenv SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock
END
Reconnect, restart screen once, never worry about it again. Changing my life.
<!--# include file="include/bottom.html" -->